svn commit: r329635 - head/sys/powerpc/powerpc
Author: wma Date: Tue Feb 20 07:30:57 2018 New Revision: 329635 URL: https://svnweb.freebsd.org/changeset/base/329635 Log: PowerPC: Switch to more accurate unit to avoid division rounding On POWER8 architecture there is a timer with 512Mhz frequency. It has about 1,95ns period, but it is rounded to 1ns which is not accurate. Submitted by: Patryk DudaObtained from: Semihalf Reviewed by: wma Sponsored by: IBM, QCM Technologies Differential revision: https://reviews.freebsd.org/D14433 Modified: head/sys/powerpc/powerpc/clock.c Modified: head/sys/powerpc/powerpc/clock.c == --- head/sys/powerpc/powerpc/clock.cTue Feb 20 06:38:55 2018 (r329634) +++ head/sys/powerpc/powerpc/clock.cTue Feb 20 07:30:57 2018 (r329635) @@ -82,7 +82,7 @@ __FBSDID("$FreeBSD$"); * Initially we assume a processor with a bus frequency of 12.5 MHz. */ static int initialized = 0; -static u_long ns_per_tick = 80; +static uint64_tps_per_tick = 8; static u_long ticks_per_sec = 1250; static u_long *decr_counts[MAXCPU]; @@ -178,7 +178,7 @@ decr_init(void) if (platform_smp_get_bsp() != 0) platform_smp_first_cpu(); ticks_per_sec = platform_timebase_freq(); - ns_per_tick = 10 / ticks_per_sec; + ps_per_tick = 1 / ticks_per_sec; set_cputicker(mftb, ticks_per_sec, 0); snprintf(buf, sizeof(buf), "cpu%d:decrementer", curcpu); @@ -307,7 +307,7 @@ DELAY(int n) TSENTER(); tb = mftb(); - ttb = tb + howmany(n * 1000, ns_per_tick); + ttb = tb + howmany((uint64_t)n * 100, ps_per_tick); while (tb < ttb) tb = mftb(); TSEXIT(); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r329634 - head/sys/powerpc/powerpc
Author: wma Date: Tue Feb 20 06:38:55 2018 New Revision: 329634 URL: https://svnweb.freebsd.org/changeset/base/329634 Log: PowerNV: Send SIGILL on HEA illegal instruction exception Currently Hypervisor Emulation Assistance interrupt is unhandled. Executing an undefined instruction in userland triggers kernel panic. Handle this the same way as Facility Unavailable Interrupt - send SIGILL signal to userspace. Submitted by: Michal StanekObtained from: Semihalf Reviewed by: nwhitehorn, p...@semihalf.com, wma Sponsored by: IBM, QCM Technologies Differential revision: https://reviews.freebsd.org/D14437 Modified: head/sys/powerpc/powerpc/trap.c Modified: head/sys/powerpc/powerpc/trap.c == --- head/sys/powerpc/powerpc/trap.c Tue Feb 20 05:35:00 2018 (r329633) +++ head/sys/powerpc/powerpc/trap.c Tue Feb 20 06:38:55 2018 (r329634) @@ -294,6 +294,7 @@ trap(struct trapframe *frame) break; case EXC_FAC: + case EXC_HEA: sig = SIGILL; ucode = ILL_ILLOPC; break; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r329633 - head/sbin/devmatch
Author: imp Date: Tue Feb 20 05:35:00 2018 New Revision: 329633 URL: https://svnweb.freebsd.org/changeset/base/329633 Log: More verbose output. Modified: head/sbin/devmatch/devmatch.c Modified: head/sbin/devmatch/devmatch.c == --- head/sbin/devmatch/devmatch.c Tue Feb 20 05:21:58 2018 (r329632) +++ head/sbin/devmatch/devmatch.c Tue Feb 20 05:35:00 2018 (r329633) @@ -427,6 +427,8 @@ search_hints(const char *bus, const char *dev, const c asprintf(, "%s: %s", *dev ? dev : "unattached", lastmod); else asprintf(, "%s", lastmod); + if (verbose_flag) + printf("Matches --- %s ---\n", lastmod); if (descr != NULL && hit_index < DEVMATCH_MAX_HITS) { match_data[hit_index].descr = descr; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r329632 - head/share/man/man9
Author: kevans Date: Tue Feb 20 05:21:58 2018 New Revision: 329632 URL: https://svnweb.freebsd.org/changeset/base/329632 Log: style.lua(9): Clarify local variable guideline The intent of this guideline is to avoid creating global variables in module scope. Its main purpose is to serve as a reminder that variables at module scope also need to be declared. We want to avoid global variables in general, but this is easier to mess up when designing things in the module scope. Modified: head/share/man/man9/style.lua.9 Modified: head/share/man/man9/style.lua.9 == --- head/share/man/man9/style.lua.9 Tue Feb 20 05:12:39 2018 (r329631) +++ head/share/man/man9/style.lua.9 Tue Feb 20 05:21:58 2018 (r329632) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 19, 2018 +.Dd February 20, 2018 .Dt STYLE.LUA 9 .Os .Sh NAME @@ -86,7 +86,7 @@ should be done explicitly, rather than as a boolean ex Single-line conditional statements and loops should be avoided. .Pp .Ic local -variables should be preferred to module scope variables. +variables should be preferred to global variables in module scope. .Pp Multiple local variables should not be declared .Sy and ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r329631 - head/stand/lua
Author: kevans Date: Tue Feb 20 05:12:39 2018 New Revision: 329631 URL: https://svnweb.freebsd.org/changeset/base/329631 Log: stand/lua: Insert helpful comment for drawer.branddefs Modified: head/stand/lua/drawer.lua Modified: head/stand/lua/drawer.lua == --- head/stand/lua/drawer.lua Tue Feb 20 05:11:17 2018(r329630) +++ head/stand/lua/drawer.lua Tue Feb 20 05:12:39 2018(r329631) @@ -173,6 +173,8 @@ orb = { none = {""}; drawer.branddefs = { + -- Indexed by valid values for loader_brand in loader.conf(5). Valid + -- keys are: graphic (table depicting graphic) ["fbsd"] = { graphic = fbsd_logo, }, ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r329629 - head/stand/lua
Author: kevans Date: Tue Feb 20 05:10:26 2018 New Revision: 329629 URL: https://svnweb.freebsd.org/changeset/base/329629 Log: stand/lua: Use 'graphic' instead of 'logo' for table depicting graphics This is a more sensible name that offers less redundancy when referring to it (vs. logodef.logo). Switch to it while the getting is good. Modified: head/stand/lua/drawer.lua Modified: head/stand/lua/drawer.lua == --- head/stand/lua/drawer.lua Tue Feb 20 05:07:21 2018(r329628) +++ head/stand/lua/drawer.lua Tue Feb 20 05:10:26 2018(r329629) @@ -182,36 +182,36 @@ drawer.branddefs = { drawer.logodefs = { -- Indexed by valid values for loader_logo in loader.conf(5). Valid keys - -- are: requires_color (boolean), logo (table depicting graphic), and + -- are: requires_color (boolean), graphic (table depicting graphic), and -- shift (table containing x and y). ["beastie"] = { requires_color = true, - logo = beastie_color, + graphic = beastie_color, }, ["beastiebw"] = { - logo = beastie, + graphic = beastie, }, ["fbsdbw"] = { - logo = fbsd_logo_v, + graphic = fbsd_logo_v, shift = {x = 5, y = 4}, }, ["orb"] = { requires_color = true, - logo = orb_color, + graphic = orb_color, shift = {x = 2, y = 4}, }, ["orbbw"] = { - logo = orb, + graphic = orb, shift = {x = 2, y = 4}, }, ["tribute"] = { - logo = fbsd_logo, + graphic = fbsd_logo, }, ["tributebw"] = { - logo = fbsd_logo, + graphic = fbsd_logo, }, ["none"] = { - logo = none, + graphic = none, shift = {x = 17, y = 0}, }, }; @@ -352,13 +352,13 @@ function drawer.drawlogo() -- Lookup local logodef = drawer.logodefs[logo]; - if (logodef ~= nil) and (logodef.logo == none) then + if (logodef ~= nil) and (logodef.graphic == none) then -- centre brand and text if no logo if (not none_shifted) then shift_brand_text(logodef.shift); none_shifted = true; end - elseif (logodef == nil) or (logodef.logo == nil) or + elseif (logodef == nil) or (logodef.graphic == nil) or ((not colored) and logodef.requires_color) then -- Choose a sensible default if (colored) then @@ -367,12 +367,11 @@ function drawer.drawlogo() logodef = drawer.logodefs["orbbw"]; end end - logo = logodef.logo; if (logodef.shift ~= nil) then x = x + logodef.shift.x; y = y + logodef.shift.y; end - drawer.draw(x, y, logo); + drawer.draw(x, y, logodef.graphic); end return drawer; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r329630 - head/stand/lua
Author: kevans Date: Tue Feb 20 05:11:17 2018 New Revision: 329630 URL: https://svnweb.freebsd.org/changeset/base/329630 Log: stand/lua: Stick a copyright notice on drawer.lua Modified: head/stand/lua/drawer.lua Modified: head/stand/lua/drawer.lua == --- head/stand/lua/drawer.lua Tue Feb 20 05:10:26 2018(r329629) +++ head/stand/lua/drawer.lua Tue Feb 20 05:11:17 2018(r329630) @@ -1,5 +1,6 @@ -- -- Copyright (c) 2015 Pedro Souza+-- Copyright (c) 2018 Kyle Evans -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r329628 - in head/sys/cddl/contrib/opensolaris: common/nvpair uts/common/fs/zfs
Author: mav Date: Tue Feb 20 05:07:21 2018 New Revision: 329628 URL: https://svnweb.freebsd.org/changeset/base/329628 Log: MFC r316910: 7812 Remove gender specific language illumos/illumos-gate@48bbca816818409505a6e214d0911fda44e622e3 https://github.com/illumos/illumos-gate/commit/48bbca816818409505a6e214d0911fda44e622e3 https://www.illumos.org/issues/7812 This change removes all gendered language that did not refer specifically to an individual person or pet. The convention taken was to use variations on "they" when referring to users and/or human beings, while using "it" when referring to code, functions, and/or libraries. Additionally, we took the liberty to fix up any whitespace issues that were found in any files that were already being modified. Reviewed by: Matt AhrensReviewed by: Prakash Surya Reviewed by: Steve Gonczi Reviewed by: Chris Williamson Reviewed by: George Wilson Reviewed by: Igor Kozhukhov Reviewed by: Dan McDonald Reviewed by: Robert Mustacchi Approved by: Richard Lowe Author: Daniel Hoffman Modified: head/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c == --- head/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c Tue Feb 20 05:06:11 2018(r329627) +++ head/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c Tue Feb 20 05:07:21 2018(r329628) @@ -2379,7 +2379,7 @@ nvlist_xpack(nvlist_t *nvl, char **bufp, size_t *bufle * 1. The nvlist has fixed allocator properties. *All other nvlist routines (like nvlist_add_*, ...) use *these properties. -* 2. When using nvlist_pack() the user can specify his own +* 2. When using nvlist_pack() the user can specify their own *allocator properties (e.g. by using KM_NOSLEEP). * * We use the user specified properties (2). A clearer solution Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c == --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c Tue Feb 20 05:06:11 2018(r329627) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c Tue Feb 20 05:07:21 2018(r329628) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2013, 2015 by Delphix. All rights reserved. + * Copyright (c) 2013, 2016 by Delphix. All rights reserved. * Copyright 2017 Nexenta Systems, Inc. */ Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c == --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Tue Feb 20 05:06:11 2018(r329627) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Tue Feb 20 05:07:21 2018(r329628) @@ -1812,7 +1812,7 @@ zio_reexecute(zio_t *pio) /* * Now that all children have been reexecuted, execute the parent. * We don't reexecute "The Godfather" I/O here as it's the -* responsibility of the caller to wait on him. +* responsibility of the caller to wait on it. */ if (!(pio->io_flags & ZIO_FLAG_GODFATHER)) { pio->io_queued_timestamp = gethrtime(); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r329627 - head/stand/lua
Author: kevans Date: Tue Feb 20 05:06:11 2018 New Revision: 329627 URL: https://svnweb.freebsd.org/changeset/base/329627 Log: stand/lua: Refactor brands into drawer.branddefs Modified: head/stand/lua/drawer.lua Modified: head/stand/lua/drawer.lua == --- head/stand/lua/drawer.lua Tue Feb 20 04:56:03 2018(r329626) +++ head/stand/lua/drawer.lua Tue Feb 20 05:06:11 2018(r329627) @@ -171,6 +171,15 @@ orb = { none = {""}; +drawer.branddefs = { + ["fbsd"] = { + graphic = fbsd_logo, + }, + ["none"] = { + graphic = none, + }, +}; + drawer.logodefs = { -- Indexed by valid values for loader_logo in loader.conf(5). Valid keys -- are: requires_color (boolean), logo (table depicting graphic), and @@ -315,9 +324,11 @@ function drawer.drawbrand() local y = tonumber(loader.getenv("loader_brand_y")) or drawer.brand_position.y; - local logo = load("return " .. tostring(loader.getenv("loader_brand")))() or - fbsd_logo; - drawer.draw(x, y, logo); + local graphic = drawer.branddefs[loader.getenv("loader_brand")]; + if (graphic == nil) then + graphic = fbsd_logo; + end + drawer.draw(x, y, graphic); end function shift_brand_text(shift) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r329626 - head/stand/lua
Author: kevans Date: Tue Feb 20 04:56:03 2018 New Revision: 329626 URL: https://svnweb.freebsd.org/changeset/base/329626 Log: stand/lua: Refactor logos into drawer.logodefs table This refactor makes it straightforward to add new logos for drawing and organizes logo definitions in a logical manner. The graphic to be drawn for each logo may again be modified outside of drawer, but it must be done on a case-by-case basis as a modification to the loader_logo. Modified: head/stand/lua/drawer.lua Modified: head/stand/lua/drawer.lua == --- head/stand/lua/drawer.lua Tue Feb 20 04:36:51 2018(r329625) +++ head/stand/lua/drawer.lua Tue Feb 20 04:56:03 2018(r329626) @@ -38,6 +38,7 @@ local beastie; local fbsd_logo_v; local orb; local none; +local none_shifted = false; drawer.menu_name_handlers = { -- Menu name handlers should take the menu being drawn and entry being @@ -59,9 +60,6 @@ drawer.menu_name_handlers = { drawer.brand_position = {x = 2, y = 1}; drawer.logo_position = {x = 46, y = 1}; -drawer.fbsd_logo_shift = {x = 5, y = 4}; -drawer.orb_shift = {x = 2, y = 4}; -drawer.none_shift = {x = 17, y = 0}; drawer.menu_position = {x = 6, y = 11}; drawer.box_pos_dim = {x = 3, y = 10, w = 41, h = 11}; @@ -173,6 +171,42 @@ orb = { none = {""}; +drawer.logodefs = { + -- Indexed by valid values for loader_logo in loader.conf(5). Valid keys + -- are: requires_color (boolean), logo (table depicting graphic), and + -- shift (table containing x and y). + ["beastie"] = { + requires_color = true, + logo = beastie_color, + }, + ["beastiebw"] = { + logo = beastie, + }, + ["fbsdbw"] = { + logo = fbsd_logo_v, + shift = {x = 5, y = 4}, + }, + ["orb"] = { + requires_color = true, + logo = orb_color, + shift = {x = 2, y = 4}, + }, + ["orbbw"] = { + logo = orb, + shift = {x = 2, y = 4}, + }, + ["tribute"] = { + logo = fbsd_logo, + }, + ["tributebw"] = { + logo = fbsd_logo, + }, + ["none"] = { + logo = none, + shift = {x = 17, y = 0}, + }, +}; + function drawer.drawscreen(menu_opts) -- drawlogo() must go first. -- it determines the positions of other elements @@ -286,6 +320,15 @@ function drawer.drawbrand() drawer.draw(x, y, logo); end +function shift_brand_text(shift) + drawer.brand_position.x = drawer.brand_position.x + shift.x; + drawer.brand_position.y = drawer.brand_position.y + shift.y; + drawer.menu_position.x = drawer.menu_position.x + shift.x; + drawer.menu_position.y = drawer.menu_position.y + shift.y; + drawer.box_pos_dim.x = drawer.box_pos_dim.x + shift.x; + drawer.box_pos_dim.y = drawer.box_pos_dim.y + shift.y; +end + function drawer.drawlogo() local x = tonumber(loader.getenv("loader_logo_x")) or drawer.logo_position.x; @@ -293,51 +336,32 @@ function drawer.drawlogo() drawer.logo_position.y; local logo = loader.getenv("loader_logo"); - local s = {x = 0, y = 0}; local colored = color.isEnabled(); - if (logo == "beastie") then - if (colored) then - logo = beastie_color; + -- Lookup + local logodef = drawer.logodefs[logo]; + + if (logodef ~= nil) and (logodef.logo == none) then + -- centre brand and text if no logo + if (not none_shifted) then + shift_brand_text(logodef.shift); + none_shifted = true; end - elseif (logo == "beastiebw") then - logo = beastie; - elseif (logo == "fbsdbw") then - logo = fbsd_logo_v; - s = drawer.fbsd_logo_shift; - elseif (logo == "orb") then + elseif (logodef == nil) or (logodef.logo == nil) or + ((not colored) and logodef.requires_color) then + -- Choose a sensible default if (colored) then - logo = orb_color; - end - s = drawer.orb_shift; - elseif (logo == "orbbw") then - logo = orb; - s = drawer.orb_shift; - elseif (logo == "tribute") then - logo = fbsd_logo; - elseif (logo == "tributebw") then - logo = fbsd_logo; - elseif (logo == "none") then - --centre brand and text if no logo - drawer.brand_position.x = drawer.brand_position.x + drawer.none_shift.x; - drawer.brand_position.y = drawer.brand_position.y + drawer.none_shift.y; - drawer.menu_position.x = drawer.menu_position.x +
svn commit: r329625 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys
Author: mav Date: Tue Feb 20 04:36:51 2018 New Revision: 329625 URL: https://svnweb.freebsd.org/changeset/base/329625 Log: MFV r307315: 7301 zpool export -f should be able to interrupt file freeing Reviewed by: Matthew AhrensReviewed by: Sanjay Nadkarni Reviewed by: Saso Kiselkov Reviewed by: John Kennedy Author: Alek Pinchuk Closes #175 Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c == --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Tue Feb 20 04:23:43 2018(r329624) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Tue Feb 20 04:36:51 2018(r329625) @@ -24,7 +24,7 @@ */ /* Copyright (c) 2013 by Saso Kiselkov. All rights reserved. */ /* Copyright (c) 2013, Joyent, Inc. All rights reserved. */ -/* Copyright (c) 2014, Nexenta Systems, Inc. All rights reserved. */ +/* Copyright 2016 Nexenta Systems, Inc. All rights reserved. */ #include #include @@ -723,6 +723,22 @@ get_next_chunk(dnode_t *dn, uint64_t *start, uint64_t return (0); } +/* + * If this objset is of type OST_ZFS return true if vfs's unmounted flag is set, + * otherwise return false. + * Used below in dmu_free_long_range_impl() to enable abort when unmounting + */ +/*ARGSUSED*/ +static boolean_t +dmu_objset_zfs_unmounting(objset_t *os) +{ +#ifdef _KERNEL + if (dmu_objset_type(os) == DMU_OST_ZFS) + return (zfs_get_vfs_flag_unmounted(os)); +#endif + return (B_FALSE); +} + static int dmu_free_long_range_impl(objset_t *os, dnode_t *dn, uint64_t offset, uint64_t length) @@ -748,6 +764,9 @@ dmu_free_long_range_impl(objset_t *os, dnode_t *dn, ui uint64_t chunk_end, chunk_begin, chunk_len; uint64_t long_free_dirty_all_txgs = 0; dmu_tx_t *tx; + + if (dmu_objset_zfs_unmounting(dn->dn_objset)) + return (SET_ERROR(EINTR)); chunk_end = chunk_begin = offset + length; Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h == --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h Tue Feb 20 04:23:43 2018(r329624) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h Tue Feb 20 04:36:51 2018(r329625) @@ -22,6 +22,7 @@ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2015 by Delphix. All rights reserved. * Copyright (c) 2014 Integros [integros.com] + * Copyright 2016 Nexenta Systems, Inc. All rights reserved. */ #ifndef_SYS_FS_ZFS_ZNODE_H @@ -322,6 +323,7 @@ extern int zfs_create_op_tables(); extern dev_t zfs_cmpldev(uint64_t); extern int zfs_get_zplprop(objset_t *os, zfs_prop_t prop, uint64_t *value); extern int zfs_get_stats(objset_t *os, nvlist_t *nv); +extern boolean_t zfs_get_vfs_flag_unmounted(objset_t *os); extern voidzfs_znode_dmu_fini(znode_t *); extern void zfs_log_create(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype, Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c == --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c Tue Feb 20 04:23:43 2018(r329624) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c Tue Feb 20 04:36:51 2018(r329625) @@ -428,8 +428,8 @@ zfs_rmnode(znode_t *zp) error = dmu_free_long_range(os, zp->z_id, 0, DMU_OBJECT_END); if (error) { /* -* Not enough space. Leave the file in the unlinked -* set. +* Not enough space or we were interrupted by unmount. +* Leave the file in the unlinked set. */ zfs_znode_dmu_fini(zp); zfs_znode_free(zp); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c == --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.cTue Feb 20 04:23:43 2018(r329624) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.cTue Feb 20 04:36:51 2018(r329625) @@ -24,6 +24,7 @@
svn commit: r329624 - head/stand/lua
Author: kevans Date: Tue Feb 20 04:23:43 2018 New Revision: 329624 URL: https://svnweb.freebsd.org/changeset/base/329624 Log: stand/lua: Reduce exposure of the drawer module As part of an effort to slowly reduce our exports overall to a set of stable properties/functions, go ahead and reduce what drawer exposes to others. The graphics should generally not be modified on their own, but their position could be modified if additional grahics also need to be drawn. Export position/shift information, but leave the actual graphic local to the module. The next step will be to create a 'menudef' that gets exported instead, with each entry in the menudef table describing the graphic to be drawn along with specific positioning information. Modified: head/stand/lua/drawer.lua Modified: head/stand/lua/drawer.lua == --- head/stand/lua/drawer.lua Tue Feb 20 04:14:12 2018(r329623) +++ head/stand/lua/drawer.lua Tue Feb 20 04:23:43 2018(r329624) @@ -32,6 +32,13 @@ local screen = require("screen"); local drawer = {}; +local fbsd_logo; +local beastie_color; +local beastie; +local fbsd_logo_v; +local orb; +local none; + drawer.menu_name_handlers = { -- Menu name handlers should take the menu being drawn and entry being -- drawn as parameters, and return the name of the item. @@ -51,7 +58,14 @@ drawer.menu_name_handlers = { }; drawer.brand_position = {x = 2, y = 1}; -drawer.fbsd_logo = { +drawer.logo_position = {x = 46, y = 1}; +drawer.fbsd_logo_shift = {x = 5, y = 4}; +drawer.orb_shift = {x = 2, y = 4}; +drawer.none_shift = {x = 17, y = 0}; +drawer.menu_position = {x = 6, y = 11}; +drawer.box_pos_dim = {x = 3, y = 10, w = 41, h = 11}; + +fbsd_logo = { " __ _ _ ", " | | | _ \\ / | __ \\ ", " | |___ _ __ ___ ___ | |_) | (___ | | | |", @@ -61,8 +75,7 @@ drawer.fbsd_logo = { " |_| |_| \\___|\\___||/|_/|_/ " }; -drawer.logo_position = {x = 46, y = 1}; -drawer.beastie_color = { +beastie_color = { " \027[31m,,", " /()`", " \\ \\___ / |", @@ -84,7 +97,7 @@ drawer.beastie_color = { " `--{__)\027[37m" }; -drawer.beastie = { +beastie = { " ,,", " /()`", " \\ \\___ / |", @@ -106,8 +119,7 @@ drawer.beastie = { " `--{__)" }; -drawer.fbsd_logo_shift = {x = 5, y = 4}; -drawer.fbsd_logo_v = { +fbsd_logo_v = { " __", " | | __ ___ ___ ", " | |__ | '__/ _ \\/ _ \\", @@ -123,8 +135,7 @@ drawer.fbsd_logo_v = { " |/|_/|_/" }; -drawer.orb_shift = {x = 2, y = 4}; -drawer.orb_color = { +orb_color = { " \027[31m```\027[31;1m`\027[31m", " s` `.---...\027[31;1m--.``` -/\027[31m", " +o .--` \027[31;1m/y:` +.\027[31m", @@ -142,7 +153,7 @@ drawer.orb_color = { " .---..\027[37m" }; -drawer.orb = { +orb = { " ````", " s` `.---...--.``` -/", " +o .--` /y:` +.", @@ -160,14 +171,8 @@ drawer.orb = { " .---.." }; -drawer.none = {""}; +none = {""}; -drawer.none_shift = {x = 17, y = 0}; - -drawer.menu_position = {x = 6, y = 11}; - -drawer.box_pos_dim = {x = 3, y = 10, w = 41, h = 11}; - function drawer.drawscreen(menu_opts) -- drawlogo() must go first. -- it determines the positions of other elements @@ -277,7 +282,7 @@ function drawer.drawbrand() drawer.brand_position.y; local logo = load("return " .. tostring(loader.getenv("loader_brand")))() or - drawer.fbsd_logo; + fbsd_logo; drawer.draw(x, y, logo); end @@ -293,25 +298,25 @@ function drawer.drawlogo() if (logo == "beastie") then if (colored) then - logo = drawer.beastie_color; + logo = beastie_color; end elseif (logo == "beastiebw") then - logo = drawer.beastie; + logo = beastie; elseif (logo == "fbsdbw") then - logo = drawer.fbsd_logo_v; + logo = fbsd_logo_v; s = drawer.fbsd_logo_shift; elseif (logo == "orb") then if (colored) then - logo = drawer.orb_color; + logo = orb_color; end s = drawer.orb_shift; elseif (logo == "orbbw") then - logo = drawer.orb; + logo = orb; s = drawer.orb_shift; elseif (logo == "tribute") then - logo = drawer.fbsd_logo; + logo
svn commit: r329623 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Author: mav Date: Tue Feb 20 04:14:12 2018 New Revision: 329623 URL: https://svnweb.freebsd.org/changeset/base/329623 Log: MFV r302649: 7016 arc_available_memory is not 32-bit safe illumos/illumos-gate@0dd053d7d890618ea1fc697b07de364e69eb4190 https://github.com/illumos/illumos-gate/commit/0dd053d7d890618ea1fc697b07de364e69eb4190 https://www.illumos.org/issues/7016 upstream DLPX-39446 arc_available_memory is not 32-bit safe https://github.com/delphix/delphix-os/commit/ 6b353ea3b8a1610be22e71e657d051743c64190b related to this upstream: DLPX-38547 delphix engine hang https://github.com/delphix/delphix-os/commit/ 3183a567b3e8c62a74a65885ca60c86f3d693783 DLPX-38547 delphix engine hang (fix static global) https://github.com/delphix/delphix-os/commit/ 22ac551d8ef085ad66cc8f65e51ac372b12993b9 DLPX-38882 system hung waiting on free segment https://github.com/delphix/delphix-os/commit/ cdd6beef7548cd3b12f0fc0328eeb3af540079c2 Reviewed by: Igor KozhukhovReviewed by: Matthew Ahrens Reviewed by: Paul Dagnelie Reviewed by: George Wilson Approved by: Gordon Ross Author: Prakash Surya Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c == --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Tue Feb 20 04:11:48 2018(r329622) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Tue Feb 20 04:14:12 2018(r329623) @@ -350,6 +350,11 @@ extern boolean_t zfs_prefetch_disable; static boolean_t arc_warm; /* + * log2 fraction of the zio arena to keep free. + */ +int arc_zio_arena_free_shift = 2; + +/* * These tunables are for performance analysis. */ uint64_t zfs_arc_max; @@ -4321,15 +4326,16 @@ arc_available_memory(void) /* * If zio data pages are being allocated out of a separate heap segment, * then enforce that the size of available vmem for this arena remains -* above about 1/16th free. +* above about 1/4th (1/(2^arc_zio_arena_free_shift)) free. * -* Note: The 1/16th arena free requirement was put in place -* to aggressively evict memory from the arc in order to avoid -* memory fragmentation issues. +* Note that reducing the arc_zio_arena_free_shift keeps more virtual +* memory (in the zio_arena) free, which can avoid memory +* fragmentation issues. */ if (zio_arena != NULL) { n = (int64_t)vmem_size(zio_arena, VMEM_FREE) - - (vmem_size(zio_arena, VMEM_ALLOC) >> 4); + (vmem_size(zio_arena, VMEM_ALLOC) >> + arc_zio_arena_free_shift); if (n < lowest) { lowest = n; r = FMR_ZIO_ARENA; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r329622 - head/stand/lua
Author: kevans Date: Tue Feb 20 04:11:48 2018 New Revision: 329622 URL: https://svnweb.freebsd.org/changeset/base/329622 Log: stand/lua: Move drawer.menu_name_handlers further up As a good candidate for modification, move this table further up in the module to improve visibility. Modified: head/stand/lua/drawer.lua Modified: head/stand/lua/drawer.lua == --- head/stand/lua/drawer.lua Tue Feb 20 03:58:45 2018(r329621) +++ head/stand/lua/drawer.lua Tue Feb 20 04:11:48 2018(r329622) @@ -32,6 +32,24 @@ local screen = require("screen"); local drawer = {}; +drawer.menu_name_handlers = { + -- Menu name handlers should take the menu being drawn and entry being + -- drawn as parameters, and return the name of the item. + -- This is designed so that everything, including menu separators, may + -- have their names derived differently. The default action for entry + -- types not specified here is to call and use entry.name(). + [core.MENU_CAROUSEL_ENTRY] = function(drawing_menu, entry) + local carid = entry.carousel_id; + local caridx = menu.getCarouselIndex(carid); + local choices = entry.items(); + + if (#choices < caridx) then + caridx = 1; + end + return entry.name(caridx, choices[caridx], choices); + end, +}; + drawer.brand_position = {x = 2, y = 1}; drawer.fbsd_logo = { " __ _ _ ", @@ -158,24 +176,6 @@ function drawer.drawscreen(menu_opts) drawer.drawbox(); return drawer.drawmenu(menu_opts); end - -drawer.menu_name_handlers = { - -- Menu name handlers should take the menu being drawn and entry being - -- drawn as parameters, and return the name of the item. - -- This is designed so that everything, including menu separators, may - -- have their names derived differently. The default action for entry - -- types not specified here is to call and use entry.name(). - [core.MENU_CAROUSEL_ENTRY] = function(drawing_menu, entry) - local carid = entry.carousel_id; - local caridx = menu.getCarouselIndex(carid); - local choices = entry.items(); - - if (#choices < caridx) then - caridx = 1; - end - return entry.name(caridx, choices[caridx], choices); - end, -}; function menu_entry_name(drawing_menu, entry) local name_handler = drawer.menu_name_handlers[entry.entry_type]; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r329621 - head/stand/lua
Author: kevans Date: Tue Feb 20 03:58:45 2018 New Revision: 329621 URL: https://svnweb.freebsd.org/changeset/base/329621 Log: stand/lua: Add and use drawer.menu_name_handlers Pull out specialized naming behavior into drawer.menu_name_handlers. This is currently only needed for the carousel entry, where naming is based on the current choice and the menu item purposefully does not store this state. The setup was designed so that every type can have a special name handler, and the default action is to simply use the result of entry.name(). Modified: head/stand/lua/drawer.lua Modified: head/stand/lua/drawer.lua == --- head/stand/lua/drawer.lua Tue Feb 20 03:51:09 2018(r329620) +++ head/stand/lua/drawer.lua Tue Feb 20 03:58:45 2018(r329621) @@ -159,6 +159,33 @@ function drawer.drawscreen(menu_opts) return drawer.drawmenu(menu_opts); end +drawer.menu_name_handlers = { + -- Menu name handlers should take the menu being drawn and entry being + -- drawn as parameters, and return the name of the item. + -- This is designed so that everything, including menu separators, may + -- have their names derived differently. The default action for entry + -- types not specified here is to call and use entry.name(). + [core.MENU_CAROUSEL_ENTRY] = function(drawing_menu, entry) + local carid = entry.carousel_id; + local caridx = menu.getCarouselIndex(carid); + local choices = entry.items(); + + if (#choices < caridx) then + caridx = 1; + end + return entry.name(caridx, choices[caridx], choices); + end, +}; + +function menu_entry_name(drawing_menu, entry) + local name_handler = drawer.menu_name_handlers[entry.entry_type]; + + if (name_handler ~= nil) then + return name_handler(drawing_menu, entry); + end + return entry.name(); +end + function drawer.drawmenu(m) x = drawer.menu_position.x; y = drawer.menu_position.y; @@ -179,22 +206,9 @@ function drawer.drawmenu(m) if (e.entry_type ~= core.MENU_SEPARATOR) then entry_num = entry_num + 1; screen.setcursor(x, y + line_num); - local name = ""; - if (e.entry_type == core.MENU_CAROUSEL_ENTRY) then - local carid = e.carousel_id; - local caridx = menu.getCarouselIndex(carid); - local choices = e.items(); + print(entry_num .. ". " .. menu_entry_name(m, e)); - if (#choices < caridx) then - caridx = 1; - end - name = e.name(caridx, choices[caridx], choices); - else - name = e.name(); - end - print(entry_num .. ". " .. name); - -- fill the alias table alias_table[tostring(entry_num)] = e; if (e.alias ~= nil) then @@ -204,7 +218,7 @@ function drawer.drawmenu(m) end else screen.setcursor(x, y + line_num); - print(e.name()); + print(menu_entry_name(m, e)); end ::continue:: end ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r329620 - head/sys/dev/flash
Author: ian Date: Tue Feb 20 03:51:09 2018 New Revision: 329620 URL: https://svnweb.freebsd.org/changeset/base/329620 Log: Add missing MODULE_DEPENDS(). Modified: head/sys/dev/flash/at45d.c head/sys/dev/flash/mx25l.c Modified: head/sys/dev/flash/at45d.c == --- head/sys/dev/flash/at45d.c Tue Feb 20 03:40:16 2018(r329619) +++ head/sys/dev/flash/at45d.c Tue Feb 20 03:51:09 2018(r329620) @@ -450,3 +450,4 @@ static driver_t at45d_driver = { }; DRIVER_MODULE(at45d, spibus, at45d_driver, at45d_devclass, NULL, NULL); +MODULE_DEPEND(at45d, spibus, 1, 1, 1); Modified: head/sys/dev/flash/mx25l.c == --- head/sys/dev/flash/mx25l.c Tue Feb 20 03:40:16 2018(r329619) +++ head/sys/dev/flash/mx25l.c Tue Feb 20 03:51:09 2018(r329620) @@ -648,3 +648,4 @@ static driver_t mx25l_driver = { }; DRIVER_MODULE(mx25l, spibus, mx25l_driver, mx25l_devclass, 0, 0); +MODULE_DEPEND(mx25l, spibus, 1, 1, 1); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r329619 - head/stand/lua
Author: kevans Date: Tue Feb 20 03:40:16 2018 New Revision: 329619 URL: https://svnweb.freebsd.org/changeset/base/329619 Log: stand/lua: Extract menu handlers out into menu.handlers table This is a bit cleaner than our former method of an if ... else chain of handlers. Store handlers in the menu.handlers table so that they may be added to or removed dynamically. All handlers take the current menu and selected entry as parameters, and their return value indicates whether the menu processor should continue or not. An omitted return value or 'true' will indicate that we should continue, while returning 'false' will indicate that we should exit the current menu. The omitted return value behavior is due to continuing the loop being the more common situation. Modified: head/stand/lua/menu.lua Modified: head/stand/lua/menu.lua == --- head/stand/lua/menu.lua Tue Feb 20 02:32:22 2018(r329618) +++ head/stand/lua/menu.lua Tue Feb 20 03:40:16 2018(r329619) @@ -42,6 +42,40 @@ local run; local autoboot; local carousel_choices = {}; +menu.handlers = { + -- Menu handlers take the current menu and selected entry as parameters, + -- and should return a boolean indicating whether execution should + -- continue or not. The return value may be omitted if this entry should + -- have no bearing on whether we continue or not, indicating that we + -- should just continue after execution. + [core.MENU_ENTRY] = function(current_menu, entry) + -- run function + entry.func(); + end, + [core.MENU_CAROUSEL_ENTRY] = function(current_menu, entry) + -- carousel (rotating) functionality + local carid = entry.carousel_id; + local caridx = menu.getCarouselIndex(carid); + local choices = entry.items(); + + if (#choices > 0) then + caridx = (caridx % #choices) + 1; + menu.setCarouselIndex(carid, caridx); + entry.func(caridx, choices[caridx], choices); + end + end, + [core.MENU_SUBMENU] = function(current_menu, entry) + -- recurse + return menu.run(entry.submenu()); + end, + [core.MENU_RETURN] = function(current_menu, entry) + -- allow entry to have a function/side effect + if (entry.func ~= nil) then + entry.func(); + end + return false; + end, +}; -- loader menu tree is rooted at menu.welcome menu.boot_options = { @@ -338,31 +372,16 @@ function menu.run(m) -- if we have an alias do the assigned action: if (sel_entry ~= nil) then - if (sel_entry.entry_type == core.MENU_ENTRY) then - -- run function - sel_entry.func(); - elseif (sel_entry.entry_type == core.MENU_CAROUSEL_ENTRY) then - -- carousel (rotating) functionality - local carid = sel_entry.carousel_id; - local caridx = menu.getCarouselIndex(carid); - local choices = sel_entry.items(); - - if (#choices > 0) then - caridx = (caridx % #choices) + 1; - menu.setCarouselIndex(carid, caridx); - sel_entry.func(caridx, choices[caridx], - choices); + -- Get menu handler + local handler = menu.handlers[sel_entry.entry_type]; + if (handler ~= nil) then + -- The handler's return value indicates whether + -- we need to exit this menu. An omitted return + -- value means "continue" by default. + cont = handler(m, sel_entry); + if (cont == nil) then + cont = true; end - elseif (sel_entry.entry_type == core.MENU_SUBMENU) then - -- recurse - cont = menu.run(sel_entry.submenu()); - elseif (sel_entry.entry_type == core.MENU_RETURN) then - -- allow entry to have a function/side effect - if (sel_entry.func ~= nil) then - sel_entry.func(); - end - -- break recurse - cont = false; end
svn commit: r329615 - head/sys/kern
Author: mjg Date: Tue Feb 20 02:18:30 2018 New Revision: 329615 URL: https://svnweb.freebsd.org/changeset/base/329615 Log: Reduce contention on the proctree lock during heavy package build. There is a proctree -> allproc ordering established. Most of the time it is either xlock -> xlock or slock -> slock. On fork however there is a slock -> xlock pair which results in pathological wait times due to threads keeping proctree held for reading and all waiting on allproc. Switch this to xlock -> xlock. Longer term fix would get rid of proctree in this place to begin with. Right now it is necessary to walk the session/process group lists to determine which id is free. The walk can be avoided e.g. with bitmaps. The exit path used to have one place which dealt with allproc and then with proctree. Move the allproc acquire into the section protected by proctree. This reduces contention against threads waiting on proctree in the fork codepath - the fork proctree holder does not have to wait for allproc as often. Finally, move tidhash manipulation outside of the area protected by either of these locks. The removal from the hash was already unprotected. There is no legitimate reason to look up thread ids for a process still under construction. This results in about 50% wait time reduction during -j 128 package build. Modified: head/sys/kern/kern_exit.c head/sys/kern/kern_fork.c Modified: head/sys/kern/kern_exit.c == --- head/sys/kern/kern_exit.c Tue Feb 20 02:03:29 2018(r329614) +++ head/sys/kern/kern_exit.c Tue Feb 20 02:18:30 2018(r329615) @@ -424,16 +424,6 @@ exit1(struct thread *td, int rval, int signo) tidhash_remove(td); /* -* Remove proc from allproc queue and pidhash chain. -* Place onto zombproc. Unlink from parent's child list. -*/ - sx_xlock(_lock); - LIST_REMOVE(p, p_list); - LIST_INSERT_HEAD(, p, p_list); - LIST_REMOVE(p, p_hash); - sx_xunlock(_lock); - - /* * Call machine-dependent code to release any * machine-dependent resources other than the address space. * The address space is released by "vmspace_exitfree(p)" in @@ -443,12 +433,22 @@ exit1(struct thread *td, int rval, int signo) WITNESS_WARN(WARN_PANIC, NULL, "process (pid %d) exiting", p->p_pid); + sx_xlock(_lock); /* +* Remove proc from allproc queue and pidhash chain. +* Place onto zombproc. Unlink from parent's child list. +*/ + sx_xlock(_lock); + LIST_REMOVE(p, p_list); + LIST_INSERT_HEAD(, p, p_list); + LIST_REMOVE(p, p_hash); + sx_xunlock(_lock); + + /* * Reparent all children processes: * - traced ones to the original parent (or init if we are that parent) * - the rest to init */ - sx_xlock(_lock); q = LIST_FIRST(>p_children); if (q != NULL) /* only need this if any child is S_ZOMB */ wakeup(q->p_reaper); Modified: head/sys/kern/kern_fork.c == --- head/sys/kern/kern_fork.c Tue Feb 20 02:03:29 2018(r329614) +++ head/sys/kern/kern_fork.c Tue Feb 20 02:18:30 2018(r329615) @@ -394,7 +394,7 @@ do_fork(struct thread *td, struct fork_req *fr, struct struct filedesc_to_leader *fdtol; struct sigacts *newsigacts; - sx_assert(_lock, SX_SLOCKED); + sx_assert(_lock, SX_LOCKED); sx_assert(_lock, SX_XLOCKED); p1 = td->td_proc; @@ -407,12 +407,11 @@ do_fork(struct thread *td, struct fork_req *fr, struct LIST_INSERT_HEAD(, p2, p_list); allproc_gen++; LIST_INSERT_HEAD(PIDHASH(p2->p_pid), p2, p_hash); - tidhash_add(td2); PROC_LOCK(p2); PROC_LOCK(p1); sx_xunlock(_lock); - sx_sunlock(_lock); + sx_xunlock(_lock); bcopy(>p_startcopy, >p_startcopy, __rangeof(struct proc, p_startcopy, p_endcopy)); @@ -428,6 +427,8 @@ do_fork(struct thread *td, struct fork_req *fr, struct PROC_UNLOCK(p2); + tidhash_add(td2); + /* * Malloc things while we don't hold any locks. */ @@ -954,7 +955,7 @@ fork1(struct thread *td, struct fork_req *fr) STAILQ_INIT(>p_ktr); /* We have to lock the process tree while we look for a pid. */ - sx_slock(_lock); + sx_xlock(_lock); sx_xlock(_lock); /* @@ -977,7 +978,7 @@ fork1(struct thread *td, struct fork_req *fr) error = EAGAIN; sx_xunlock(_lock); - sx_sunlock(_lock); + sx_xunlock(_lock); #ifdef MAC mac_proc_destroy(newproc); #endif ___ svn-src-all@freebsd.org mailing list
svn commit: r329614 - head/stand/lua
Author: kevans Date: Tue Feb 20 02:03:29 2018 New Revision: 329614 URL: https://svnweb.freebsd.org/changeset/base/329614 Log: stand/lua: Don't set ACPI off just because we can't detect it. This should unbreak EFI/!i386 cases. Reported by: Peter LeiModified: head/stand/lua/core.lua Modified: head/stand/lua/core.lua == --- head/stand/lua/core.lua Tue Feb 20 00:34:42 2018(r329613) +++ head/stand/lua/core.lua Tue Feb 20 02:03:29 2018(r329614) @@ -230,5 +230,11 @@ function core.shallowCopyTable(tbl) return new_tbl; end -core.setACPI(core.getACPIPresent(false)); +-- On i386, hint.acpi.0.rsdp will be set before we're loaded. On !i386, it will +-- generally be set upon execution of the kernel. Because of this, we can't (or +-- don't really want to) detect/disable ACPI on !i386 reliably. Just set it +-- enabled if we detect it and leave well enough alone if we don't. +if (core.getACPIPresent(false)) then + core.setACPI(true); +end return core; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r329613 - stable/11/sys/geom/mirror
Author: markj Date: Tue Feb 20 00:34:42 2018 New Revision: 329613 URL: https://svnweb.freebsd.org/changeset/base/329613 Log: MFC r328938: Simplify synchronization read error handling. Modified: stable/11/sys/geom/mirror/g_mirror.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/geom/mirror/g_mirror.c == --- stable/11/sys/geom/mirror/g_mirror.cTue Feb 20 00:06:07 2018 (r329612) +++ stable/11/sys/geom/mirror/g_mirror.cTue Feb 20 00:34:42 2018 (r329613) @@ -1334,9 +1334,7 @@ g_mirror_sync_request(struct g_mirror_softc *sc, struc */ switch (bp->bio_cmd) { case BIO_READ: { - struct g_mirror_disk *d; struct g_consumer *cp; - int readable; KFAIL_POINT_ERROR(DEBUG_FP, g_mirror_sync_request_read, bp->bio_error); @@ -1347,31 +1345,17 @@ g_mirror_sync_request(struct g_mirror_softc *sc, struc bp->bio_error); /* -* If there's at least one other disk from which we can -* read the block, retry the request. -*/ - readable = 0; - LIST_FOREACH(d, >sc_disks, d_next) - if (d->d_state == G_MIRROR_DISK_STATE_ACTIVE && - !(d->d_flags & G_MIRROR_DISK_FLAG_BROKEN)) - readable++; - - /* * The read error will trigger a syncid bump, so there's * no need to do that here. * -* If we can retry the read from another disk, do so. -* Otherwise, all we can do is kick out the new disk. +* The read error handling for regular requests will +* retry the read from all active mirrors before passing +* the error back up, so there's no need to retry here. */ - if (readable == 0) { - g_mirror_sync_request_free(disk, bp); - g_mirror_event_send(disk, - G_MIRROR_DISK_STATE_DISCONNECTED, - G_MIRROR_EVENT_DONTWAIT); - } else { - g_mirror_sync_reinit(disk, bp, bp->bio_offset); - goto retry_read; - } + g_mirror_sync_request_free(disk, bp); + g_mirror_event_send(disk, + G_MIRROR_DISK_STATE_DISCONNECTED, + G_MIRROR_EVENT_DONTWAIT); return; } G_MIRROR_LOGREQ(3, bp, @@ -1427,7 +1411,6 @@ g_mirror_sync_request(struct g_mirror_softc *sc, struc g_mirror_sync_reinit(disk, bp, sync->ds_offset); sync->ds_offset += bp->bio_length; -retry_read: G_MIRROR_LOGREQ(3, bp, "Sending synchronization request."); sync->ds_consumer->index++; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r329612 - in head/sys: kern sys
Author: jeff Date: Tue Feb 20 00:06:07 2018 New Revision: 329612 URL: https://svnweb.freebsd.org/changeset/base/329612 Log: Further parallelize the buffer cache. Provide multiple clean queues partitioned into 'domains'. Each domain manages its own bufspace and has its own bufspace daemon. Each domain has a set of subqueues indexed by the current cpuid to reduce lock contention on the cleanq. Refine the sleep/wakeup around the bufspace daemon to use atomics as much as possible. Add a B_REUSE flag that is used to requeue bufs during the scan to approximate LRU rather than locking the queue on every use of a frequently accessed buf. Implement bufspace_reserve with only atomic_fetchadd to avoid loop restarts. Reviewed by: markj Tested by:pho Sponsored by: Netflix, Dell/EMC Isilon Differential Revision:https://reviews.freebsd.org/D14274 Modified: head/sys/kern/vfs_bio.c head/sys/kern/vfs_subr.c head/sys/sys/buf.h head/sys/sys/bufobj.h Modified: head/sys/kern/vfs_bio.c == --- head/sys/kern/vfs_bio.c Mon Feb 19 22:56:04 2018(r329611) +++ head/sys/kern/vfs_bio.c Tue Feb 20 00:06:07 2018(r329612) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -105,7 +106,6 @@ caddr_t unmapped_buf; /* Used below and for softdep flushing threads in ufs/ffs/ffs_softdep.c */ struct proc *bufdaemonproc; -struct proc *bufspacedaemonproc; static int inmem(struct vnode *vp, daddr_t blkno); static void vm_hold_free_pages(struct buf *bp, int newbsize); @@ -124,11 +124,8 @@ static int vfs_bio_clcheck(struct vnode *vp, int size, static void breada(struct vnode *, daddr_t *, int *, int, struct ucred *, int, void (*)(struct buf *)); static int buf_flush(struct vnode *vp, int); -static int buf_recycle(bool); -static int buf_scan(bool); static int flushbufqueues(struct vnode *, int, int); static void buf_daemon(void); -static void bremfreel(struct buf *bp); static __inline void bd_wakeup(void); static int sysctl_runningspace(SYSCTL_HANDLER_ARGS); static void bufkva_reclaim(vmem_t *, int); @@ -137,28 +134,17 @@ static int buf_import(void *, void **, int, int, int); static void buf_release(void *, void **, int); static void maxbcachebuf_adjust(void); -#if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \ -defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7) static int sysctl_bufspace(SYSCTL_HANDLER_ARGS); -#endif - int vmiodirenable = TRUE; SYSCTL_INT(_vfs, OID_AUTO, vmiodirenable, CTLFLAG_RW, , 0, "Use the VM system for directory writes"); long runningbufspace; SYSCTL_LONG(_vfs, OID_AUTO, runningbufspace, CTLFLAG_RD, , 0, "Amount of presently outstanding async buffer io"); -static long bufspace; -#if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \ -defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7) SYSCTL_PROC(_vfs, OID_AUTO, bufspace, CTLTYPE_LONG|CTLFLAG_MPSAFE|CTLFLAG_RD, -, 0, sysctl_bufspace, "L", "Virtual memory used for buffers"); -#else -SYSCTL_LONG(_vfs, OID_AUTO, bufspace, CTLFLAG_RD, , 0, -"Physical memory used for buffers"); -#endif -static long bufkvaspace; -SYSCTL_LONG(_vfs, OID_AUTO, bufkvaspace, CTLFLAG_RD, , 0, +NULL, 0, sysctl_bufspace, "L", "Physical memory used for buffers"); +static counter_u64_t bufkvaspace; +SYSCTL_COUNTER_U64(_vfs, OID_AUTO, bufkvaspace, CTLFLAG_RD, , "Kernel virtual memory used for buffers"); static long maxbufspace; SYSCTL_LONG(_vfs, OID_AUTO, maxbufspace, CTLFLAG_RW, , 0, @@ -178,11 +164,11 @@ SYSCTL_LONG(_vfs, OID_AUTO, hibufspace, CTLFLAG_RW, long bufspacethresh; SYSCTL_LONG(_vfs, OID_AUTO, bufspacethresh, CTLFLAG_RW, , 0, "Bufspace consumed before waking the daemon to free some"); -static int buffreekvacnt; -SYSCTL_INT(_vfs, OID_AUTO, buffreekvacnt, CTLFLAG_RW, , 0, +static counter_u64_t buffreekvacnt; +SYSCTL_COUNTER_U64(_vfs, OID_AUTO, buffreekvacnt, CTLFLAG_RW, , "Number of times we have freed the KVA space from some buffer"); -static int bufdefragcnt; -SYSCTL_INT(_vfs, OID_AUTO, bufdefragcnt, CTLFLAG_RW, , 0, +static counter_u64_t bufdefragcnt; +SYSCTL_COUNTER_U64(_vfs, OID_AUTO, bufdefragcnt, CTLFLAG_RW, , "Number of times we have had to repeat buffer allocation to defragment"); static long lorunningspace; SYSCTL_PROC(_vfs, OID_AUTO, lorunningspace, CTLTYPE_LONG | CTLFLAG_MPSAFE | @@ -225,24 +211,26 @@ SYSCTL_INT(_vfs, OID_AUTO, lofreebuffers, CTLFLAG_RW, static int hifreebuffers; SYSCTL_INT(_vfs, OID_AUTO, hifreebuffers, CTLFLAG_RW, , 0, "Threshold for clean buffer recycling"); -static int getnewbufcalls; -SYSCTL_INT(_vfs, OID_AUTO, getnewbufcalls, CTLFLAG_RW, , 0, - "Number of calls to getnewbuf"); -static int getnewbufrestarts; -SYSCTL_INT(_vfs, OID_AUTO, getnewbufrestarts, CTLFLAG_RW, , 0, +static counter_u64_t getnewbufcalls;
Re: svn commit: r329609 - head/stand/lua
Ian Lepore wrote: > On Mon, 2018-02-19 at 22:29 +, Kyle Evans wrote: > > > > +???-- Swap the first two menu entries > > +???menu_entries[1], menu_entries[2] = menu_entries[2], > > +?? menu_entries[1]; > > ? > > IMO, this is the sort of unreadable insanity that comes from having > inflexible rules about line-wrapping which trump readability. ?The > original code could be easily understood. ?The suggested replacement,? > > menu_entries[1], menu_entries[2] = > ? ? menu_entries[2], menu_entries[1] > > Was also pretty readable, although not as much as it would be if it > were all on one line. ?But splitting the line at the whitespace nearest > to 80 columns just creates an unreadable mess for the insignificant > virtue of following some arbitrary rule. ?(Which is why I very often > ignore that rule and split lines at the point < 80 which makes the most > sense for understanding the code, even if that means splitting at > column 30.) +1 Other possibilities are: - moving code to a helper function often removes extra indentation - shorter identifiers (e.g. as a side effect of moving code to a helper function) local function swap_1_2(t) t[1], t[2] = t[2], t[1] end swap_1_2(menu_entries) or local function swap(t, i, j) t[i], t[j] = t[j], t[i] end swap(menu_entries, 1, 2) -- Alex ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r329610 - head/share/man/man9
On Mon, 2018-02-19 at 22:54 +, Kyle Evans wrote: > Author: kevans > Date: Mon Feb 19 22:54:10 2018 > New Revision: 329610 > URL: https://svnweb.freebsd.org/changeset/base/329610 > > Log: > Â style.lua(9): Note that wrapping at 80-columns is not rigid > > > [...] > +Do note that it is ok to wrap much earlier than 80 columns if readability > would > +otherwise suffer. > Cool. Now if we could just get the same change to style(9) for C... :) -- Ian ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r329611 - head/stand/lua
Author: kevans Date: Mon Feb 19 22:56:04 2018 New Revision: 329611 URL: https://svnweb.freebsd.org/changeset/base/329611 Log: stand/lua: Wrap tuple assignment earlier for readability Modified: head/stand/lua/menu.lua Modified: head/stand/lua/menu.lua == --- head/stand/lua/menu.lua Mon Feb 19 22:54:10 2018(r329610) +++ head/stand/lua/menu.lua Mon Feb 19 22:56:04 2018(r329611) @@ -146,8 +146,8 @@ menu.welcome = { menu_entries = core.shallowCopyTable(menu_entries); -- Swap the first two menu entries - menu_entries[1], menu_entries[2] = menu_entries[2], - menu_entries[1]; + menu_entries[1], menu_entries[2] = + menu_entries[2], menu_entries[1]; -- Then set their names to their alternate names menu_entries[1].name, menu_entries[2].name = ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r329610 - head/share/man/man9
Author: kevans Date: Mon Feb 19 22:54:10 2018 New Revision: 329610 URL: https://svnweb.freebsd.org/changeset/base/329610 Log: style.lua(9): Note that wrapping at 80-columns is not rigid Modified: head/share/man/man9/style.lua.9 Modified: head/share/man/man9/style.lua.9 == --- head/share/man/man9/style.lua.9 Mon Feb 19 22:29:16 2018 (r329609) +++ head/share/man/man9/style.lua.9 Mon Feb 19 22:54:10 2018 (r329610) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 18, 2018 +.Dd February 19, 2018 .Dt STYLE.LUA 9 .Os .Sh NAME @@ -66,6 +66,8 @@ is generally avoided. .Pp Indentation and wrapping should match the guidelines provided by .Xr style 9 . +Do note that it is ok to wrap much earlier than 80 columns if readability would +otherwise suffer. .Pp Statements should be terminated with a semicolon. .Ic end ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r329609 - head/stand/lua
On Mon, Feb 19, 2018 at 4:37 PM, Ian Leporewrote: > On Mon, 2018-02-19 at 22:29 +, Kyle Evans wrote: >> >> + -- Swap the first two menu entries >> + menu_entries[1], menu_entries[2] = menu_entries[2], >> + menu_entries[1]; >> > > IMO, this is the sort of unreadable insanity that comes from having > inflexible rules about line-wrapping which trump readability. The > original code could be easily understood. The suggested replacement, > > menu_entries[1], menu_entries[2] = > menu_entries[2], menu_entries[1] > > Was also pretty readable, although not as much as it would be if it > were all on one line. But splitting the line at the whitespace nearest > to 80 columns just creates an unreadable mess for the insignificant > virtue of following some arbitrary rule. (Which is why I very often > ignore that rule and split lines at the point < 80 which makes the most > sense for understanding the code, even if that means splitting at > column 30.) > Right, perhaps we should clarify this while the opportunity is ripe for style.lua(9) into something more like "80 columns are preferred, wrapping may occur much earlier than 80 columns." I blindly followed it here because we hadn't discussed any exception to it previously, but I think we're more likely in Lua to run into scenarios where the current guideline just isn't appropriate. ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r329609 - head/stand/lua
On Mon, 2018-02-19 at 22:29 +, Kyle Evans wrote: > > +   -- Swap the first two menu entries > +   menu_entries[1], menu_entries[2] = menu_entries[2], > +  menu_entries[1]; >  IMO, this is the sort of unreadable insanity that comes from having inflexible rules about line-wrapping which trump readability.  The original code could be easily understood.  The suggested replacement, menu_entries[1], menu_entries[2] =   menu_entries[2], menu_entries[1] Was also pretty readable, although not as much as it would be if it were all on one line.  But splitting the line at the whitespace nearest to 80 columns just creates an unreadable mess for the insignificant virtue of following some arbitrary rule.  (Which is why I very often ignore that rule and split lines at the point < 80 which makes the most sense for understanding the code, even if that means splitting at column 30.) -- Ian ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r329609 - head/stand/lua
Author: kevans Date: Mon Feb 19 22:29:16 2018 New Revision: 329609 URL: https://svnweb.freebsd.org/changeset/base/329609 Log: stand/lua: Cache swapped menu, and don't create locals for swapping Building the swapped welcome menu (first two items swapped) is kind of a sluggish, because it requires a full (recrusive) shallow copy of the welcome menu. Cache the result of that and re-use it later, instead of building it everytime. While here, don't create temporary locals just for swapping. The following is just as good: x, y = y, x; Reported by: Alexander Nasonov(swapping) Modified: head/stand/lua/menu.lua Modified: head/stand/lua/menu.lua == --- head/stand/lua/menu.lua Mon Feb 19 22:22:35 2018(r329608) +++ head/stand/lua/menu.lua Mon Feb 19 22:29:16 2018(r329609) @@ -138,17 +138,22 @@ menu.welcome = { local menu_entries = menu.welcome.all_entries; -- Swap the first two menu items on single user boot if (core.isSingleUserBoot()) then + -- We'll cache the swapped menu, for performance + if (menu.welcome.swapped_menu ~= nil) then + return menu.welcome.swapped_menu; + end -- Shallow copy the table menu_entries = core.shallowCopyTable(menu_entries); - local multiuser = menu_entries[1]; - local singleuser = menu_entries[2]; + -- Swap the first two menu entries + menu_entries[1], menu_entries[2] = menu_entries[2], + menu_entries[1]; - multiuser.name = multiuser.alternate_name; - singleuser.name = singleuser.alternate_name; - - menu_entries[2] = multiuser; - menu_entries[1] = singleuser; + -- Then set their names to their alternate names + menu_entries[1].name, menu_entries[2].name = + menu_entries[1].alternate_name, + menu_entries[2].alternate_name; + menu.welcome.swapped_menu = menu_entries; end return menu_entries; end, ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r329587 - head/stand/lua
On Mon, Feb 19, 2018 at 4:00 PM, Alexander Nasonovwrote: > Kyle Evans wrote: >> + -- Swap the first two menu items on single user boot >> + if (core.isSingleUserBoot()) then >> + local multiuser = menu_entries[1]; >> + local singleuser = menu_entries[2]; >> + >> + menu_entries[2] = multiuser; >> + menu_entries[1] = singleuser; >> + end > > -- Swap the first two menu items on single user boot > if core.isSingleUserBoot() then > menu_entries[1], menu_entries[2] = > menu_entries[2], menu_entries[1] > end > Noted. I ended up expanding this section a little bit later (see: r329593) and I'm not sure how I feel about the look of this one: -- Shallow copy the table menu_entries = core.shallowCopyTable(menu_entries); menu_entries[1], menu_entries[2] = menu_entries[2], menu_entries[1]; menu_entries[1].name, menu_entries[2].name = menu_entries[1].alternate_name, menu_entries[2].alternate_name; I'll need to sit on that one for a little bit. =) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r329606 - in head/usr.bin/tail: . tests
Author: asomers Date: Mon Feb 19 22:09:49 2018 New Revision: 329606 URL: https://svnweb.freebsd.org/changeset/base/329606 Log: tail: fix "tail -r" for piped input that begins with '\n' A subtle logic bug, probably introduced in r311895, caused tail to print the first two lines of piped input in forward order, if the very first character was a newline. PR: 222671 Reported by: Jim Long, pproca...@gmail.com MFC after:3 weeks Sponsored by: Spectra Logic Corp Modified: head/usr.bin/tail/reverse.c head/usr.bin/tail/tests/tail_test.sh Modified: head/usr.bin/tail/reverse.c == --- head/usr.bin/tail/reverse.c Mon Feb 19 22:00:02 2018(r329605) +++ head/usr.bin/tail/reverse.c Mon Feb 19 22:09:49 2018(r329606) @@ -257,10 +257,13 @@ r_buf(FILE *fp, const char *fn) if ((*p == '\n') || start) { struct bfelem *tr; - if (start && llen) + if (llen && start && *p != '\n') WR(p, llen + 1); - else if (llen) + else if (llen) { WR(p + 1, llen); + if (start && *p == '\n') + WR(p, 1); + } tr = TAILQ_NEXT(tl, entries); llen = 0; if (tr != NULL) { Modified: head/usr.bin/tail/tests/tail_test.sh == --- head/usr.bin/tail/tests/tail_test.shMon Feb 19 22:00:02 2018 (r329605) +++ head/usr.bin/tail/tests/tail_test.shMon Feb 19 22:09:49 2018 (r329606) @@ -83,6 +83,27 @@ HERE atf_check cmp expectfile outpipe } +# Regression test for PR 222671 +# https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=222671 +atf_test_case pipe_leading_newline_r +pipe_leading_newline_r_head() +{ + atf_set "descr" "Reverse a pipe whose first character is a newline" +} +pipe_leading_newline_r_body() +{ + cat > expectfile << HERE +3 +2 +1 + +HERE + printf '\n1\n2\n3\n' | tail -r > outfile + printf '\n1\n2\n3\n' | tail -r > outpipe + atf_check cmp expectfile outfile + atf_check cmp expectfile outpipe +} + atf_test_case file_rc28 file_rc28_head() { @@ -105,6 +126,28 @@ HERE atf_check cmp expectfile outpipe } +atf_test_case file_rc28 +file_rc28_head() +{ + atf_set "descr" "Reverse a file and display the last 28 characters" +} +file_rc28_body() +{ + cat > infile < expectfile << HERE +This is the third line +line +HERE + tail -rc28 infile > outfile + tail -rc28 < infile > outpipe + atf_check cmp expectfile outfile + atf_check cmp expectfile outpipe +} + atf_test_case longfile_r longfile_r_head() { @@ -235,6 +278,7 @@ atf_init_test_cases() atf_add_test_case file_r atf_add_test_case file_rc28 atf_add_test_case file_rn2 + atf_add_test_case pipe_leading_newline_r # The longfile tests are designed to exercise behavior in r_buf(), # which operates on 128KB blocks atf_add_test_case longfile_r ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r329585 - head/stand/lua
On Mon, Feb 19, 2018 at 3:54 PM, Alexander Nasonovwrote: > Kyle Evans wrote: >> +function core.isSingleUserBoot() >> + local single_user = loader.getenv("boot_single"); >> + return single_user ~= nil and single_user:lower() == "yes"; >> +end > > Just curious, why do you end all lines with semi-colons? It's not very > common in Lua code. > These scripts had a mixture of both styles when I started working on this, and I wanted to make it consistent. I was naturally adding semicolons to most statements as a habit from all of the other C we use, so it was the most natural style for the transition; especially given that it causes no harm. We can always change it later, but it has been kind of a useful style rule in some of the grepping I've done to figure out how we use things. It's an easy way to separate things out, since our general rule disallows semicolons after "end" and we of course don't use it for 'if' statements and some other odds and ends. ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r329587 - head/stand/lua
Kyle Evans wrote: > + -- Swap the first two menu items on single user boot > + if (core.isSingleUserBoot()) then > + local multiuser = menu_entries[1]; > + local singleuser = menu_entries[2]; > + > + menu_entries[2] = multiuser; > + menu_entries[1] = singleuser; > + end -- Swap the first two menu items on single user boot if core.isSingleUserBoot() then menu_entries[1], menu_entries[2] = menu_entries[2], menu_entries[1] end -- Alex ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r329585 - head/stand/lua
Kyle Evans wrote: > +function core.isSingleUserBoot() > + local single_user = loader.getenv("boot_single"); > + return single_user ~= nil and single_user:lower() == "yes"; > +end Just curious, why do you end all lines with semi-colons? It's not very common in Lua code. This version looks more idiomatic: function core.isSingleUserBoot() local single_user = loader.getenv("boot_single") return single_user and single_user:lower() == "yes" end -- Alex ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r329603 - stable/11/sys/dev/nctgpio
Author: gonzo Date: Mon Feb 19 19:55:29 2018 New Revision: 329603 URL: https://svnweb.freebsd.org/changeset/base/329603 Log: MFC r327502: nctgpio: add new device id for the GPIO chip in PCEngines APU3 PR: 224512 Submitted by: m...@sentex.net Modified: stable/11/sys/dev/nctgpio/nctgpio.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/nctgpio/nctgpio.c == --- stable/11/sys/dev/nctgpio/nctgpio.c Mon Feb 19 19:31:18 2018 (r329602) +++ stable/11/sys/dev/nctgpio/nctgpio.c Mon Feb 19 19:55:29 2018 (r329603) @@ -140,6 +140,10 @@ struct nuvoton_vendor_device_id { .chip_id= 0xc452, .descr = "Nuvoton NCT5104D (PC-Engines APU)", }, + { + .chip_id= 0xc453, + .descr = "Nuvoton NCT5104D (PC-Engines APU3)", + }, }; static void ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r329602 - head/sys/dev/virtio
Author: bryanv Date: Mon Feb 19 19:31:18 2018 New Revision: 329602 URL: https://svnweb.freebsd.org/changeset/base/329602 Log: Add more virtqueue getter methods MFC after:2 weeks Modified: head/sys/dev/virtio/virtqueue.c head/sys/dev/virtio/virtqueue.h Modified: head/sys/dev/virtio/virtqueue.c == --- head/sys/dev/virtio/virtqueue.c Mon Feb 19 19:28:24 2018 (r329601) +++ head/sys/dev/virtio/virtqueue.c Mon Feb 19 19:31:18 2018 (r329602) @@ -369,6 +369,33 @@ virtqueue_paddr(struct virtqueue *vq) return (vtophys(vq->vq_ring_mem)); } +vm_paddr_t +virtqueue_desc_paddr(struct virtqueue *vq) +{ + + return (vtophys(vq->vq_ring.desc)); +} + +vm_paddr_t +virtqueue_avail_paddr(struct virtqueue *vq) +{ + + return (vtophys(vq->vq_ring.avail)); +} + +vm_paddr_t +virtqueue_used_paddr(struct virtqueue *vq) +{ + + return (vtophys(vq->vq_ring.used)); +} + +uint16_t +virtqueue_index(struct virtqueue *vq) +{ + return (vq->vq_queue_index); +} + int virtqueue_size(struct virtqueue *vq) { Modified: head/sys/dev/virtio/virtqueue.h == --- head/sys/dev/virtio/virtqueue.h Mon Feb 19 19:28:24 2018 (r329601) +++ head/sys/dev/virtio/virtqueue.h Mon Feb 19 19:31:18 2018 (r329602) @@ -84,7 +84,11 @@ void virtqueue_disable_intr(struct virtqueue *vq); /* Get physical address of the virtqueue ring. */ vm_paddr_t virtqueue_paddr(struct virtqueue *vq); +vm_paddr_t virtqueue_desc_paddr(struct virtqueue *vq); +vm_paddr_t virtqueue_avail_paddr(struct virtqueue *vq); +vm_paddr_t virtqueue_used_paddr(struct virtqueue *vq); +uint16_t virtqueue_index(struct virtqueue *vq); int virtqueue_full(struct virtqueue *vq); int virtqueue_empty(struct virtqueue *vq); int virtqueue_size(struct virtqueue *vq); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r329601 - head/sys/dev/virtio
Author: bryanv Date: Mon Feb 19 19:28:24 2018 New Revision: 329601 URL: https://svnweb.freebsd.org/changeset/base/329601 Log: Add VirtIO bus config_generation method VirtIO buses (PCI, MMIO) can provide a generation field so a driver can ensure either a 64-bit or array read was stable. MFC after:2 weeks Modified: head/sys/dev/virtio/virtio.c head/sys/dev/virtio/virtio.h head/sys/dev/virtio/virtio_bus_if.m Modified: head/sys/dev/virtio/virtio.c == --- head/sys/dev/virtio/virtio.cMon Feb 19 19:08:25 2018 (r329600) +++ head/sys/dev/virtio/virtio.cMon Feb 19 19:28:24 2018 (r329601) @@ -240,6 +240,13 @@ virtio_reinit_complete(device_t dev) VIRTIO_BUS_REINIT_COMPLETE(device_get_parent(dev)); } +int +virtio_config_generation(device_t dev) +{ + + return (VIRTIO_BUS_CONFIG_GENERATION(device_get_parent(dev))); +} + void virtio_read_device_config(device_t dev, bus_size_t offset, void *dst, int len) { Modified: head/sys/dev/virtio/virtio.h == --- head/sys/dev/virtio/virtio.hMon Feb 19 19:08:25 2018 (r329600) +++ head/sys/dev/virtio/virtio.hMon Feb 19 19:28:24 2018 (r329601) @@ -78,6 +78,7 @@ intvirtio_alloc_virtqueues(device_t dev, int flags, int virtio_setup_intr(device_t dev, enum intr_type type); int virtio_with_feature(device_t dev, uint64_t feature); voidvirtio_stop(device_t dev); +int virtio_config_generation(device_t dev); int virtio_reinit(device_t dev, uint64_t features); voidvirtio_reinit_complete(device_t dev); Modified: head/sys/dev/virtio/virtio_bus_if.m == --- head/sys/dev/virtio/virtio_bus_if.m Mon Feb 19 19:08:25 2018 (r329600) +++ head/sys/dev/virtio/virtio_bus_if.m Mon Feb 19 19:28:24 2018 (r329601) @@ -34,6 +34,14 @@ HEADER { struct vq_alloc_info; }; +CODE { + static int + virtio_bus_default_config_generation(device_t dev) + { + return (0); + } +}; + METHOD uint64_t negotiate_features { device_tdev; uint64_tchild_features; @@ -73,6 +81,10 @@ METHOD void notify_vq { device_tdev; uint16_tqueue; }; + +METHOD int config_generation { + device_tdev; +} DEFAULT virtio_bus_default_config_generation; METHOD void read_device_config { device_tdev; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r329600 - head/sys/ufs/ffs
Author: kib Date: Mon Feb 19 19:08:25 2018 New Revision: 329600 URL: https://svnweb.freebsd.org/changeset/base/329600 Log: Do not free(9) uninitialized pointer. Reported and tested by: allanjude Reviewed by: markj Sponsored by: The FreeBSD Foundation Modified: head/sys/ufs/ffs/ffs_subr.c Modified: head/sys/ufs/ffs/ffs_subr.c == --- head/sys/ufs/ffs/ffs_subr.c Mon Feb 19 19:01:46 2018(r329599) +++ head/sys/ufs/ffs/ffs_subr.c Mon Feb 19 19:08:25 2018(r329600) @@ -174,12 +174,17 @@ ffs_sbget(void *devfd, struct fs **fsp, off_t altsuper *fsp = NULL; if (altsuperblock != -1) { - if ((ret = readsuper(devfd, fsp, altsuperblock, readfunc)) != 0) + ret = readsuper(devfd, fsp, altsuperblock, readfunc); + if (*fsp != NULL) + (*fsp)->fs_csp = NULL; + if (ret != 0) return (ret); } else { for (i = 0; sblock_try[i] != -1; i++) { - if ((ret = readsuper(devfd, fsp, sblock_try[i], -readfunc)) == 0) + ret = readsuper(devfd, fsp, sblock_try[i], readfunc); + if (*fsp != NULL) + (*fsp)->fs_csp = NULL; + if (ret == 0) break; if (ret == ENOENT) continue; @@ -188,17 +193,17 @@ ffs_sbget(void *devfd, struct fs **fsp, off_t altsuper if (sblock_try[i] == -1) return (ENOENT); } + /* -* If not filling in summary information, NULL out fs_csp and return. +* Not filling in summary information, return. */ - fs = *fsp; - if (filltype == NULL) { - fs->fs_csp = NULL; + if (filltype == NULL) return (0); - } + /* * Read in the superblock summary information. */ + fs = *fsp; size = fs->fs_cssize; blks = howmany(size, fs->fs_fsize); if (fs->fs_contigsumsize > 0) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r329599 - head/tools/tools/net80211/w00t/ap
Author: eadler Date: Mon Feb 19 19:01:46 2018 New Revision: 329599 URL: https://svnweb.freebsd.org/changeset/base/329599 Log: tools/80211: correct array index wh->i_dur is a two byte value; not a single byte set twice Reported by: swild...@dragonflybsd.org Modified: head/tools/tools/net80211/w00t/ap/ap.c Modified: head/tools/tools/net80211/w00t/ap/ap.c == --- head/tools/tools/net80211/w00t/ap/ap.c Mon Feb 19 18:41:56 2018 (r329598) +++ head/tools/tools/net80211/w00t/ap/ap.c Mon Feb 19 19:01:46 2018 (r329599) @@ -389,7 +389,7 @@ void send_cts(struct params *p, char *mac) wh->i_fc[0] |= IEEE80211_FC0_TYPE_CTL; wh->i_fc[0] |= IEEE80211_FC0_SUBTYPE_CTS; wh->i_dur[0] = 0x69; - wh->i_dur[0] = 0x00; + wh->i_dur[1] = 0x00; memcpy(wh->i_addr1, mac, 6); send_frame(p, wh, 10); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r329598 - in head: share/man/man9 sys/dev/pci
Author: bryanv Date: Mon Feb 19 18:41:56 2018 New Revision: 329598 URL: https://svnweb.freebsd.org/changeset/base/329598 Log: Add PCI methods to iterate over the PCI capabilities VirtIO V1 provides configuration in multiple VENDOR capabilities so this allows all of the configuration to be discovered. Reviewed by: jhb MFC after:2 weeks Differential Revision:https://reviews.freebsd.org/D14325 Modified: head/share/man/man9/pci.9 head/sys/dev/pci/hostb_pci.c head/sys/dev/pci/pci.c head/sys/dev/pci/pci_if.m head/sys/dev/pci/pci_private.h head/sys/dev/pci/pcivar.h head/sys/dev/pci/vga_pci.c Modified: head/share/man/man9/pci.9 == --- head/share/man/man9/pci.9 Mon Feb 19 18:14:12 2018(r329597) +++ head/share/man/man9/pci.9 Mon Feb 19 18:41:56 2018(r329598) @@ -42,6 +42,9 @@ .Nm pci_find_device , .Nm pci_find_extcap , .Nm pci_find_htcap , +.Nm pci_find_next_cap , +.Nm pci_find_next_extcap , +.Nm pci_find_next_htcap , .Nm pci_find_pcie_root_port , .Nm pci_get_id , .Nm pci_get_max_payload , @@ -100,6 +103,12 @@ .Fn pci_find_extcap "device_t dev" "int capability" "int *capreg" .Ft int .Fn pci_find_htcap "device_t dev" "int capability" "int *capreg" +.Ft int +.Fn pci_find_next_cap "device_t dev" "int capability" "int start" "int *capreg" +.Ft int +.Fn pci_find_next_extcap "device_t dev" "int capability" "int start" "int *capreg" +.Ft int +.Fn pci_find_next_htcap "device_t dev" "int capability" "int start" "int *capreg" .Ft device_t .Fn pci_find_pcie_root_port "device_t dev" .Ft int @@ -330,6 +339,22 @@ returns zero. If the capability is not found or the device does not support capabilities, .Fn pci_find_cap returns an error. +The +.Fn pci_find_next_cap +function is used to locate the next instance of a PCI capability +register set for the device +.Fa dev . +The +.Fa start +should be the +.Fa *capreg +returned by a prior +.Fn pci_find_cap +or +.Fn pci_find_next_cap . +When no more instances are located +.Fn pci_find_next_cap +returns an error. .Pp The .Fn pci_find_extcap @@ -352,6 +377,22 @@ If the extended capability is not found or the device PCI-express device, .Fn pci_find_extcap returns an error. +The +.Fn pci_find_next_extcap +function is used to locate the next instance of a PCI-express +extended capability register set for the device +.Fa dev . +The +.Fa start +should be the +.Fa *capreg +returned by a prior +.Fn pci_find_extcap +or +.Fn pci_find_next_extcap . +When no more instances are located +.Fn pci_find_next_extcap +returns an error. .Pp The .Fn pci_find_htcap @@ -372,6 +413,22 @@ and returns zero. If the capability is not found or the device is not a HyperTransport device, .Fn pci_find_htcap +returns an error. +The +.Fn pci_find_next_htcap +function is used to locate the next instance of a HyperTransport capability +register set for the device +.Fa dev . +The +.Fa start +should be the +.Fa *capreg +returned by a prior +.Fn pci_find_htcap +or +.Fn pci_find_next_htcap . +When no more instances are located +.Fn pci_find_next_htcap returns an error. .Pp The Modified: head/sys/dev/pci/hostb_pci.c == --- head/sys/dev/pci/hostb_pci.cMon Feb 19 18:14:12 2018 (r329597) +++ head/sys/dev/pci/hostb_pci.cMon Feb 19 18:41:56 2018 (r329598) @@ -207,6 +207,14 @@ pci_hostb_find_cap(device_t dev, device_t child, int c } static int +pci_hostb_find_next_cap(device_t dev, device_t child, int capability, +int start, int *capreg) +{ + + return (pci_find_next_cap(dev, capability, start, capreg)); +} + +static int pci_hostb_find_extcap(device_t dev, device_t child, int capability, int *capreg) { @@ -215,6 +223,14 @@ pci_hostb_find_extcap(device_t dev, device_t child, in } static int +pci_hostb_find_next_extcap(device_t dev, device_t child, int capability, +int start, int *capreg) +{ + + return (pci_find_next_extcap(dev, capability, start, capreg)); +} + +static int pci_hostb_find_htcap(device_t dev, device_t child, int capability, int *capreg) { @@ -222,6 +238,14 @@ pci_hostb_find_htcap(device_t dev, device_t child, int return (pci_find_htcap(dev, capability, capreg)); } +static int +pci_hostb_find_next_htcap(device_t dev, device_t child, int capability, +int start, int *capreg) +{ + + return (pci_find_next_htcap(dev, capability, start, capreg)); +} + static device_method_t pci_hostb_methods[] = { /* Device interface */ DEVMETHOD(device_probe, pci_hostb_probe), @@ -252,8 +276,11 @@ static device_method_t pci_hostb_methods[] = { DEVMETHOD(pci_set_powerstate, pci_hostb_set_powerstate), DEVMETHOD(pci_assign_interrupt, pci_hostb_assign_interrupt), DEVMETHOD(pci_find_cap, pci_hostb_find_cap), + DEVMETHOD(pci_find_next_cap,
svn commit: r329596 - head/stand/lua
Author: kevans Date: Mon Feb 19 18:11:35 2018 New Revision: 329596 URL: https://svnweb.freebsd.org/changeset/base/329596 Log: stand/lua: Add copyright notice in places I've made some not-insignificant changes to config, menu, and password bits of our lua scripts. Add a copyright notice to them to reflect. Modified: head/stand/lua/config.lua head/stand/lua/menu.lua head/stand/lua/password.lua Modified: head/stand/lua/config.lua == --- head/stand/lua/config.lua Mon Feb 19 17:54:22 2018(r329595) +++ head/stand/lua/config.lua Mon Feb 19 18:11:35 2018(r329596) @@ -1,5 +1,6 @@ -- -- Copyright (c) 2015 Pedro Souza+-- Copyright (C) 2018 Kyle Evans -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without Modified: head/stand/lua/menu.lua == --- head/stand/lua/menu.lua Mon Feb 19 17:54:22 2018(r329595) +++ head/stand/lua/menu.lua Mon Feb 19 18:11:35 2018(r329596) @@ -1,5 +1,6 @@ -- -- Copyright (c) 2015 Pedro Souza +-- Copyright (C) 2018 Kyle Evans -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without Modified: head/stand/lua/password.lua == --- head/stand/lua/password.lua Mon Feb 19 17:54:22 2018(r329595) +++ head/stand/lua/password.lua Mon Feb 19 18:11:35 2018(r329596) @@ -1,5 +1,6 @@ -- -- Copyright (c) 2015 Pedro Souza +-- Copyright (C) 2018 Kyle Evans -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r329595 - head/stand/lua
Author: kevans Date: Mon Feb 19 17:54:22 2018 New Revision: 329595 URL: https://svnweb.freebsd.org/changeset/base/329595 Log: stand/lua: Re-order locals after copyright notice; require comes first Modified: head/stand/lua/drawer.lua head/stand/lua/menu.lua head/stand/lua/password.lua Modified: head/stand/lua/drawer.lua == --- head/stand/lua/drawer.lua Mon Feb 19 17:51:33 2018(r329594) +++ head/stand/lua/drawer.lua Mon Feb 19 17:54:22 2018(r329595) @@ -26,11 +26,11 @@ -- $FreeBSD$ -- -local drawer = {}; - local color = require("color"); local core = require("core"); local screen = require("screen"); + +local drawer = {}; drawer.brand_position = {x = 2, y = 1}; drawer.fbsd_logo = { Modified: head/stand/lua/menu.lua == --- head/stand/lua/menu.lua Mon Feb 19 17:51:33 2018(r329594) +++ head/stand/lua/menu.lua Mon Feb 19 17:54:22 2018(r329595) @@ -27,13 +27,13 @@ -- -local menu = {}; - local core = require("core"); local color = require("color"); local config = require("config"); local screen = require("screen"); local drawer = require("drawer"); + +local menu = {}; local OnOff; local skip; Modified: head/stand/lua/password.lua == --- head/stand/lua/password.lua Mon Feb 19 17:51:33 2018(r329594) +++ head/stand/lua/password.lua Mon Feb 19 17:54:22 2018(r329595) @@ -26,10 +26,10 @@ -- $FreeBSD$ -- -local password = {}; - local core = require("core"); local screen = require("screen"); + +local password = {}; function password.read() local str = ""; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r329594 - head/stand/lua
Author: kevans Date: Mon Feb 19 17:51:33 2018 New Revision: 329594 URL: https://svnweb.freebsd.org/changeset/base/329594 Log: stand/lua: Round up some more style.lua(9) concerns Modified: head/stand/lua/color.lua head/stand/lua/config.lua head/stand/lua/drawer.lua head/stand/lua/menu.lua head/stand/lua/screen.lua Modified: head/stand/lua/color.lua == --- head/stand/lua/color.luaMon Feb 19 17:40:19 2018(r329593) +++ head/stand/lua/color.luaMon Feb 19 17:51:33 2018(r329594) @@ -26,10 +26,10 @@ -- $FreeBSD$ -- -local color = {}; - local core = require("core"); +local color = {}; + color.BLACK = 0; color.RED = 1; color.GREEN = 2; @@ -59,14 +59,14 @@ function color.escapef(c) if (color.disabled) then return c; end - return "\027[3"..c.."m"; + return "\027[3" .. c .. "m"; end function color.escapeb(c) if (color.disabled) then return c; end - return "\027[4"..c.."m"; + return "\027[4" .. c .. "m"; end function color.escape(fg, bg, att) @@ -76,9 +76,9 @@ function color.escape(fg, bg, att) if (not att) then att = "" else - att = att..";"; + att = att .. ";"; end - return "\027["..att.."3"..fg..";4"..bg.."m"; + return "\027[" .. att .. "3" .. fg .. ";4" .. bg .. "m"; end function color.default() @@ -92,7 +92,7 @@ function color.highlight(str) if (color.disabled) then return str; end - return "\027[1m"..str.."\027[0m"; + return "\027[1m" .. str .. "\027[0m"; end return color; Modified: head/stand/lua/config.lua == --- head/stand/lua/config.lua Mon Feb 19 17:40:19 2018(r329593) +++ head/stand/lua/config.lua Mon Feb 19 17:51:33 2018(r329594) @@ -196,7 +196,7 @@ function config.loadmod(mod, silent) if (not silent) then print("Failed to execute '" .. v.before .. - "' before loading '".. k .. + "' before loading '" .. k .. "'"); end status = false; @@ -227,7 +227,9 @@ function config.loadmod(mod, silent) end else - --if not silent then print("Skiping module '".. k .. "'"); end + -- if not silent then + -- print("Skiping module '". . k .. "'"); + -- end end end @@ -431,4 +433,4 @@ function config.loadelf() end -return config +return config; Modified: head/stand/lua/drawer.lua == --- head/stand/lua/drawer.lua Mon Feb 19 17:40:19 2018(r329593) +++ head/stand/lua/drawer.lua Mon Feb 19 17:51:33 2018(r329594) @@ -193,7 +193,7 @@ function drawer.drawmenu(m) else name = e.name(); end - print(entry_num .. ". "..name); + print(entry_num .. ". " .. name); -- fill the alias table alias_table[tostring(entry_num)] = e; Modified: head/stand/lua/menu.lua == --- head/stand/lua/menu.lua Mon Feb 19 17:40:19 2018(r329593) +++ head/stand/lua/menu.lua Mon Feb 19 17:51:33 2018(r329594) @@ -252,7 +252,7 @@ menu.welcome = { end kernel_name = kernel_name .. name_color .. choice .. color.default(); - return color.highlight("K").."ernel: " .. + return color.highlight("K") .. "ernel: " .. kernel_name .. " (" .. idx .. " of " .. #all_choices .. ")"; end, @@ -315,7 +315,7 @@ function menu.run(m) -- Special key behaviors if ((key == core.KEY_BACKSPACE) or (key == core.KEY_DELETE)) and (m ~= menu.welcome) then - break + break; elseif (key == core.KEY_ENTER) then core.boot(); -- Should not return @@ -431,7 +431,7 @@ function menu.autoboot() end loader.delay(5); -
svn commit: r329593 - head/stand/lua
Author: kevans Date: Mon Feb 19 17:40:19 2018 New Revision: 329593 URL: https://svnweb.freebsd.org/changeset/base/329593 Log: stand/lua: Change boot menu items' names when swapped [Enter] should be moved to the single user menu item when we swap them. Define a non-standard menu entry function "alternate_name" to use for this purpose for ultimate flexibility if we change our minds later. When we're booting single user, make a shallow copy of the menu that we'd normally display and swap the items and their name functions to use alternate_name instead. Toggling single user in the options menu and going back to the main menu will now correctly reflect the current boot setting with the first two menu options and "[Enter]" will always be on the right one. This shallow copy technique has the chance of being quite slow since it's done on every redraw, but in my testing it does not seem to make any obvious difference. shallowCopyTable could likely belong better in a general-purpose utility module, but this (and the key constnats) are the only candidates we have at the moment so we'll drop it into our core stuff for the moment and consider re-organization at a later date. Modified: head/stand/lua/core.lua head/stand/lua/menu.lua Modified: head/stand/lua/core.lua == --- head/stand/lua/core.lua Mon Feb 19 17:09:29 2018(r329592) +++ head/stand/lua/core.lua Mon Feb 19 17:40:19 2018(r329593) @@ -217,5 +217,18 @@ function core.isSerialBoot() return false; end +-- This may be a better candidate for a 'utility' module. +function core.shallowCopyTable(tbl) + local new_tbl = {}; + for k, v in pairs(tbl) do + if (type(v) == "table") then + new_tbl[k] = core.shallowCopyTable(v); + else + new_tbl[k] = v; + end + end + return new_tbl; +end + core.setACPI(core.getACPIPresent(false)); return core; Modified: head/stand/lua/menu.lua == --- head/stand/lua/menu.lua Mon Feb 19 17:09:29 2018(r329592) +++ head/stand/lua/menu.lua Mon Feb 19 17:40:19 2018(r329593) @@ -137,9 +137,15 @@ menu.welcome = { local menu_entries = menu.welcome.all_entries; -- Swap the first two menu items on single user boot if (core.isSingleUserBoot()) then + -- Shallow copy the table + menu_entries = core.shallowCopyTable(menu_entries); + local multiuser = menu_entries[1]; local singleuser = menu_entries[2]; + multiuser.name = multiuser.alternate_name; + singleuser.name = singleuser.alternate_name; + menu_entries[2] = multiuser; menu_entries[1] = singleuser; end @@ -154,6 +160,11 @@ menu.welcome = { "oot Multi user " .. color.highlight("[Enter]"); end, + -- Not a standard menu entry function! + alternate_name = function() + return color.highlight("B") .. + "oot Multi user"; + end, func = function() core.setSingleUser(false); core.boot(); @@ -167,6 +178,11 @@ menu.welcome = { name = function() return "Boot " .. color.highlight("S") .. "ingle user"; + end, + -- Not a standard menu entry function! + alternate_name = function() + return "Boot " .. color.highlight("S") .. + "ingle user " .. color.highlight("[Enter]"); end, func = function() core.setSingleUser(true); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r329538 - head/sbin/devmatch
On Mon, Feb 19, 2018 at 12:20 AM, Hans Petter Selaskywrote: > On 02/19/18 00:16, Warner Losh wrote: > >> + if (bus && strcmp(val1, bus) != 0) { >> + if (verbose_flag) >> + printf("Skipped because table for >> bus %s, looking for %s\n", >> + val1, bus); >> + break; >> + } >> > > There might be some ports kmods which needs recompiling. Try bumping the > __FreeBSD_version ? > > The parent of the topmost USB HUB is: > dev.uhub.0.%parent: usbus0 > > Though no drivers should attach here! Yes. It wasn't the attachment point that was at issue, that never changed, just the usb driver pnp table marking. I think this has been resolved and I had some old modules that prevented things from working. Since there's a work around, I'll keep it in place until the next version bump then GC it. There's other changes needed to this code in the coming weeks, so it won't get forgotten. I've been able to to boot and get everything loaded across a few different test kernels at this point and have plugged in some unusual devices that I have laying around to hopefully ensure nothing gets busted in the future. Warner ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r329592 - head/stand/lua
Author: kevans Date: Mon Feb 19 17:09:29 2018 New Revision: 329592 URL: https://svnweb.freebsd.org/changeset/base/329592 Log: stand/lua: Remove inaccurate comment after r329590 lualoader does a pretty good job of reverting any environment changes now. It will even wipe out boot_verbose if it's set explicitly in loader.conf(5) and overwritten in the boot options menu. Future work will likely change this, as explicit choices made in the menu should probably override the new loader.conf(5). I don't suspect this will cause much grief, though, so it is not a high priority until boot environment support actually lands. Modified: head/stand/lua/config.lua Modified: head/stand/lua/config.lua == --- head/stand/lua/config.lua Mon Feb 19 17:03:50 2018(r329591) +++ head/stand/lua/config.lua Mon Feb 19 17:09:29 2018(r329592) @@ -402,8 +402,6 @@ end -- Reload configuration function config.reload(file) - -- XXX TODO: We should be doing something more here to clear out env - -- changes that rode in with the last configuration load modules = {}; config.restoreEnv(); config.load(file); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r329591 - stable/11/sys/vm
Author: markj Date: Mon Feb 19 17:03:50 2018 New Revision: 329591 URL: https://svnweb.freebsd.org/changeset/base/329591 Log: MFC r329374: Use the conventional name for an array of pages. Modified: stable/11/sys/vm/swap_pager.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/vm/swap_pager.c == --- stable/11/sys/vm/swap_pager.c Mon Feb 19 17:01:21 2018 (r329590) +++ stable/11/sys/vm/swap_pager.c Mon Feb 19 17:03:50 2018 (r329591) @@ -1083,16 +1083,16 @@ swap_pager_unswapped(vm_page_t m) /* * swap_pager_getpages() - bring pages in from swap * - * Attempt to page in the pages in array "m" of length "count". The caller - * may optionally specify that additional pages preceding and succeeding - * the specified range be paged in. The number of such pages is returned - * in the "rbehind" and "rahead" parameters, and they will be in the - * inactive queue upon return. + * Attempt to page in the pages in array "ma" of length "count". The + * caller may optionally specify that additional pages preceding and + * succeeding the specified range be paged in. The number of such pages + * is returned in the "rbehind" and "rahead" parameters, and they will + * be in the inactive queue upon return. * - * The pages in "m" must be busied and will remain busied upon return. + * The pages in "ma" must be busied and will remain busied upon return. */ static int -swap_pager_getpages(vm_object_t object, vm_page_t *m, int count, int *rbehind, +swap_pager_getpages(vm_object_t object, vm_page_t *ma, int count, int *rbehind, int *rahead) { struct buf *bp; @@ -1107,7 +1107,7 @@ swap_pager_getpages(vm_object_t object, vm_page_t *m, bp = getpbuf(_rcount); VM_OBJECT_WLOCK(object); - if (!swap_pager_haspage(object, m[0]->pindex, , )) { + if (!swap_pager_haspage(object, ma[0]->pindex, , )) { relpbuf(bp, _rcount); return (VM_PAGER_FAIL); } @@ -1119,15 +1119,15 @@ swap_pager_getpages(vm_object_t object, vm_page_t *m, KASSERT(reqcount - 1 <= maxahead, ("page count %d extends beyond swap block", reqcount)); *rahead = imin(*rahead, maxahead - (reqcount - 1)); - pindex = m[reqcount - 1]->pindex; - msucc = TAILQ_NEXT(m[reqcount - 1], listq); + pindex = ma[reqcount - 1]->pindex; + msucc = TAILQ_NEXT(ma[reqcount - 1], listq); if (msucc != NULL && msucc->pindex - pindex - 1 < *rahead) *rahead = msucc->pindex - pindex - 1; } if (rbehind != NULL) { *rbehind = imin(*rbehind, maxbehind); - pindex = m[0]->pindex; - mpred = TAILQ_PREV(m[0], pglist, listq); + pindex = ma[0]->pindex; + mpred = TAILQ_PREV(ma[0], pglist, listq); if (mpred != NULL && pindex - mpred->pindex - 1 < *rbehind) *rbehind = pindex - mpred->pindex - 1; } @@ -1138,7 +1138,7 @@ swap_pager_getpages(vm_object_t object, vm_page_t *m, shift = rbehind != NULL ? *rbehind : 0; if (shift != 0) { for (i = 1; i <= shift; i++) { - p = vm_page_alloc(object, m[0]->pindex - i, + p = vm_page_alloc(object, ma[0]->pindex - i, VM_ALLOC_NORMAL); if (p == NULL) { /* Shift allocated pages to the left. */ @@ -1153,11 +1153,11 @@ swap_pager_getpages(vm_object_t object, vm_page_t *m, *rbehind = shift; } for (i = 0; i < reqcount; i++) - bp->b_pages[i + shift] = m[i]; + bp->b_pages[i + shift] = ma[i]; if (rahead != NULL) { for (i = 0; i < *rahead; i++) { p = vm_page_alloc(object, - m[reqcount - 1]->pindex + i + 1, VM_ALLOC_NORMAL); + ma[reqcount - 1]->pindex + i + 1, VM_ALLOC_NORMAL); if (p == NULL) break; bp->b_pages[shift + reqcount + i] = p; @@ -1202,7 +1202,7 @@ swap_pager_getpages(vm_object_t object, vm_page_t *m, * Instead, we look at the one page we are interested in which we * still hold a lock on even through the I/O completion. * -* The other pages in our m[] array are also released on completion, +* The other pages in our ma[] array are also released on completion, * so we cannot assume they are valid anymore either. * * NOTE: b_blkno is destroyed by the call to swapdev_strategy @@ -1216,8 +1216,8 @@ swap_pager_getpages(vm_object_t object, vm_page_t *m, * is set in
svn commit: r329589 - head/stand/lua
Author: kevans Date: Mon Feb 19 16:59:28 2018 New Revision: 329589 URL: https://svnweb.freebsd.org/changeset/base/329589 Log: stand/lua: Track env changes that come in via loader.conf(5) This will be used when boot environment support lands to make a good-faith effort to apply any new loader.conf(5) environment settings atop the default configuration that we started with. Modified: head/stand/lua/config.lua Modified: head/stand/lua/config.lua == --- head/stand/lua/config.lua Mon Feb 19 16:42:06 2018(r329588) +++ head/stand/lua/config.lua Mon Feb 19 16:59:28 2018(r329589) @@ -27,9 +27,23 @@ -- local config = {}; +-- Which variables we changed +config.env_changed = {}; +-- Values to restore env to (nil to unset) +config.env_restore = {}; local modules = {}; +function config.setenv(k, v) + -- Do we need to track this change? + if (config.env_changed[k] == nil) then + config.env_changed[k] = true; + config.env_restore[k] = loader.getenv(k); + end + + return loader.setenv(k, v); +end + function config.setKey(k, n, v) if (modules[k] == nil) then modules[k] = {}; @@ -115,7 +129,7 @@ local pattern_table = { [10] = { str = "^%s*([%w%p]+)%s*=%s*\"([%w%s%p]-)\"%s*(.*)", process = function(k, v) - if (loader.setenv(k, v) ~= 0) then + if (config.setenv(k, v) ~= 0) then print("Failed to set '" .. k .. "' with value: " .. v .. ""); end @@ -125,7 +139,7 @@ local pattern_table = { [11] = { str = "^%s*([%w%p]+)%s*=%s*(%d+)%s*(.*)", process = function(k, v) - if (loader.setenv(k, v) ~= 0) then + if (config.setenv(k, v) ~= 0) then print("Failed to set '" .. k .. "' with value: " .. v .. ""); end ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r329590 - head/stand/lua
Author: kevans Date: Mon Feb 19 17:01:21 2018 New Revision: 329590 URL: https://svnweb.freebsd.org/changeset/base/329590 Log: stand/lua: Restore environment upon config reload This restores environment to whatever defaults we had coming into lualoader. Modified: head/stand/lua/config.lua Modified: head/stand/lua/config.lua == --- head/stand/lua/config.lua Mon Feb 19 16:59:28 2018(r329589) +++ head/stand/lua/config.lua Mon Feb 19 17:01:21 2018(r329590) @@ -34,6 +34,20 @@ config.env_restore = {}; local modules = {}; +function config.restoreEnv() + for k, v in pairs(config.env_changed) do + local restore_value = config.env_restore[k]; + if (restore_value ~= nil) then + loader.setenv(k, restore_value); + else + loader.unsetenv(k); + end + end + + config.env_changed = {}; + config.env_restore = {}; +end + function config.setenv(k, v) -- Do we need to track this change? if (config.env_changed[k] == nil) then @@ -391,6 +405,7 @@ function config.reload(file) -- XXX TODO: We should be doing something more here to clear out env -- changes that rode in with the last configuration load modules = {}; + config.restoreEnv(); config.load(file); end ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r329588 - head/stand/lua
Author: kevans Date: Mon Feb 19 16:42:06 2018 New Revision: 329588 URL: https://svnweb.freebsd.org/changeset/base/329588 Log: stand/lua: Re-wrap menu.lua now that I've added indentation... Modified: head/stand/lua/menu.lua Modified: head/stand/lua/menu.lua == --- head/stand/lua/menu.lua Mon Feb 19 16:36:29 2018(r329587) +++ head/stand/lua/menu.lua Mon Feb 19 16:42:06 2018(r329588) @@ -85,8 +85,8 @@ menu.boot_options = { { entry_type = core.MENU_ENTRY, name = function() - return OnOff(color.highlight("A") .. "CPI :", - core.acpi); + return OnOff(color.highlight("A") .. + "CPI :", core.acpi); end, func = function() core.setACPI(); @@ -109,8 +109,8 @@ menu.boot_options = { { entry_type = core.MENU_ENTRY, name = function() - return OnOff(color.highlight("S") .. "ingle user:", - core.su); + return OnOff(color.highlight("S") .. + "ingle user:", core.su); end, func = function() core.setSingleUser(); @@ -121,8 +121,8 @@ menu.boot_options = { { entry_type = core.MENU_ENTRY, name = function() - return OnOff(color.highlight("V") .. "erbose :", - core.verbose); + return OnOff(color.highlight("V") .. + "erbose:", core.verbose); end, func = function() core.setVerbose(); @@ -150,7 +150,8 @@ menu.welcome = { { entry_type = core.MENU_ENTRY, name = function() - return color.highlight("B") .. "oot Multi user " .. + return color.highlight("B") .. + "oot Multi user " .. color.highlight("[Enter]"); end, func = function() @@ -164,7 +165,8 @@ menu.welcome = { { entry_type = core.MENU_ENTRY, name = function() - return "Boot " .. color.highlight("S") .. "ingle user"; + return "Boot " .. color.highlight("S") .. + "ingle user"; end, func = function() core.setSingleUser(true); @@ -177,7 +179,8 @@ menu.welcome = { { entry_type = core.MENU_RETURN, name = function() - return color.highlight("Esc") .. "ape to loader prompt"; + return color.highlight("Esc") .. + "ape to loader prompt"; end, func = function() loader.setenv("autoboot_delay", "NO"); @@ -231,11 +234,11 @@ menu.welcome = { else name_color = color.escapef(color.BLUE); end - kernel_name = kernel_name .. name_color .. choice .. - color.default(); - return color.highlight("K").."ernel: " .. kernel_name .. - " (" .. idx .. - " of " .. #all_choices .. ")"; + kernel_name = kernel_name .. name_color .. + choice .. color.default(); + return color.highlight("K").."ernel: " .. + kernel_name .. " (" .. idx .. " of " .. + #all_choices .. ")"; end, func = function(idx, choice, all_choices) config.selectkernel(choice); @@ -247,7 +250,8 @@ menu.welcome = { { entry_type = core.MENU_SUBMENU, name = function() - return "Boot " .. color.highlight("O") .. "ptions"; + return "Boot " .. color.highlight("O") .. +
svn commit: r329587 - head/stand/lua
Author: kevans Date: Mon Feb 19 16:36:29 2018 New Revision: 329587 URL: https://svnweb.freebsd.org/changeset/base/329587 Log: stand/lua: Swap single-/multi- user boot entries as needed Modified: head/stand/lua/menu.lua Modified: head/stand/lua/menu.lua == --- head/stand/lua/menu.lua Mon Feb 19 16:35:46 2018(r329586) +++ head/stand/lua/menu.lua Mon Feb 19 16:36:29 2018(r329587) @@ -133,7 +133,19 @@ menu.boot_options = { }; menu.welcome = { - entries = { + entries = function() + local menu_entries = menu.welcome.all_entries; + -- Swap the first two menu items on single user boot + if (core.isSingleUserBoot()) then + local multiuser = menu_entries[1]; + local singleuser = menu_entries[2]; + + menu_entries[2] = multiuser; + menu_entries[1] = singleuser; + end + return menu_entries; + end, + all_entries = { -- boot multi user { entry_type = core.MENU_ENTRY, ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r329586 - head/stand/lua
Author: kevans Date: Mon Feb 19 16:35:46 2018 New Revision: 329586 URL: https://svnweb.freebsd.org/changeset/base/329586 Log: stand/lua: Call menu_entries if it's a function If we've fetched menu.entries and it turns out it's a function, call it to get the actual menu entries. This will be used to swap multi-/single- user boot options if we're booting single user by default (boot_single="YES" in loader.conf(5)). It can also be used fairly easily for other non-standard situations. Modified: head/stand/lua/drawer.lua Modified: head/stand/lua/drawer.lua == --- head/stand/lua/drawer.lua Mon Feb 19 16:34:23 2018(r329585) +++ head/stand/lua/drawer.lua Mon Feb 19 16:35:46 2018(r329586) @@ -167,7 +167,9 @@ function drawer.drawmenu(m) local alias_table = {}; local entry_num = 0; local menu_entries = m.entries; - + if (type(menu_entries) == "function") then + menu_entries = menu_entries(); + end for line_num, e in ipairs(menu_entries) do -- Allow menu items to be conditionally visible by specifying -- a visible function. ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r329585 - head/stand/lua
Author: kevans Date: Mon Feb 19 16:34:23 2018 New Revision: 329585 URL: https://svnweb.freebsd.org/changeset/base/329585 Log: stand/lua: Add core.isSingleUserBoot Modified: head/stand/lua/core.lua Modified: head/stand/lua/core.lua == --- head/stand/lua/core.lua Mon Feb 19 16:31:19 2018(r329584) +++ head/stand/lua/core.lua Mon Feb 19 16:34:23 2018(r329585) @@ -191,6 +191,11 @@ function core.boot() loader.perform("boot"); end +function core.isSingleUserBoot() + local single_user = loader.getenv("boot_single"); + return single_user ~= nil and single_user:lower() == "yes"; +end + function core.isSerialBoot() local c = loader.getenv("console"); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r329584 - head/sys/compat/linuxkpi/common/include/linux
Author: hselasky Date: Mon Feb 19 16:31:19 2018 New Revision: 329584 URL: https://svnweb.freebsd.org/changeset/base/329584 Log: Implement list_safe_reset_next() function macro in the LinuxKPI. MFC after:1 week Submitted by: Johannes LundbergSponsored by: Mellanox Technologies Sponsored by: Limelight Networks Modified: head/sys/compat/linuxkpi/common/include/linux/list.h Modified: head/sys/compat/linuxkpi/common/include/linux/list.h == --- head/sys/compat/linuxkpi/common/include/linux/list.hMon Feb 19 16:25:43 2018(r329583) +++ head/sys/compat/linuxkpi/common/include/linux/list.hMon Feb 19 16:31:19 2018(r329584) @@ -179,6 +179,9 @@ list_del_init(struct list_head *entry) #definelist_next_entry(ptr, member) \ list_entry(((ptr)->member.next), typeof(*(ptr)), member) +#definelist_safe_reset_next(ptr, n, member) \ + (n) = list_next_entry(ptr, member) + #definelist_prev_entry(ptr, member) \ list_entry(((ptr)->member.prev), typeof(*(ptr)), member) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r329583 - head/stand/lua
Author: kevans Date: Mon Feb 19 16:25:43 2018 New Revision: 329583 URL: https://svnweb.freebsd.org/changeset/base/329583 Log: stand/lua: Store menu entries in an "entries" table Instead of directly listing them in menu.welcome and menu.boot_options, store them at menu.welcome.entries and welcome.boot_options.entries. This will come into play later when we need to re-order the welcome menu if boot_single is specified. Modified: head/stand/lua/drawer.lua head/stand/lua/menu.lua Modified: head/stand/lua/drawer.lua == --- head/stand/lua/drawer.lua Mon Feb 19 15:56:33 2018(r329582) +++ head/stand/lua/drawer.lua Mon Feb 19 16:25:43 2018(r329583) @@ -166,7 +166,9 @@ function drawer.drawmenu(m) -- print the menu and build the alias table local alias_table = {}; local entry_num = 0; - for line_num, e in ipairs(m) do + local menu_entries = m.entries; + + for line_num, e in ipairs(menu_entries) do -- Allow menu items to be conditionally visible by specifying -- a visible function. if (e.visible ~= nil) and (not e.visible()) then Modified: head/stand/lua/menu.lua == --- head/stand/lua/menu.lua Mon Feb 19 15:56:33 2018(r329582) +++ head/stand/lua/menu.lua Mon Feb 19 16:25:43 2018(r329583) @@ -44,202 +44,205 @@ local carousel_choices = {}; -- loader menu tree is rooted at menu.welcome menu.boot_options = { - -- return to welcome menu - { - entry_type = core.MENU_RETURN, - name = function() - return "Back to main menu" .. - color.highlight(" [Backspace]"); - end - }, + entries = { + -- return to welcome menu + { + entry_type = core.MENU_RETURN, + name = function() + return "Back to main menu" .. + color.highlight(" [Backspace]"); + end + }, - -- load defaults - { - entry_type = core.MENU_ENTRY, - name = function() - return "Load System " .. color.highlight("D") .. - "efaults"; - end, - func = function() - core.setDefaults(); - end, - alias = {"d", "D"} - }, + -- load defaults + { + entry_type = core.MENU_ENTRY, + name = function() + return "Load System " .. color.highlight("D") .. + "efaults"; + end, + func = function() + core.setDefaults(); + end, + alias = {"d", "D"} + }, - { - entry_type = core.MENU_SEPARATOR, - name = function() - return ""; - end - }, + { + entry_type = core.MENU_SEPARATOR, + name = function() + return ""; + end + }, - { - entry_type = core.MENU_SEPARATOR, - name = function() - return "Boot Options:"; - end - }, + { + entry_type = core.MENU_SEPARATOR, + name = function() + return "Boot Options:"; + end + }, - -- acpi - { - entry_type = core.MENU_ENTRY, - name = function() - return OnOff(color.highlight("A") .. "CPI :", - core.acpi); - end, - func = function() - core.setACPI(); - end, - alias = {"a", "A"} + -- acpi + { + entry_type = core.MENU_ENTRY, + name = function() + return OnOff(color.highlight("A") .. "CPI :", + core.acpi); + end, + func = function() + core.setACPI(); + end, + alias = {"a", "A"} + }, + -- safe mode + { + entry_type = core.MENU_ENTRY, + name = function() + return OnOff("Safe " .. color.highlight("M") .. +
svn commit: r329582 - stable/11/sys/netinet6
Author: vangyzen Date: Mon Feb 19 15:56:33 2018 New Revision: 329582 URL: https://svnweb.freebsd.org/changeset/base/329582 Log: MFC r329181 Update the MTU in affected routes when IPv6 RA changes the MTU ip6_calcmtu() only looks at the interface MTU if neither the TCP hostcache nor the route provides an MTU. Update the routes so they do not provide stale MTUs. This fixes UNH IPv6 conformance test cases v6LC_4_1_08 and v6LC_4_1_09, which use a RA to reduce the link MTU from 1500 to 1280. Reported and tested by: Farrell WoodsSponsored by: Dell EMC Differential Revision:https://reviews.freebsd.org/D14257 Modified: stable/11/sys/netinet6/nd6_rtr.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet6/nd6_rtr.c == --- stable/11/sys/netinet6/nd6_rtr.cMon Feb 19 15:54:26 2018 (r329581) +++ stable/11/sys/netinet6/nd6_rtr.cMon Feb 19 15:56:33 2018 (r329582) @@ -406,8 +406,11 @@ nd6_ra_input(struct mbuf *m, int off, int icmp6len) int change = (ndi->linkmtu != mtu); ndi->linkmtu = mtu; - if (change) /* in6_maxmtu may change */ + if (change) { + /* in6_maxmtu may change */ in6_setmaxmtu(); + rt_updatemtu(ifp); + } } else { nd6log((LOG_INFO, "nd6_ra_input: bogus mtu " "mtu=%lu sent from %s; " ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r329581 - stable/11/sys/netinet6
Author: vangyzen Date: Mon Feb 19 15:54:26 2018 New Revision: 329581 URL: https://svnweb.freebsd.org/changeset/base/329581 Log: MFC r329053 Fix ICMPv6 redirects icmp6_redirect_input() validates that a redirect packet came from the current gateway for the respective destination. To do this, it compares the source address, which has an embedded scope zone id, to the next-hop address, which does not. If the address is link-local, which should be the case, the comparison fails and the redirect is ignored. Insert the scope zone id into the next-hop address so the comparison is accurate. Unsurprisingly, this fixes 35 UNH IPv6 conformance test cases. Submitted by: Farrell Woods(initial revision) Reviewed by: ae melifaro dab Relnotes: yes Sponsored by: Dell EMC Differential Revision:https://reviews.freebsd.org/D14254 Modified: stable/11/sys/netinet6/icmp6.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet6/icmp6.c == --- stable/11/sys/netinet6/icmp6.c Mon Feb 19 15:49:27 2018 (r329580) +++ stable/11/sys/netinet6/icmp6.c Mon Feb 19 15:54:26 2018 (r329581) @@ -2302,6 +2302,14 @@ icmp6_redirect_input(struct mbuf *m, int off) goto bad; } + /* +* Embed scope zone id into next hop address, since +* fib6_lookup_nh_basic() returns address without embedded +* scope zone id. +*/ + if (in6_setscope(_addr, m->m_pkthdr.rcvif, NULL)) + goto freeit; + if (IN6_ARE_ADDR_EQUAL(, _addr) == 0) { nd6log((LOG_ERR, "ICMP6 redirect rejected; " ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r329580 - head/stand/lua
Author: kevans Date: Mon Feb 19 15:49:27 2018 New Revision: 329580 URL: https://svnweb.freebsd.org/changeset/base/329580 Log: stand/lua: Remove some unused local declarations Menus are actually defined as entries in the 'menu' table. These local declarations have not been used in the history of our in-tree lua scripts, so give them the boot. Modified: head/stand/lua/menu.lua Modified: head/stand/lua/menu.lua == --- head/stand/lua/menu.lua Mon Feb 19 15:49:14 2018(r329579) +++ head/stand/lua/menu.lua Mon Feb 19 15:49:27 2018(r329580) @@ -41,11 +41,7 @@ local run; local autoboot; local carousel_choices = {}; ---loader menu tree: ---rooted at menu.welcome ---submenu declarations: -local boot_options; -local welcome; +-- loader menu tree is rooted at menu.welcome menu.boot_options = { -- return to welcome menu ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r329579 - in head/sys: dev/ofw powerpc/ofw
Author: nwhitehorn Date: Mon Feb 19 15:49:14 2018 New Revision: 329579 URL: https://svnweb.freebsd.org/changeset/base/329579 Log: Set internal error returns for OF_peer(), OF_child(), and OF_parent() to zero, matching the IEEE 1275 standard. Since these internal error paths have never, to my knowledge, been taken, behavior is unchanged. Reported by: gonzo MFC after:2 weeks Modified: head/sys/dev/ofw/ofw_standard.c head/sys/powerpc/ofw/ofw_real.c Modified: head/sys/dev/ofw/ofw_standard.c == --- head/sys/dev/ofw/ofw_standard.c Mon Feb 19 15:47:09 2018 (r329578) +++ head/sys/dev/ofw/ofw_standard.c Mon Feb 19 15:49:14 2018 (r329579) @@ -232,7 +232,7 @@ ofw_std_peer(ofw_t ofw, phandle_t node) args.node = node; if (openfirmware() == -1) - return (-1); + return (0); return (args.next); } @@ -254,7 +254,7 @@ ofw_std_child(ofw_t ofw, phandle_t node) args.node = node; if (openfirmware() == -1) - return (-1); + return (0); return (args.child); } @@ -276,7 +276,7 @@ ofw_std_parent(ofw_t ofw, phandle_t node) args.node = node; if (openfirmware() == -1) - return (-1); + return (0); return (args.parent); } Modified: head/sys/powerpc/ofw/ofw_real.c == --- head/sys/powerpc/ofw/ofw_real.c Mon Feb 19 15:47:09 2018 (r329578) +++ head/sys/powerpc/ofw/ofw_real.c Mon Feb 19 15:49:14 2018 (r329579) @@ -366,7 +366,7 @@ ofw_real_peer(ofw_t ofw, phandle_t node) argsptr = ofw_real_map(, sizeof(args)); if (openfirmware((void *)argsptr) == -1) { ofw_real_stop(); - return (-1); + return (0); } ofw_real_unmap(argsptr, , sizeof(args)); ofw_real_stop(); @@ -395,7 +395,7 @@ ofw_real_child(ofw_t ofw, phandle_t node) argsptr = ofw_real_map(, sizeof(args)); if (openfirmware((void *)argsptr) == -1) { ofw_real_stop(); - return (-1); + return (0); } ofw_real_unmap(argsptr, , sizeof(args)); ofw_real_stop(); @@ -424,7 +424,7 @@ ofw_real_parent(ofw_t ofw, phandle_t node) argsptr = ofw_real_map(, sizeof(args)); if (openfirmware((void *)argsptr) == -1) { ofw_real_stop(); - return (-1); + return (0); } ofw_real_unmap(argsptr, , sizeof(args)); ofw_real_stop(); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r329578 - head/stand/lua
Author: kevans Date: Mon Feb 19 15:47:09 2018 New Revision: 329578 URL: https://svnweb.freebsd.org/changeset/base/329578 Log: stand/lua: Menu style.lua(9) nits Modified: head/stand/lua/menu.lua Modified: head/stand/lua/menu.lua == --- head/stand/lua/menu.lua Mon Feb 19 15:42:20 2018(r329577) +++ head/stand/lua/menu.lua Mon Feb 19 15:47:09 2018(r329578) @@ -52,7 +52,8 @@ menu.boot_options = { { entry_type = core.MENU_RETURN, name = function() - return "Back to main menu"..color.highlight(" [Backspace]"); + return "Back to main menu" .. + color.highlight(" [Backspace]"); end }, @@ -60,7 +61,8 @@ menu.boot_options = { { entry_type = core.MENU_ENTRY, name = function() - return "Load System "..color.highlight("D").."efaults"; + return "Load System " .. color.highlight("D") .. + "efaults"; end, func = function() core.setDefaults(); @@ -86,7 +88,8 @@ menu.boot_options = { { entry_type = core.MENU_ENTRY, name = function() - return OnOff(color.highlight("A").."CPI :", core.acpi); + return OnOff(color.highlight("A") .. "CPI :", + core.acpi); end, func = function() core.setACPI(); @@ -97,7 +100,8 @@ menu.boot_options = { { entry_type = core.MENU_ENTRY, name = function() - return OnOff("Safe "..color.highlight("M").."ode :", core.sm); + return OnOff("Safe " .. color.highlight("M") .. + "ode :", core.sm); end, func = function() core.setSafeMode(); @@ -108,7 +112,8 @@ menu.boot_options = { { entry_type = core.MENU_ENTRY, name = function() - return OnOff(color.highlight("S").."ingle user:", core.su); + return OnOff(color.highlight("S") .. "ingle user:", + core.su); end, func = function() core.setSingleUser(); @@ -119,7 +124,8 @@ menu.boot_options = { { entry_type = core.MENU_ENTRY, name = function() - return OnOff(color.highlight("V").."erbose:", core.verbose); + return OnOff(color.highlight("V") .. "erbose:", + core.verbose); end, func = function() core.setVerbose(); @@ -133,7 +139,8 @@ menu.welcome = { { entry_type = core.MENU_ENTRY, name = function() - return color.highlight("B").."oot Multi user "..color.highlight("[Enter]"); + return color.highlight("B") .. "oot Multi user " .. + color.highlight("[Enter]"); end, func = function() core.setSingleUser(false); @@ -146,7 +153,7 @@ menu.welcome = { { entry_type = core.MENU_ENTRY, name = function() - return "Boot "..color.highlight("S").."ingle user"; + return "Boot " .. color.highlight("S") .. "ingle user"; end, func = function() core.setSingleUser(true); @@ -159,7 +166,7 @@ menu.welcome = { { entry_type = core.MENU_RETURN, name = function() - return color.highlight("Esc").."ape to loader prompt"; + return color.highlight("Esc") .. "ape to loader prompt"; end, func = function() loader.setenv("autoboot_delay", "NO"); @@ -171,7 +178,7 @@ menu.welcome = { { entry_type = core.MENU_ENTRY, name = function() - return color.highlight("R").."eboot"; + return color.highlight("R") .. "eboot"; end, func = function() loader.perform("reboot"); @@ -229,7 +236,7 @@ menu.welcome = { { entry_type = core.MENU_SUBMENU, name = function() - return "Boot "..color.highlight("O").."ptions"; + return "Boot " .. color.highlight("O") .. "ptions"; end, submenu = function() return menu.boot_options; @@ -338,7
svn commit: r329577 - head/stand/lua
Author: kevans Date: Mon Feb 19 15:42:20 2018 New Revision: 329577 URL: https://svnweb.freebsd.org/changeset/base/329577 Log: stand/lua: Rename bootserial for clarity Modified: head/stand/lua/color.lua head/stand/lua/core.lua head/stand/lua/menu.lua head/stand/lua/screen.lua Modified: head/stand/lua/color.lua == --- head/stand/lua/color.luaMon Feb 19 14:21:56 2018(r329576) +++ head/stand/lua/color.luaMon Feb 19 15:42:20 2018(r329577) @@ -50,7 +50,7 @@ function color.isEnabled() return false; end end - return (not core.bootserial()); + return (not core.isSerialBoot()); end color.disabled = (not color.isEnabled()); Modified: head/stand/lua/core.lua == --- head/stand/lua/core.lua Mon Feb 19 14:21:56 2018(r329576) +++ head/stand/lua/core.lua Mon Feb 19 15:42:20 2018(r329577) @@ -191,7 +191,7 @@ function core.boot() loader.perform("boot"); end -function core.bootserial() +function core.isSerialBoot() local c = loader.getenv("console"); if (c ~= nil) then Modified: head/stand/lua/menu.lua == --- head/stand/lua/menu.lua Mon Feb 19 14:21:56 2018(r329576) +++ head/stand/lua/menu.lua Mon Feb 19 15:42:20 2018(r329577) @@ -338,7 +338,7 @@ function menu.run(m) end function menu.skip() - if (core.bootserial() )then + if (core.isSerialBoot())then return true; end local c = string.lower(loader.getenv("console") or ""); Modified: head/stand/lua/screen.lua == --- head/stand/lua/screen.lua Mon Feb 19 14:21:56 2018(r329576) +++ head/stand/lua/screen.lua Mon Feb 19 15:42:20 2018(r329577) @@ -43,14 +43,14 @@ function intstring(num) end function screen.clear() - if (core.bootserial()) then + if (core.isSerialBoot()) then return; end loader.printc("\027[H\027[J"); end function screen.setcursor(x, y) - if (core.bootserial()) then + if (core.isSerialBoot()) then return; end @@ -76,7 +76,7 @@ function screen.defcolor() end function screen.defcursor() - if (core.bootserial()) then + if (core.isSerialBoot()) then return; end loader.printc("\027[25;0H"); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r329576 - head/stand/lua
Author: kevans Date: Mon Feb 19 14:21:56 2018 New Revision: 329576 URL: https://svnweb.freebsd.org/changeset/base/329576 Log: stand/lua: Defer kernel/module loading until boot or menu escape Loading the kernel and modules can be really slow. Loading before the menu draws and every time one changes kernel/boot environment is even more painful. Defer loading until we either boot, auto-boot, or escape to loader prompt. We still need to deal with configuration changes as the boot environment changes, but this is generally much quicker. This commit strips all ELF loading out of config.load/config.reload so that these are purely for configuration. config.loadelf has been created to deal with kernel/module loads. Unloading logic has been ripped out, as we won't need to deal with it in the menu anymore. Discussed in part with: allanjude Modified: head/stand/lua/config.lua head/stand/lua/core.lua head/stand/lua/menu.lua Modified: head/stand/lua/config.lua == --- head/stand/lua/config.lua Mon Feb 19 12:52:17 2018(r329575) +++ head/stand/lua/config.lua Mon Feb 19 14:21:56 2018(r329576) @@ -345,6 +345,9 @@ function config.loadkernel(other_kernel) end end +function config.selectkernel(kernel) + config.kernel_selected = kernel; +end function config.load(file) if (not file) then @@ -367,40 +370,38 @@ function config.load(file) -- Cache the provided module_path at load time for later use config.module_path = loader.getenv("module_path"); +end - print("Loading kernel..."); - config.loadkernel(config.kernel_loaded); - - print("Loading configured modules..."); - if (not config.loadmod(modules)) then - print("Could not load one or more modules!"); - end +-- Reload configuration +function config.reload(file) + -- XXX TODO: We should be doing something more here to clear out env + -- changes that rode in with the last configuration load + modules = {}; + config.load(file); end -function config.reload(kernel) - local kernel_loaded = false; +function config.loadelf() + local kernel = config.kernel_loaded or config.kernel_selected; + local loaded = false; - -- unload all modules - print("Unloading modules..."); - loader.perform("unload"); + print("Loading kernel..."); + loaded = config.loadkernel(kernel); - if (kernel ~= nil) then - print("Trying to load '" .. kernel .. "'") - kernel_loaded = config.loadkernel(kernel); - if (kernel_loaded) then - print("Kernel '" .. kernel .. "' loaded!"); - end + if (not loaded) then + loaded = config.loadkernel(); end - -- failed to load kernel or it is nil - -- then load default - if (not kernel_loaded) then - print("Loading default kernel..."); - config.loadkernel(); + if (not loaded) then + -- Ultimately failed to load kernel + print("Failed to load any kernel"); + return; end - -- load modules - config.loadmod(modules); + print("Loading configured modules..."); + if (not config.loadmod(modules)) then + print("Could not load one or more modules!"); + end end + return config Modified: head/stand/lua/core.lua == --- head/stand/lua/core.lua Mon Feb 19 12:52:17 2018(r329575) +++ head/stand/lua/core.lua Mon Feb 19 14:21:56 2018(r329576) @@ -26,6 +26,8 @@ -- $FreeBSD$ -- +local config = require('config'); + local core = {}; -- Commonly appearing constants @@ -180,10 +182,12 @@ function core.setDefaults() end function core.autoboot() + config.loadelf(); loader.perform("autoboot"); end function core.boot() + config.loadelf(); loader.perform("boot"); end Modified: head/stand/lua/menu.lua == --- head/stand/lua/menu.lua Mon Feb 19 12:52:17 2018(r329575) +++ head/stand/lua/menu.lua Mon Feb 19 14:21:56 2018(r329576) @@ -220,9 +220,7 @@ menu.welcome = { " of " .. #all_choices .. ")"; end, func = function(idx, choice, all_choices) - if (#all_choices > 1) then - config.reload(choice); - end + config.selectkernel(choice); end, alias = {"k", "K"} }, @@ -332,6 +330,7 @@ function menu.run(m) if (m == menu.welcome) then screen.defcursor(); print("Exiting menu!");
svn commit: r329563 - head/sys/netipsec
Author: ae Date: Mon Feb 19 12:20:51 2018 New Revision: 329563 URL: https://svnweb.freebsd.org/changeset/base/329563 Log: Remove unused variables and sysctl declaration. MFC after:1 week Modified: head/sys/netipsec/ipsec.c head/sys/netipsec/ipsec.h Modified: head/sys/netipsec/ipsec.c == --- head/sys/netipsec/ipsec.c Mon Feb 19 12:20:17 2018(r329562) +++ head/sys/netipsec/ipsec.c Mon Feb 19 12:20:51 2018(r329563) @@ -110,7 +110,6 @@ VNET_PCPUSTAT_SYSINIT(ipsec4stat); VNET_PCPUSTAT_SYSUNINIT(ipsec4stat); #endif /* VIMAGE */ -VNET_DEFINE(int, ip4_ah_offsetmask) = 0; /* maybe IP_DF? */ /* DF bit on encap. 0: clear 1: set 2: copy */ VNET_DEFINE(int, ip4_ipsec_dfbit) = 0; VNET_DEFINE(int, ip4_esp_trans_deflev) = IPSEC_LEVEL_USE; @@ -119,7 +118,6 @@ VNET_DEFINE(int, ip4_ah_trans_deflev) = IPSEC_LEVEL_US VNET_DEFINE(int, ip4_ah_net_deflev) = IPSEC_LEVEL_USE; /* ECN ignore(-1)/forbidden(0)/allowed(1) */ VNET_DEFINE(int, ip4_ipsec_ecn) = 0; -VNET_DEFINE(int, ip4_esp_randpad) = -1; static VNET_DEFINE(int, ip4_filtertunnel) = 0; #defineV_ip4_filtertunnel VNET(ip4_filtertunnel) @@ -194,9 +192,6 @@ SYSCTL_INT(_net_inet_ipsec, IPSECCTL_DEF_AH_NETLEV, ah SYSCTL_INT(_net_inet_ipsec, IPSECCTL_AH_CLEARTOS, ah_cleartos, CTLFLAG_VNET | CTLFLAG_RW, _NAME(ah_cleartos), 0, "If set, clear type-of-service field when doing AH computation."); -SYSCTL_INT(_net_inet_ipsec, IPSECCTL_AH_OFFSETMASK, ah_offsetmask, - CTLFLAG_VNET | CTLFLAG_RW, _NAME(ip4_ah_offsetmask), 0, - "If not set, clear offset field mask when doing AH computation."); SYSCTL_INT(_net_inet_ipsec, IPSECCTL_DFBIT, dfbit, CTLFLAG_VNET | CTLFLAG_RW, _NAME(ip4_ipsec_dfbit), 0, "Do not fragment bit on encap."); Modified: head/sys/netipsec/ipsec.h == --- head/sys/netipsec/ipsec.h Mon Feb 19 12:20:17 2018(r329562) +++ head/sys/netipsec/ipsec.h Mon Feb 19 12:20:51 2018(r329563) @@ -280,10 +280,8 @@ VNET_DECLARE(int, ip4_esp_trans_deflev); VNET_DECLARE(int, ip4_esp_net_deflev); VNET_DECLARE(int, ip4_ah_trans_deflev); VNET_DECLARE(int, ip4_ah_net_deflev); -VNET_DECLARE(int, ip4_ah_offsetmask); VNET_DECLARE(int, ip4_ipsec_dfbit); VNET_DECLARE(int, ip4_ipsec_ecn); -VNET_DECLARE(int, ip4_esp_randpad); VNET_DECLARE(int, crypto_support); VNET_DECLARE(int, async_crypto); VNET_DECLARE(int, natt_cksum_policy); @@ -294,10 +292,8 @@ VNET_DECLARE(int, natt_cksum_policy); #defineV_ip4_esp_net_deflevVNET(ip4_esp_net_deflev) #defineV_ip4_ah_trans_deflev VNET(ip4_ah_trans_deflev) #defineV_ip4_ah_net_deflev VNET(ip4_ah_net_deflev) -#defineV_ip4_ah_offsetmask VNET(ip4_ah_offsetmask) #defineV_ip4_ipsec_dfbit VNET(ip4_ipsec_dfbit) #defineV_ip4_ipsec_ecn VNET(ip4_ipsec_ecn) -#defineV_ip4_esp_randpad VNET(ip4_esp_randpad) #defineV_crypto_supportVNET(crypto_support) #defineV_async_crypto VNET(async_crypto) #defineV_natt_cksum_policy VNET(natt_cksum_policy) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r329565 - svnadmin/conf
Author: hselasky Date: Mon Feb 19 12:21:56 2018 New Revision: 329565 URL: https://svnweb.freebsd.org/changeset/base/329565 Log: Remove myself. Modified: svnadmin/conf/sizelimit.conf Modified: svnadmin/conf/sizelimit.conf == --- svnadmin/conf/sizelimit.confMon Feb 19 12:21:24 2018 (r329564) +++ svnadmin/conf/sizelimit.confMon Feb 19 12:21:56 2018 (r329565) @@ -19,7 +19,6 @@ bapt brooks davidcs dim -hselasky imp jb jeff ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r329562 - svnadmin/conf
Author: hselasky Date: Mon Feb 19 12:20:17 2018 New Revision: 329562 URL: https://svnweb.freebsd.org/changeset/base/329562 Log: Add myself. Modified: svnadmin/conf/sizelimit.conf Modified: svnadmin/conf/sizelimit.conf == --- svnadmin/conf/sizelimit.confMon Feb 19 11:14:38 2018 (r329561) +++ svnadmin/conf/sizelimit.confMon Feb 19 12:20:17 2018 (r329562) @@ -19,6 +19,7 @@ bapt brooks davidcs dim +hselasky imp jb jeff ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r329561 - head/sys/netipsec
Author: ae Date: Mon Feb 19 11:14:38 2018 New Revision: 329561 URL: https://svnweb.freebsd.org/changeset/base/329561 Log: Check packet length to do not make out of bounds access. Also save ah_nxt value to use it later, since ah pointer can become invalid. Reported by: Maxime Villard MFC after:5 days Modified: head/sys/netipsec/xform_ah.c Modified: head/sys/netipsec/xform_ah.c == --- head/sys/netipsec/xform_ah.cMon Feb 19 10:59:19 2018 (r329560) +++ head/sys/netipsec/xform_ah.cMon Feb 19 11:14:38 2018 (r329561) @@ -582,6 +582,16 @@ ah_input(struct mbuf *m, struct secasvar *sav, int ski error = EACCES; goto bad; } + if (skip + authsize + rplen > m->m_pkthdr.len) { + DPRINTF(("%s: bad mbuf length %u (expecting %lu)" + " for packet in SA %s/%08lx\n", __func__, + m->m_pkthdr.len, (u_long) (skip + authsize + rplen), + ipsec_address(>sah->saidx.dst, buf, sizeof(buf)), + (u_long) ntohl(sav->spi))); + AHSTAT_INC(ahs_badauthl); + error = EACCES; + goto bad; + } AHSTAT_ADD(ahs_ibytes, m->m_pkthdr.len - skip - hl); /* Get crypto descriptors. */ @@ -626,6 +636,9 @@ ah_input(struct mbuf *m, struct secasvar *sav, int ski /* Zeroize the authenticator on the packet. */ m_copyback(m, skip + rplen, authsize, ipseczeroes); + /* Save ah_nxt, since ah pointer can become invalid after "massage" */ + hl = ah->ah_nxt; + /* "Massage" the packet headers for crypto processing. */ error = ah_massage_headers(, sav->sah->saidx.dst.sa.sa_family, skip, ahx->type, 0); @@ -650,7 +663,7 @@ ah_input(struct mbuf *m, struct secasvar *sav, int ski /* These are passed as-is to the callback. */ xd->sav = sav; - xd->nxt = ah->ah_nxt; + xd->nxt = hl; xd->protoff = protoff; xd->skip = skip; xd->cryptoid = cryptoid; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r329560 - stable/11/share/man/man9
Author: kib Date: Mon Feb 19 10:59:19 2018 New Revision: 329560 URL: https://svnweb.freebsd.org/changeset/base/329560 Log: MFC r329347: Note that on amd64 pmap_enter(psind = 1) works. Modified: stable/11/share/man/man9/pmap_enter.9 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man9/pmap_enter.9 == --- stable/11/share/man/man9/pmap_enter.9 Mon Feb 19 10:34:30 2018 (r329559) +++ stable/11/share/man/man9/pmap_enter.9 Mon Feb 19 10:59:19 2018 (r329560) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 27, 2015 +.Dd February 16, 2018 .Dt PMAP_ENTER 9 .Os .Sh NAME @@ -133,13 +133,13 @@ The function must handle the multiprocessor TLB consistency for the given address. .Sh NOTES -On amd64, arm and i386 architectures the existing implementation +On arm and i386 architectures the existing implementation of the .Nm function is incomplete, only value 0 for .Fa psind is supported. -Other supported architectures have +Other supported architectures, except amd64, have .Dv pagesizes[] array of size 1. .Sh RETURN VALUES ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r329559 - stable/11/sys/netinet6
Author: ae Date: Mon Feb 19 10:34:30 2018 New Revision: 329559 URL: https://svnweb.freebsd.org/changeset/base/329559 Log: MFC r328541: Do not skip scope zone violation check, when mbuf has M_FASTFWD_OURS flag. When mbuf has M_FASTFWD_OURS flag, this means that a destination address is our local, but we still need to pass scope zone violation check, because protocol level expects that IPv6 link-local addresses have embedded scope zone indexes. This should fix the problem, when ipfw is used to forward packets to local address and source address of a packet is IPv6 LLA. Reported by:asomers@ Modified: stable/11/sys/netinet6/ip6_input.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet6/ip6_input.c == --- stable/11/sys/netinet6/ip6_input.c Mon Feb 19 10:30:34 2018 (r329558) +++ stable/11/sys/netinet6/ip6_input.c Mon Feb 19 10:34:30 2018 (r329559) @@ -571,10 +571,8 @@ ip6_input(struct mbuf *m) /* * Firewall changed destination to local. */ - m->m_flags &= ~M_FASTFWD_OURS; - ours = 1; ip6 = mtod(m, struct ip6_hdr *); - goto hbhcheck; + goto passin; } /* @@ -735,10 +733,8 @@ ip6_input(struct mbuf *m) if ((m = ip6_tryforward(m)) == NULL) return; if (m->m_flags & M_FASTFWD_OURS) { - m->m_flags &= ~M_FASTFWD_OURS; - ours = 1; ip6 = mtod(m, struct ip6_hdr *); - goto hbhcheck; + goto passin; } } #if defined(IPSEC) || defined(IPSEC_SUPPORT) @@ -769,13 +765,7 @@ ip6_input(struct mbuf *m) return; ip6 = mtod(m, struct ip6_hdr *); srcrt = !IN6_ARE_ADDR_EQUAL(, >ip6_dst); - - if (m->m_flags & M_FASTFWD_OURS) { - m->m_flags &= ~M_FASTFWD_OURS; - ours = 1; - goto hbhcheck; - } - if ((m->m_flags & M_IP6_NEXTHOP) && + if ((m->m_flags & (M_IP6_NEXTHOP | M_FASTFWD_OURS)) == M_IP6_NEXTHOP && m_tag_find(m, PACKET_TAG_IPFORWARD, NULL) != NULL) { /* * Directly ship the packet on. This allows forwarding @@ -805,6 +795,11 @@ passin: in6_setscope(>ip6_dst, rcvif, NULL)) { IP6STAT_INC(ip6s_badscope); goto bad; + } + if (m->m_flags & M_FASTFWD_OURS) { + m->m_flags &= ~M_FASTFWD_OURS; + ours = 1; + goto hbhcheck; } /* * Multicast check. Assume packet is for us to avoid ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r329558 - stable/11/sys/netinet6
Author: ae Date: Mon Feb 19 10:30:34 2018 New Revision: 329558 URL: https://svnweb.freebsd.org/changeset/base/329558 Log: MFC r328540: Assign IPv6 link-local address to loopback interfaces whith unit > 0. When an interface has IFF_LOOPBACK flag in6_ifattach() tries to assing IPv6 loopback address to this interface. It uses in6ifa_ifpwithaddr() to check, that interface doesn't already have given address and then uses in6_ifattach_loopback(). If in6_ifattach_loopback() fails, it just exits and thus skips assignment of IPv6 LLA. Fix this using in6ifa_ifwithaddr() function. If IPv6 loopback address is already assigned in the system, do not call in6_ifattach_loopback(). PR: 138678 Modified: stable/11/sys/netinet6/in6_ifattach.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet6/in6_ifattach.c == --- stable/11/sys/netinet6/in6_ifattach.c Mon Feb 19 09:08:46 2018 (r329557) +++ stable/11/sys/netinet6/in6_ifattach.c Mon Feb 19 10:30:34 2018 (r329558) @@ -689,7 +689,6 @@ void in6_ifattach(struct ifnet *ifp, struct ifnet *altifp) { struct in6_ifaddr *ia; - struct in6_addr in6; if (ifp->if_afdata[AF_INET6] == NULL) return; @@ -722,18 +721,16 @@ in6_ifattach(struct ifnet *ifp, struct ifnet *altifp) /* * assign loopback address for loopback interface. -* XXX multiple loopback interface case. */ if ((ifp->if_flags & IFF_LOOPBACK) != 0) { - struct ifaddr *ifa; - - in6 = in6addr_loopback; - ifa = (struct ifaddr *)in6ifa_ifpwithaddr(ifp, ); - if (ifa == NULL) { - if (in6_ifattach_loopback(ifp) != 0) - return; - } else - ifa_free(ifa); + /* +* check that loopback address doesn't exist yet. +*/ + ia = in6ifa_ifwithaddr(_loopback, 0); + if (ia == NULL) + in6_ifattach_loopback(ifp); + else + ifa_free(>ia_ifa); } /* @@ -741,18 +738,10 @@ in6_ifattach(struct ifnet *ifp, struct ifnet *altifp) */ if (!(ND_IFINFO(ifp)->flags & ND6_IFF_IFDISABLED) && ND_IFINFO(ifp)->flags & ND6_IFF_AUTO_LINKLOCAL) { - int error; - ia = in6ifa_ifpforlinklocal(ifp, 0); - if (ia == NULL) { - error = in6_ifattach_linklocal(ifp, altifp); -#if 0 - if (error) - log(LOG_NOTICE, "in6_ifattach_linklocal: " - "failed to add a link-local addr to %s\n", - if_name(ifp)); -#endif - } else + if (ia == NULL) + in6_ifattach_linklocal(ifp, altifp); + else ifa_free(>ia_ifa); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r329556 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Author: avg Date: Mon Feb 19 08:55:22 2018 New Revision: 329556 URL: https://svnweb.freebsd.org/changeset/base/329556 Log: relax an assert in zfsctl_snapdir_lookup to match r323578 Since r323578 we may remove the last reference to a covered vnode with vrele() instead of vput(). So, v_usecount may be decremented before the vnode is locked and zfsctl_snapdir_lookup may "catch" the vnode with v_usecount of zero and v_holdcnt of one. PR: 225795 Reported by: asomers MFC after:1 week Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c == --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.cMon Feb 19 06:11:58 2018(r329555) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.cMon Feb 19 08:55:22 2018(r329556) @@ -980,7 +980,7 @@ zfsctl_snapdir_lookup(ap) * the mount point or the thread doing the mounting. * There can be more references from concurrent lookups. */ - KASSERT(vrefcnt(*vpp) > 1, ("found unreferenced mountpoint")); + KASSERT((*vpp)->v_holdcnt > 1, ("found unheld mountpoint")); /* * Check if a snapshot is already mounted on top of the vnode. ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"