svn commit: r367754 - head/sys/arm64/arm64
Author: andrew Date: Tue Nov 17 10:17:18 2020 New Revision: 367754 URL: https://svnweb.freebsd.org/changeset/base/367754 Log: Allow the GICv3 ACPI driver to attach to a GICv4 The same driver works on both, allow the driver to attach to a GICv4 controller with the ACPI attachment. Reported by: Andrey Fesenko Sponsored by: Innovate UK Modified: head/sys/arm64/arm64/gic_v3_acpi.c Modified: head/sys/arm64/arm64/gic_v3_acpi.c == --- head/sys/arm64/arm64/gic_v3_acpi.c Tue Nov 17 08:11:17 2020 (r367753) +++ head/sys/arm64/arm64/gic_v3_acpi.c Tue Nov 17 10:17:18 2020 (r367754) @@ -168,9 +168,15 @@ gic_v3_acpi_identify(driver_t *driver, device_t parent "No gic interrupt or distributor table\n"); goto out; } - /* This is for the wrong GIC version */ - if (madt_data.dist->Version != ACPI_MADT_GIC_VERSION_V3) + + /* Check the GIC version is supported by thiss driver */ + switch(madt_data.dist->Version) { + case ACPI_MADT_GIC_VERSION_V3: + case ACPI_MADT_GIC_VERSION_V4: + break; + default: goto out; + } dev = BUS_ADD_CHILD(parent, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_MIDDLE, "gic", -1); @@ -199,6 +205,7 @@ gic_v3_acpi_probe(device_t dev) switch((uintptr_t)acpi_get_private(dev)) { case ACPI_MADT_GIC_VERSION_V3: + case ACPI_MADT_GIC_VERSION_V4: break; default: return (ENXIO); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r367754 - head/sys/arm64/arm64
> On 17 Nov 2020, at 10:17, Andrew Turner wrote: > > Author: andrew > Date: Tue Nov 17 10:17:18 2020 > New Revision: 367754 > URL: https://svnweb.freebsd.org/changeset/base/367754 > > Log: > Allow the GICv3 ACPI driver to attach to a GICv4 > > The same driver works on both, allow the driver to attach to a GICv4 > controller with the ACPI attachment. > > Reported by: Andrey Fesenko > Sponsored by:Innovate UK Differential Revision: https://reviews.freebsd.org/D27238 ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r367755 - head/sys/arm64/arm64
Author: andrew Date: Tue Nov 17 10:27:42 2020 New Revision: 367755 URL: https://svnweb.freebsd.org/changeset/base/367755 Log: Stop calling gic_v3_detach when we haven't called gic_v3_attach The former tries to dereference memory allocated by the latter. If counting the redistributor fails it may try to dereference memory that was never allocated. Sponsored by: Innovate UK Modified: head/sys/arm64/arm64/gic_v3_acpi.c Modified: head/sys/arm64/arm64/gic_v3_acpi.c == --- head/sys/arm64/arm64/gic_v3_acpi.c Tue Nov 17 10:17:18 2020 (r367754) +++ head/sys/arm64/arm64/gic_v3_acpi.c Tue Nov 17 10:27:42 2020 (r367755) @@ -262,7 +262,7 @@ gic_v3_acpi_attach(device_t dev) err = gic_v3_acpi_count_regions(dev); if (err != 0) - goto error; + goto count_error; err = gic_v3_attach(dev); if (err != 0) @@ -294,12 +294,13 @@ gic_v3_acpi_attach(device_t dev) return (0); error: + /* Failure so free resources */ + gic_v3_detach(dev); +count_error: if (bootverbose) { device_printf(dev, "Failed to attach. Error %d\n", err); } - /* Failure so free resources */ - gic_v3_detach(dev); return (err); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r367756 - head/usr.bin/chpass
Author: 0mp (doc,ports committer) Date: Tue Nov 17 10:48:01 2020 New Revision: 367756 URL: https://svnweb.freebsd.org/changeset/base/367756 Log: Clean up the synopsis section & fix mandoc warnings The synopsis section had two very similar entries. The flags documented by the first one were a strict subset of the second one. Let's just keep only the second entry for simplicity. MFC after:1 week Modified: head/usr.bin/chpass/chpass.1 Modified: head/usr.bin/chpass/chpass.1 == --- head/usr.bin/chpass/chpass.1Tue Nov 17 10:27:42 2020 (r367755) +++ head/usr.bin/chpass/chpass.1Tue Nov 17 10:48:01 2020 (r367756) @@ -28,7 +28,7 @@ .\" @(#)chpass.1 8.2 (Berkeley) 12/30/93 .\" $FreeBSD$ .\" -.Dd December 30, 1993 +.Dd November 17, 2020 .Dt CHPASS 1 .Os .Sh NAME @@ -41,19 +41,13 @@ .Nd add or change user database information .Sh SYNOPSIS .Nm +.Op Fl loy .Op Fl a Ar list -.Op Fl p Ar encpass +.Op Fl d Ar domain .Op Fl e Ar expiretime -.Op Fl s Ar newshell -.Op user -.Nm -.Op Fl oly -.Op Fl a Ar list +.Op Fl h Ar host .Op Fl p Ar encpass -.Op Fl e Ar expiretime .Op Fl s Ar newshell -.Op Fl d Ar domain -.Op Fl h Ar host .Op user .Sh DESCRIPTION The @@ -216,7 +210,7 @@ Note that .Xr finger 1 will display the office location and office phone together under the heading -.Ar Office: . +.Ar Office\&: . .Pp The user's .Ar home directory @@ -313,7 +307,7 @@ changing other fields could be added, this would lead compatibility problems with other NIS-capable systems. Even though the super-user may supply data for other fields while editing an entry, the extra information (other than the -password -- see below) will be silently discarded. +password \(em see below) will be silently discarded. .Pp Exception: the super-user on the NIS master server is permitted to change any field. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r367757 - head/usr.bin/chpass
Author: 0mp (doc,ports committer) Date: Tue Nov 17 10:57:28 2020 New Revision: 367757 URL: https://svnweb.freebsd.org/changeset/base/367757 Log: Improve readability of the lists of options - Sort options alphabetically - Add missing arguments (e.g., "list" to -a) - Adjust the width of Bl MFC after:1 week Modified: head/usr.bin/chpass/chpass.1 Modified: head/usr.bin/chpass/chpass.1 == --- head/usr.bin/chpass/chpass.1Tue Nov 17 10:48:01 2020 (r367756) +++ head/usr.bin/chpass/chpass.1Tue Nov 17 10:57:28 2020 (r367757) @@ -74,8 +74,8 @@ The information is formatted and supplied to an editor Only the information that the user is allowed to change is displayed. .Pp The options are as follows: -.Bl -tag -width indent -.It Fl a +.Bl -tag -width "-e expiretime" +.It Fl a Ar list The super-user is allowed to directly supply a user database entry, in the format specified by .Xr passwd 5 , @@ -84,15 +84,15 @@ This argument must be a colon .Pq Dq \&: separated list of all the user database fields, although they may be empty. -.It Fl p -The super-user is allowed to directly supply an encrypted password field, -in the format used by -.Xr crypt 3 , -as an argument. .It Fl e Ar expiretime Change the account expire time. This option is used to set the expire time from a script as if it was done in the interactive editor. +.It Fl p Ar encpass +The super-user is allowed to directly supply an encrypted password field, +in the format used by +.Xr crypt 3 , +as an argument. .It Fl s Ar newshell Attempt to change the user's shell to .Ar newshell . @@ -376,19 +376,7 @@ change a user's NIS password with There are also a few extra option flags that are available when .Nm is compiled with NIS support: -.Bl -tag -width indent -.It Fl l -Force -.Nm -to modify the local copy of a user's password -information in the event that a user exists in both -the local and NIS databases. -.It Fl y -Opposite effect of -.Fl l . -This flag is largely redundant since -.Nm -operates on NIS entries by default if NIS is enabled. +.Bl -tag -width "-d domain" .It Fl d Ar domain Specify a particular NIS domain. The @@ -426,6 +414,12 @@ option can be used in conjunction with the .Fl d option, in which case the user-specified hostname will override the default. +.It Fl l +Force +.Nm +to modify the local copy of a user's password +information in the event that a user exists in both +the local and NIS databases. .It Fl o Force the use of RPC-based updates when communicating with .Xr rpc.yppasswdd 8 @@ -443,6 +437,12 @@ flag can be used to force to use the standard update mechanism instead. This option is provided mainly for testing purposes. +.It Fl y +Opposite effect of +.Fl l . +This flag is largely redundant since +.Nm +operates on NIS entries by default if NIS is enabled. .El .Sh FILES .Bl -tag -width /etc/master.passwd -compact ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r367756 - head/usr.bin/chpass
On 11/17/20 11:48 AM, Mateusz Piotrowski wrote: Author: 0mp (doc,ports committer) Date: Tue Nov 17 10:48:01 2020 New Revision: 367756 URL: https://svnweb.freebsd.org/changeset/base/367756 Log: Clean up the synopsis section & fix mandoc warnings The synopsis section had two very similar entries. The flags documented by the first one were a strict subset of the second one. Let's just keep only the second entry for simplicity. Uh, I think I get it now. The simpler one was referring to the chpass, while one second one was documenting ypchpass (passwd(1) has a similar synopsis). I guess I'll bring back both entries and will use "Nm ypchpass" for the entry listing NIS-specific flags. MFC after: 1 week Modified: head/usr.bin/chpass/chpass.1 Modified: head/usr.bin/chpass/chpass.1 == --- head/usr.bin/chpass/chpass.1Tue Nov 17 10:27:42 2020 (r367755) +++ head/usr.bin/chpass/chpass.1Tue Nov 17 10:48:01 2020 (r367756) @@ -28,7 +28,7 @@ .\" @(#)chpass.1 8.2 (Berkeley) 12/30/93 .\" $FreeBSD$ .\" -.Dd December 30, 1993 +.Dd November 17, 2020 .Dt CHPASS 1 .Os .Sh NAME @@ -41,19 +41,13 @@ .Nd add or change user database information .Sh SYNOPSIS .Nm +.Op Fl loy .Op Fl a Ar list -.Op Fl p Ar encpass +.Op Fl d Ar domain .Op Fl e Ar expiretime -.Op Fl s Ar newshell -.Op user -.Nm -.Op Fl oly -.Op Fl a Ar list +.Op Fl h Ar host .Op Fl p Ar encpass -.Op Fl e Ar expiretime .Op Fl s Ar newshell -.Op Fl d Ar domain -.Op Fl h Ar host .Op user .Sh DESCRIPTION The @@ -216,7 +210,7 @@ Note that .Xr finger 1 will display the office location and office phone together under the heading -.Ar Office: . +.Ar Office\&: . .Pp The user's .Ar home directory @@ -313,7 +307,7 @@ changing other fields could be added, this would lead compatibility problems with other NIS-capable systems. Even though the super-user may supply data for other fields while editing an entry, the extra information (other than the -password -- see below) will be silently discarded. +password \(em see below) will be silently discarded. .Pp Exception: the super-user on the NIS master server is permitted to change any field. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r367758 - in head/sys/powerpc: aim include powerpc
Author: luporl Date: Tue Nov 17 11:36:31 2020 New Revision: 367758 URL: https://svnweb.freebsd.org/changeset/base/367758 Log: [PowerPC] Don't overwrite vm.pmap sysctl node After r367417, both mmu_oea64 and mmu_radix were defining the vm.pmap sysctl node, resulting in the later definition hiding the properties of the previous one. Avoid this issue by defining vm.pmap in a common source file and declaring it where needed. This change also standardizes the tunable name used to enable superpages and change its default to disabled on radix MMU, because it still has some issues with superpages. Reviewed by: bdragon, jhibbits Sponsored by: Eldorado Research Institute (eldorado.org.br) Differential Revision:https://reviews.freebsd.org/D27156 Modified: head/sys/powerpc/aim/mmu_oea64.c head/sys/powerpc/aim/mmu_radix.c head/sys/powerpc/include/pmap.h head/sys/powerpc/powerpc/pmap_dispatch.c Modified: head/sys/powerpc/aim/mmu_oea64.c == --- head/sys/powerpc/aim/mmu_oea64.cTue Nov 17 10:57:28 2020 (r367757) +++ head/sys/powerpc/aim/mmu_oea64.cTue Nov 17 11:36:31 2020 (r367758) @@ -319,13 +319,8 @@ static voidmoea64_remove_locked(pmap_t, vm_offset_t, /* MD page flag indicating that the page is a superpage. */ #defineMDPG_ATTR_SP0x4000 -static SYSCTL_NODE(_vm, OID_AUTO, pmap, CTLFLAG_RD, 0, -"VM/pmap parameters"); +SYSCTL_DECL(_vm_pmap); -static int superpages_enabled = 0; -SYSCTL_INT(_vm_pmap, OID_AUTO, superpages_enabled, CTLFLAG_RDTUN, -&superpages_enabled, 0, "Enable support for transparent superpages"); - static SYSCTL_NODE(_vm_pmap, OID_AUTO, sp, CTLFLAG_RD, 0, "SP page mapping counters"); @@ -1968,7 +1963,11 @@ moea64_init() /* * Are large page mappings enabled? +* +* While HPT superpages are not better tested, leave it disabled by +* default. */ + superpages_enabled = 0; TUNABLE_INT_FETCH("vm.pmap.superpages_enabled", &superpages_enabled); if (superpages_enabled) { KASSERT(MAXPAGESIZES > 1 && pagesizes[1] == 0, Modified: head/sys/powerpc/aim/mmu_radix.c == --- head/sys/powerpc/aim/mmu_radix.cTue Nov 17 10:57:28 2020 (r367757) +++ head/sys/powerpc/aim/mmu_radix.cTue Nov 17 11:36:31 2020 (r367758) @@ -385,11 +385,8 @@ SYSCTL_INT(_machdep, OID_AUTO, nkpt, CTLFLAG_RD, &nkpt vm_paddr_t dmaplimit; -SYSCTL_NODE(_vm, OID_AUTO, pmap, CTLFLAG_RD, 0, "VM/pmap parameters"); +SYSCTL_DECL(_vm_pmap); -static int pg_ps_enabled = 1; -SYSCTL_INT(_vm_pmap, OID_AUTO, pg_ps_enabled, CTLFLAG_RDTUN | CTLFLAG_NOFETCH, -&pg_ps_enabled, 0, "Are large page mappings enabled?"); #ifdef INVARIANTS #define VERBOSE_PMAP 0 #define VERBOSE_PROTECT 0 @@ -904,7 +901,7 @@ mmu_radix_kenter(vm_offset_t va, vm_paddr_t pa) bool mmu_radix_ps_enabled(pmap_t pmap) { - return (pg_ps_enabled && (pmap->pm_flags & PMAP_PDE_SUPERPAGE) != 0); + return (superpages_enabled && (pmap->pm_flags & PMAP_PDE_SUPERPAGE) != 0); } static pt_entry_t * @@ -3609,8 +3606,8 @@ mmu_radix_init() /* * Are large page mappings enabled? */ - TUNABLE_INT_FETCH("vm.pmap.pg_ps_enabled", &pg_ps_enabled); - if (pg_ps_enabled) { + TUNABLE_INT_FETCH("vm.pmap.superpages_enabled", &superpages_enabled); + if (superpages_enabled) { KASSERT(MAXPAGESIZES > 1 && pagesizes[1] == 0, ("pmap_init: can't assign to pagesizes[1]")); pagesizes[1] = L3_PAGE_SIZE; Modified: head/sys/powerpc/include/pmap.h == --- head/sys/powerpc/include/pmap.h Tue Nov 17 10:57:28 2020 (r367757) +++ head/sys/powerpc/include/pmap.h Tue Nov 17 11:36:31 2020 (r367758) @@ -336,6 +336,7 @@ extern vm_offset_t msgbuf_phys; extern int pmap_bootstrapped; extern int radix_mmu; +extern int superpages_enabled; vm_offset_t pmap_early_io_map(vm_paddr_t pa, vm_size_t size); void pmap_early_io_unmap(vm_offset_t va, vm_size_t size); Modified: head/sys/powerpc/powerpc/pmap_dispatch.c == --- head/sys/powerpc/powerpc/pmap_dispatch.cTue Nov 17 10:57:28 2020 (r367757) +++ head/sys/powerpc/powerpc/pmap_dispatch.cTue Nov 17 11:36:31 2020 (r367758) @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -79,6 +80,12 @@ caddr_t crashdumpmap; int pmap_bootstrapped; /* Default level 0 reservations consist of 512 pages (2MB superpage). */ int vm_level_0_order = 9; + +SYSCTL_NODE(_vm, OID_AUTO, pmap, CTLFLAG_RD, 0, "VM/pmap parameters"); + +int superpages
svn commit: r367759 - head/usr.bin/chpass
Author: 0mp (doc,ports committer) Date: Tue Nov 17 12:04:29 2020 New Revision: 367759 URL: https://svnweb.freebsd.org/changeset/base/367759 Log: Add an example for the -s flag MFC after:2 weeks Modified: head/usr.bin/chpass/chpass.1 Modified: head/usr.bin/chpass/chpass.1 == --- head/usr.bin/chpass/chpass.1Tue Nov 17 11:36:31 2020 (r367758) +++ head/usr.bin/chpass/chpass.1Tue Nov 17 12:04:29 2020 (r367759) @@ -455,6 +455,12 @@ temporary copy of the password file .It Pa /etc/shells the list of approved shells .El +.Sh EXAMPLES +Change the shell of the current user to +.Ql /usr/local/bin/zsh : +.Bd -literal -offset indent +chsh -s /usr/local/bin/zsh +.Ed .Sh SEE ALSO .Xr finger 1 , .Xr login 1 , ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r367760 - head/sys/powerpc/powerpc
Author: alfredo Date: Tue Nov 17 12:33:12 2020 New Revision: 367760 URL: https://svnweb.freebsd.org/changeset/base/367760 Log: [POWERPC] fix signal race condition r367416 should have called save_fpu() before kern_sigprocmask to avoid race condition Thanks jhibbits and bdragon for pointing it out Reviewed by: jhibbits Sponsored by: Eldorado Research Institute (eldorado.org.br) Differential Revision:https://reviews.freebsd.org/D27241 Modified: head/sys/powerpc/powerpc/exec_machdep.c Modified: head/sys/powerpc/powerpc/exec_machdep.c == --- head/sys/powerpc/powerpc/exec_machdep.c Tue Nov 17 12:04:29 2020 (r367759) +++ head/sys/powerpc/powerpc/exec_machdep.c Tue Nov 17 12:33:12 2020 (r367760) @@ -334,8 +334,6 @@ sys_sigreturn(struct thread *td, struct sigreturn_args if (error != 0) return (error); - kern_sigprocmask(td, SIG_SETMASK, &uc.uc_sigmask, NULL, 0); - /* * Save FPU state if needed. User may have changed it on * signal handler @@ -343,6 +341,8 @@ sys_sigreturn(struct thread *td, struct sigreturn_args if (uc.uc_mcontext.mc_srr1 & PSL_FP) save_fpu(td); + kern_sigprocmask(td, SIG_SETMASK, &uc.uc_sigmask, NULL, 0); + CTR3(KTR_SIG, "sigreturn: return td=%p pc=%#x sp=%#x", td, uc.uc_mcontext.mc_srr0, uc.uc_mcontext.mc_gpr[1]); @@ -836,8 +836,6 @@ freebsd32_sigreturn(struct thread *td, struct freebsd3 if (error != 0) return (error); - kern_sigprocmask(td, SIG_SETMASK, &uc.uc_sigmask, NULL, 0); - /* * Save FPU state if needed. User may have changed it on * signal handler @@ -845,6 +843,7 @@ freebsd32_sigreturn(struct thread *td, struct freebsd3 if (uc.uc_mcontext.mc_srr1 & PSL_FP) save_fpu(td); + kern_sigprocmask(td, SIG_SETMASK, &uc.uc_sigmask, NULL, 0); CTR3(KTR_SIG, "sigreturn: return td=%p pc=%#x sp=%#x", td, uc.uc_mcontext.mc_srr0, uc.uc_mcontext.mc_gpr[1]); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r367761 - head/lib/msun/powerpc
Author: alfredo Date: Tue Nov 17 12:36:59 2020 New Revision: 367761 URL: https://svnweb.freebsd.org/changeset/base/367761 Log: [POWERPC] msun: fix incorrect flag in fesetexceptflag Fix incorrect mask being used when FE_INVALID bit is wanted by user. The problem was noticed thanks to msun fenv tests. Reviewed by: jhibbits, luporl Sponsored by: Eldorado Research Institute (eldorado.org.br) Differential Revision:https://reviews.freebsd.org/D27201 Modified: head/lib/msun/powerpc/fenv.h Modified: head/lib/msun/powerpc/fenv.h == --- head/lib/msun/powerpc/fenv.hTue Nov 17 12:33:12 2020 (r367760) +++ head/lib/msun/powerpc/fenv.hTue Nov 17 12:36:59 2020 (r367761) @@ -148,7 +148,7 @@ fesetexceptflag(const fexcept_t *__flagp, int __except union __fpscr __r; if (__excepts & FE_INVALID) - __excepts |= FE_ALL_EXCEPT; + __excepts |= FE_ALL_INVALID; __mffs(&__r); __r.__bits.__reg &= ~__excepts; __r.__bits.__reg |= *__flagp & __excepts; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r367762 - head/usr.sbin/bhyve
Author: grehan Date: Tue Nov 17 13:14:04 2020 New Revision: 367762 URL: https://svnweb.freebsd.org/changeset/base/367762 Log: Add legacy debug/test interfaces for kvm unit tests. Implement the legacy debug/test interfaces expected by KVM-unit-tests' realmode, emulator, and ioapic tests. Submitted by: adam_fenn.io Reviewed by: markj, grehan Approved by: grehan (bhyve) MFC after:3 weeks Relnotes: Yes Differential Revision:https://reviews.freebsd.org/D27130 Added: head/usr.sbin/bhyve/pctestdev.c (contents, props changed) head/usr.sbin/bhyve/pctestdev.h (contents, props changed) Modified: head/usr.sbin/bhyve/Makefile head/usr.sbin/bhyve/bhyve.8 head/usr.sbin/bhyve/pci_lpc.c Modified: head/usr.sbin/bhyve/Makefile == --- head/usr.sbin/bhyve/MakefileTue Nov 17 12:36:59 2020 (r367761) +++ head/usr.sbin/bhyve/MakefileTue Nov 17 13:14:04 2020 (r367762) @@ -56,6 +56,7 @@ SRCS= \ pci_virtio_scsi.c \ pci_uart.c \ pci_xhci.c \ + pctestdev.c \ pm.c\ post.c \ ps2kbd.c\ Modified: head/usr.sbin/bhyve/bhyve.8 == --- head/usr.sbin/bhyve/bhyve.8 Tue Nov 17 12:36:59 2020(r367761) +++ head/usr.sbin/bhyve/bhyve.8 Tue Nov 17 13:14:04 2020(r367762) @@ -169,9 +169,11 @@ Allow devices behind the LPC PCI-ISA bridge to be conf The only supported devices are the TTY-class devices .Ar com1 and -.Ar com2 -and the boot ROM device -.Ar bootrom . +.Ar com2 , +the boot ROM device +.Ar bootrom , +and the debug/test device +.Ar pc-testdev . .Pp .Ar help print a list of supported LPC devices. @@ -277,7 +279,8 @@ Intel e82545 network interface. .It Li uart PCI 16550 serial device. .It Li lpc -LPC PCI-ISA bridge with COM1 and COM2 16550 serial ports and a boot ROM. +LPC PCI-ISA bridge with COM1 and COM2 16550 serial ports, a boot ROM, and, +optionally, the debug/test device. The LPC bridge emulation can only be configured on bus 0. .It Li fbuf Raw framebuffer device attached to VNC server. Modified: head/usr.sbin/bhyve/pci_lpc.c == --- head/usr.sbin/bhyve/pci_lpc.c Tue Nov 17 12:36:59 2020 (r367761) +++ head/usr.sbin/bhyve/pci_lpc.c Tue Nov 17 13:14:04 2020 (r367762) @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include "pci_emul.h" #include "pci_irq.h" #include "pci_lpc.h" +#include "pctestdev.h" #include "uart_emul.h" #defineIO_ICU1 0x20 @@ -80,6 +81,8 @@ static struct lpc_uart_softc { static const char *lpc_uart_names[LPC_UART_NUM] = { "COM1", "COM2" }; +static bool pctestdev_present; + /* * LPC device configuration is in the following form: * [,] @@ -107,6 +110,18 @@ lpc_device_parse(const char *opts) goto done; } } + if (strcasecmp(lpcdev, pctestdev_getname()) == 0) { + if (pctestdev_present) { + EPRINTLN("More than one %s device conf is " + "specified; only one is allowed.", + pctestdev_getname()); + } else if (pctestdev_parse(str) == 0) { + pctestdev_present = true; + error = 0; + free(cpy); + goto done; + } + } } done: @@ -124,6 +139,7 @@ lpc_print_supported_devices() printf("bootrom\n"); for (i = 0; i < LPC_UART_NUM; i++) printf("%s\n", lpc_uart_names[i]); + printf("%s\n", pctestdev_getname()); } const char * @@ -230,6 +246,13 @@ lpc_init(struct vmctx *ctx) error = register_inout(&iop); assert(error == 0); sc->enabled = 1; + } + + /* pc-testdev */ + if (pctestdev_present) { + error = pctestdev_init(ctx); + if (error) + return (error); } return (0); Added: head/usr.sbin/bhyve/pctestdev.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/bhyve/pctestdev.c Tue Nov 17 13:14:04 2020 (r367762) @@ -0,0 +1,270 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2020 Adam Fenn + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the
svn commit: r367763 - head/cddl/contrib/opensolaris/common/ctf
Author: jtl Date: Tue Nov 17 14:07:27 2020 New Revision: 367763 URL: https://svnweb.freebsd.org/changeset/base/367763 Log: When copying types from one CTF container to another, ensure that we always copy intrinsic data types before copying bitfields which are based on those types. This ensures the type ordering in the destination CTF container matches the assumption made elsewhere in the CTF code that instrinsic data types will always appear before bitfields based on those types. This resolves the following error message some users have seen after r366908: "/usr/lib/dtrace/ipfw.d", line 121: failed to copy type of 'ip6p': Conflicting type is already defined Reviewed by: markj Sponsored by: Netflix Differential Revision:https://reviews.freebsd.org/D27213 Modified: head/cddl/contrib/opensolaris/common/ctf/ctf_create.c Modified: head/cddl/contrib/opensolaris/common/ctf/ctf_create.c == --- head/cddl/contrib/opensolaris/common/ctf/ctf_create.c Tue Nov 17 13:14:04 2020(r367762) +++ head/cddl/contrib/opensolaris/common/ctf/ctf_create.c Tue Nov 17 14:07:27 2020(r367763) @@ -1258,7 +1258,7 @@ ctf_add_type(ctf_file_t *dst_fp, ctf_file_t *src_fp, c uint_t kind, flag, vlen; ctf_bundle_t src, dst; - ctf_encoding_t src_en, dst_en; + ctf_encoding_t src_en, main_en, dst_en; ctf_arinfo_t src_ar, dst_ar; ctf_dtdef_t *dtd; @@ -1372,6 +1372,27 @@ ctf_add_type(ctf_file_t *dst_fp, ctf_file_t *src_fp, c case CTF_K_FLOAT: if (ctf_type_encoding(src_fp, src_type, &src_en) != 0) return (ctf_set_errno(dst_fp, ctf_errno(src_fp))); + + /* +* This could be a bitfield, and the CTF library assumes +* intrinsics will appear before bitfields. Therefore, +* try to copy over the intrinsic prior to copying the +* bitfield. +*/ + if (dst_type == CTF_ERR && name[0] != '\0' && + (hep = ctf_hash_lookup(&src_fp->ctf_names, src_fp, name, + strlen(name))) != NULL && + src_type != (ctf_id_t)hep->h_type) { + if (ctf_type_encoding(src_fp, (ctf_id_t)hep->h_type, + &main_en) != 0) { + return (ctf_set_errno(dst_fp, + ctf_errno(src_fp))); + } + if (bcmp(&src_en, &main_en, sizeof (ctf_encoding_t)) && + ctf_add_type(dst_fp, src_fp, + (ctf_id_t)hep->h_type) == CTF_ERR) + return (CTF_ERR); /* errno is set for us */ + } if (dst_type != CTF_ERR) { if (ctf_type_encoding(dst_fp, dst_type, &dst_en) != 0) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r367763 - head/cddl/contrib/opensolaris/common/ctf
On Tue, Nov 17, 2020 at 9:07 AM Jonathan T. Looney wrote: > Author: jtl > Date: Tue Nov 17 14:07:27 2020 > New Revision: 367763 > URL: https://svnweb.freebsd.org/changeset/base/367763 > > Log: > When copying types from one CTF container to another, ensure that we > always copy intrinsic data types before copying bitfields which are > based on those types. This ensures the type ordering in the destination > CTF container matches the assumption made elsewhere in the CTF code > that instrinsic data types will always appear before bitfields based on > those types. > > This resolves the following error message some users have seen after > r366908: > "/usr/lib/dtrace/ipfw.d", line 121: failed to copy type of 'ip6p': > Conflicting type is already defined > > Reviewed by: markj > Sponsored by: Netflix > Differential Revision:https://reviews.freebsd.org/D27213 FWIW, this should also have said: MFC after: 2 weeks ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r367713 - head/sys/kern
On 11/17/20, Konstantin Belousov wrote: > On Tue, Nov 17, 2020 at 04:15:12AM +0100, Mateusz Guzik wrote: >> On 11/17/20, Konstantin Belousov wrote: >> > On Mon, Nov 16, 2020 at 03:09:19AM +, Mateusz Guzik wrote: >> >> Author: mjg >> >> Date: Mon Nov 16 03:09:18 2020 >> >> New Revision: 367713 >> >> URL: https://svnweb.freebsd.org/changeset/base/367713 >> >> >> >> Log: >> >> select: replace reference counting with memory barriers in selfd >> >> >> >> Refcounting was added to combat a race between selfdfree and >> >> doselwakup, >> >> but it adds avoidable overhead. >> >> >> >> selfdfree detects it can free the object by ->sf_si == NULL, thus we >> >> can >> >> ensure that the condition only holds after all accesses are >> >> completed. >> >> >> >> Modified: >> >> head/sys/kern/sys_generic.c >> >> >> >> Modified: head/sys/kern/sys_generic.c >> >> == >> >> --- head/sys/kern/sys_generic.c Sun Nov 15 22:49:28 2020 >> >> (r367712) >> >> +++ head/sys/kern/sys_generic.c Mon Nov 16 03:09:18 2020 >> >> (r367713) >> >> @@ -156,7 +156,6 @@ struct selfd { >> >> struct mtx *sf_mtx;/* Pointer to selinfo mtx. */ >> >> struct seltd*sf_td; /* (k) owning seltd. */ >> >> void*sf_cookie; /* (k) fd or pollfd. */ >> >> - u_int sf_refs; >> >> }; >> >> >> >> MALLOC_DEFINE(M_SELFD, "selfd", "selfd"); >> >> @@ -1704,16 +1703,17 @@ static void >> >> selfdfree(struct seltd *stp, struct selfd *sfp) >> >> { >> >> STAILQ_REMOVE(&stp->st_selq, sfp, selfd, sf_link); >> >> - if (sfp->sf_si != NULL) { >> >> + /* >> >> + * Paired with doselwakeup. >> >> + */ >> >> + if (atomic_load_acq_ptr((uintptr_t *)&sfp->sf_si) != (uintptr_t)NULL) >> >> { >> > This could be != 0. >> > >> >> mtx_lock(sfp->sf_mtx); >> >> if (sfp->sf_si != NULL) { >> >> TAILQ_REMOVE(&sfp->sf_si->si_tdlist, sfp, sf_threads); >> >> - refcount_release(&sfp->sf_refs); >> >> } >> >> mtx_unlock(sfp->sf_mtx); >> >> } >> >> - if (refcount_release(&sfp->sf_refs)) >> >> - free(sfp, M_SELFD); >> >> + free(sfp, M_SELFD); >> > What guarantees that doselwakeup() finished with sfp ? >> > >> >> Release semantics provided by atomic_store_rel_ptr -- it means the >> NULL store is the last access, neither CPU nor the compiler are going >> to reorder preceding loads/stores past it. > It only guarantees that if we observed NULL as the result of load. > If that did not happen selfdfree takes the lock. If the entry is still there, it removes it and doselwakeup will not see it after it takes the lock. If the entry is not there, doselwaekup is done with it because it released the lock. -- Mateusz Guzik ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r367764 - in head/sys/contrib/vchiq/interface: compat vchiq_arm
Author: manu Date: Tue Nov 17 14:41:23 2020 New Revision: 367764 URL: https://svnweb.freebsd.org/changeset/base/367764 Log: vchiq: Rename timer func so they do not conflict with linuxkpi Modified: head/sys/contrib/vchiq/interface/compat/vchi_bsd.c head/sys/contrib/vchiq/interface/compat/vchi_bsd.h head/sys/contrib/vchiq/interface/vchiq_arm/vchiq_arm.c Modified: head/sys/contrib/vchiq/interface/compat/vchi_bsd.c == --- head/sys/contrib/vchiq/interface/compat/vchi_bsd.c Tue Nov 17 14:07:27 2020(r367763) +++ head/sys/contrib/vchiq/interface/compat/vchi_bsd.c Tue Nov 17 14:41:23 2020(r367764) @@ -77,7 +77,7 @@ run_timer(void *arg) } void -init_timer(struct timer_list *t) +vchiq_init_timer(struct timer_list *t) { mtx_init(&t->mtx, "dahdi timer lock", NULL, MTX_SPIN); callout_init(&t->callout, 1); @@ -89,15 +89,15 @@ init_timer(struct timer_list *t) } void -setup_timer(struct timer_list *t, void (*function)(unsigned long), unsigned long data) +vchiq_setup_timer(struct timer_list *t, void (*function)(unsigned long), unsigned long data) { t->function = function; t->data = data; - init_timer(t); + vchiq_init_timer(t); } void -mod_timer(struct timer_list *t, unsigned long expires) +vchiq_mod_timer(struct timer_list *t, unsigned long expires) { mtx_lock_spin(&t->mtx); callout_reset(&t->callout, expires - jiffies, run_timer, t); @@ -105,13 +105,13 @@ mod_timer(struct timer_list *t, unsigned long expires) } void -add_timer(struct timer_list *t) +vchiq_add_timer(struct timer_list *t) { - mod_timer(t, t->expires); + vchiq_mod_timer(t, t->expires); } int -del_timer_sync(struct timer_list *t) +vchiq_del_timer_sync(struct timer_list *t) { mtx_lock_spin(&t->mtx); callout_stop(&t->callout); @@ -122,9 +122,9 @@ del_timer_sync(struct timer_list *t) } int -del_timer(struct timer_list *t) +vchiq_del_timer(struct timer_list *t) { - del_timer_sync(t); + vchiq_del_timer_sync(t); return 0; } Modified: head/sys/contrib/vchiq/interface/compat/vchi_bsd.h == --- head/sys/contrib/vchiq/interface/compat/vchi_bsd.h Tue Nov 17 14:07:27 2020(r367763) +++ head/sys/contrib/vchiq/interface/compat/vchi_bsd.h Tue Nov 17 14:41:23 2020(r367764) @@ -196,12 +196,12 @@ struct timer_list { unsigned long data; }; -void init_timer(struct timer_list *t); -void setup_timer(struct timer_list *t, void (*function)(unsigned long), unsigned long data); -void mod_timer(struct timer_list *t, unsigned long expires); -void add_timer(struct timer_list *t); -int del_timer(struct timer_list *t); -int del_timer_sync(struct timer_list *t); +void vchiq_init_timer(struct timer_list *t); +void vchiq_setup_timer(struct timer_list *t, void (*function)(unsigned long), unsigned long data); +void vchiq_mod_timer(struct timer_list *t, unsigned long expires); +void vchiq_add_timer(struct timer_list *t); +int vchiq_del_timer(struct timer_list *t); +int vchiq_del_timer_sync(struct timer_list *t); /* * Completion API Modified: head/sys/contrib/vchiq/interface/vchiq_arm/vchiq_arm.c == --- head/sys/contrib/vchiq/interface/vchiq_arm/vchiq_arm.c Tue Nov 17 14:07:27 2020(r367763) +++ head/sys/contrib/vchiq/interface/vchiq_arm/vchiq_arm.c Tue Nov 17 14:41:23 2020(r367764) @@ -1754,7 +1754,7 @@ vchiq_arm_init_state(VCHIQ_STATE_T *state, VCHIQ_ARM_S arm_state->suspend_timer_timeout = SUSPEND_TIMER_TIMEOUT_MS; arm_state->suspend_timer_running = 0; - init_timer(&arm_state->suspend_timer); + vchiq_init_timer(&arm_state->suspend_timer); arm_state->suspend_timer.data = (unsigned long)(state); arm_state->suspend_timer.function = suspend_timer_callback; @@ -1892,11 +1892,11 @@ set_resume_state(VCHIQ_ARM_STATE_T *arm_state, inline void start_suspend_timer(VCHIQ_ARM_STATE_T *arm_state) { - del_timer(&arm_state->suspend_timer); + vchiq_del_timer(&arm_state->suspend_timer); arm_state->suspend_timer.expires = jiffies + msecs_to_jiffies(arm_state-> suspend_timer_timeout); - add_timer(&arm_state->suspend_timer); + vchiq_add_timer(&arm_state->suspend_timer); arm_state->suspend_timer_running = 1; } @@ -1905,7 +1905,7 @@ static inline void stop_suspend_timer(VCHIQ_ARM_STATE_T *arm_state) { if (arm_state->suspend_timer_running) { - del_timer(&arm_state->suspend_timer); + vchiq_del_timer(&arm_state->suspend_timer); arm_state->suspend_timer_running = 0; } } ___ svn-s
svn commit: r367765 - head/sys/arm/allwinner/clkng
Author: manu Date: Tue Nov 17 14:57:34 2020 New Revision: 367765 URL: https://svnweb.freebsd.org/changeset/base/367765 Log: arm: allwinner: Add DE2 Clock support for H3 SoC While here also enable the clock and deassert the reset Modified: head/sys/arm/allwinner/clkng/ccu_de2.c Modified: head/sys/arm/allwinner/clkng/ccu_de2.c == --- head/sys/arm/allwinner/clkng/ccu_de2.c Tue Nov 17 14:41:23 2020 (r367764) +++ head/sys/arm/allwinner/clkng/ccu_de2.c Tue Nov 17 14:57:34 2020 (r367765) @@ -43,30 +43,52 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef __aarch64__ #include "opt_soc.h" +#endif #include #include #include +#include + #include #include #include +enum CCU_DE2 { + H3_CCU = 1, + A64_CCU, +}; + /* Non exported clocks */ #defineCLK_MIXER0_DIV 3 #defineCLK_MIXER1_DIV 4 #defineCLK_WB_DIV 5 -static struct aw_ccung_reset de2_ccu_resets[] = { +static struct aw_ccung_reset h3_de2_ccu_resets[] = { CCU_RESET(RST_MIXER0, 0x08, 0) + CCU_RESET(RST_WB, 0x08, 2) +}; + +static struct aw_ccung_reset a64_de2_ccu_resets[] = { + CCU_RESET(RST_MIXER0, 0x08, 0) CCU_RESET(RST_MIXER1, 0x08, 1) CCU_RESET(RST_WB, 0x08, 2) }; -static struct aw_ccung_gate de2_ccu_gates[] = { +static struct aw_ccung_gate h3_de2_ccu_gates[] = { CCU_GATE(CLK_BUS_MIXER0, "mixer0", "mixer0-div", 0x00, 0) + CCU_GATE(CLK_BUS_WB, "wb", "wb-div", 0x00, 2) + + CCU_GATE(CLK_MIXER0, "bus-mixer0", "bus-de", 0x04, 0) + CCU_GATE(CLK_WB, "bus-wb", "bus-de", 0x04, 2) +}; + +static struct aw_ccung_gate a64_de2_ccu_gates[] = { + CCU_GATE(CLK_BUS_MIXER0, "mixer0", "mixer0-div", 0x00, 0) CCU_GATE(CLK_BUS_MIXER1, "mixer1", "mixer1-div", 0x00, 1) CCU_GATE(CLK_BUS_WB, "wb", "wb-div", 0x00, 2) @@ -95,7 +117,7 @@ NM_CLK(mixer1_div_clk, 4, 4, 0, 0,/* M flags */ 0, 0, /* mux */ 0, /* gate */ -AW_CLK_SCALE_CHANGE); /* flags */ +AW_CLK_SCALE_CHANGE); /* flags */ NM_CLK(wb_div_clk, CLK_WB_DIV,/* id */ @@ -105,16 +127,22 @@ NM_CLK(wb_div_clk, 8, 4, 0, 0,/* M flags */ 0, 0, /* mux */ 0, /* gate */ -AW_CLK_SCALE_CHANGE); /* flags */ +AW_CLK_SCALE_CHANGE); /* flags */ -static struct aw_ccung_clk de2_ccu_clks[] = { +static struct aw_ccung_clk h3_de2_ccu_clks[] = { { .type = AW_CLK_NM, .clk.nm = &mixer0_div_clk}, + { .type = AW_CLK_NM, .clk.nm = &wb_div_clk}, +}; + +static struct aw_ccung_clk a64_de2_ccu_clks[] = { + { .type = AW_CLK_NM, .clk.nm = &mixer0_div_clk}, { .type = AW_CLK_NM, .clk.nm = &mixer1_div_clk}, { .type = AW_CLK_NM, .clk.nm = &wb_div_clk}, }; static struct ofw_compat_data compat_data[] = { - {"allwinner,sun50i-a64-de2-clk", 1}, + {"allwinner,sun8i-h3-de2-clk", H3_CCU}, + {"allwinner,sun50i-a64-de2-clk", A64_CCU}, {NULL, 0} }; @@ -136,15 +164,61 @@ static int ccu_de2_attach(device_t dev) { struct aw_ccung_softc *sc; + phandle_t node; + clk_t mod, bus; + hwreset_t rst_de; + enum CCU_DE2 type; sc = device_get_softc(dev); + node = ofw_bus_get_node(dev); - sc->resets = de2_ccu_resets; - sc->nresets = nitems(de2_ccu_resets); - sc->gates = de2_ccu_gates; - sc->ngates = nitems(de2_ccu_gates); - sc->clks = de2_ccu_clks; - sc->nclks = nitems(de2_ccu_clks); + type = (enum CCU_DE2)ofw_bus_search_compatible(dev, compat_data)->ocd_data; + + switch (type) { + case H3_CCU: + sc->resets = h3_de2_ccu_resets; + sc->nresets = nitems(h3_de2_ccu_resets); + sc->gates = h3_de2_ccu_gates; + sc->ngates = nitems(h3_de2_ccu_gates); + sc->clks = h3_de2_ccu_clks; + sc->nclks = nitems(h3_de2_ccu_clks); + break; + case A64_CCU: + sc->resets = a64_de2_ccu_resets; + sc->nresets = nitems(a64_de2_ccu_resets); + sc->gates = a64_de2_ccu_gates; + sc->ngates = nitems(a64_de2_ccu_gates); + sc->clks = a64_de2_ccu_clks; + sc->nclks = nitems(a64_de2_ccu_clks); + break; + } + + if (hwreset_get_by_ofw_idx(dev, node, 0, &rst_de) != 0) { + device_printf(dev, "Cannot get de reset\n"); + return (ENXIO); + } + if (hwreset_deassert(rst_de) != 0) { + device_printf(dev, "Cannot de-assert de reset\n"); + return (ENXIO); + } + + if (clk_get_by_ofw_name(dev, node, "mo
svn commit: r367766 - head/sys/arm/allwinner/clkng
Author: manu Date: Tue Nov 17 14:58:30 2020 New Revision: 367766 URL: https://svnweb.freebsd.org/changeset/base/367766 Log: arm64: allwinner: Init the Display Engine clock In case u-boot was compiled without video support set the PLL to 432Mhz (which allow us to use most of the HDMI resolution for tcon) and set it as the parent for the DE clock. Modified: head/sys/arm/allwinner/clkng/ccu_a64.c Modified: head/sys/arm/allwinner/clkng/ccu_a64.c == --- head/sys/arm/allwinner/clkng/ccu_a64.c Tue Nov 17 14:57:34 2020 (r367765) +++ head/sys/arm/allwinner/clkng/ccu_a64.c Tue Nov 17 14:58:30 2020 (r367766) @@ -789,6 +789,8 @@ static struct aw_clk_init a64_init_clks[] = { {"ahb1", "pll_periph0", 0, false}, {"ahb2", "pll_periph0", 0, false}, {"dram", "pll_ddr0", 0, false}, + {"pll_de", NULL, 43200, true}, + {"de", "pll_de", 0, true}, }; static int ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r367767 - head/sys/dev/extres/syscon
Author: manu Date: Tue Nov 17 14:59:58 2020 New Revision: 367767 URL: https://svnweb.freebsd.org/changeset/base/367767 Log: syscon: Add syscon_get_by_ofw_node This allow to get a syscon node defined under a specific fdt node (which isn't always the device one). Modified: head/sys/dev/extres/syscon/syscon.c head/sys/dev/extres/syscon/syscon.h Modified: head/sys/dev/extres/syscon/syscon.c == --- head/sys/dev/extres/syscon/syscon.c Tue Nov 17 14:58:30 2020 (r367766) +++ head/sys/dev/extres/syscon/syscon.c Tue Nov 17 14:59:58 2020 (r367767) @@ -264,6 +264,21 @@ syscon_get_ofw_node(struct syscon *syscon) } int +syscon_get_by_ofw_node(device_t cdev, phandle_t node, struct syscon **syscon) +{ + + SYSCON_TOPO_SLOCK(); + *syscon = syscon_find_by_ofw_node(node); + if (*syscon == NULL) { + SYSCON_TOPO_UNLOCK(); + device_printf(cdev, "Failed to find syscon node\n"); + return (ENODEV); + } + SYSCON_TOPO_UNLOCK(); + return (0); +} + +int syscon_get_by_ofw_property(device_t cdev, phandle_t cnode, char *name, struct syscon **syscon) { Modified: head/sys/dev/extres/syscon/syscon.h == --- head/sys/dev/extres/syscon/syscon.h Tue Nov 17 14:58:30 2020 (r367766) +++ head/sys/dev/extres/syscon/syscon.h Tue Nov 17 14:59:58 2020 (r367767) @@ -73,6 +73,7 @@ struct syscon *syscon_create_ofw_node(device_t pdev, phandle_t syscon_get_ofw_node(struct syscon *syscon); int syscon_get_by_ofw_property(device_t consumer, phandle_t node, char *name, struct syscon **syscon); +int syscon_get_by_ofw_node(device_t cdev, phandle_t node, struct syscon **syscon); #endif #endif /* DEV_SYSCON_H */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r367768 - in head/sbin/nvmecontrol: . modules/wdc
Author: mav Date: Tue Nov 17 16:34:58 2020 New Revision: 367768 URL: https://svnweb.freebsd.org/changeset/base/367768 Log: Stop using NVME_MAX_XFER_SIZE constant. This constant depends on MAXPHYS and does not respect device capabilities. Use proper dynamic ioctl(NVME_GET_MAX_XFER_SIZE) instead. MFC after:1 month Modified: head/sbin/nvmecontrol/firmware.c head/sbin/nvmecontrol/modules/wdc/wdc.c Modified: head/sbin/nvmecontrol/firmware.c == --- head/sbin/nvmecontrol/firmware.cTue Nov 17 14:59:58 2020 (r367767) +++ head/sbin/nvmecontrol/firmware.cTue Nov 17 16:34:58 2020 (r367768) @@ -166,12 +166,10 @@ update_firmware(int fd, uint8_t *payload, int32_t payl off = 0; resid = payload_size; - if (fwug != 0 && fwug != 0xFF) - max_xfer_size = ((uint64_t)fwug << 12); - else if (ioctl(fd, NVME_GET_MAX_XFER_SIZE, &max_xfer_size) < 0) + if (ioctl(fd, NVME_GET_MAX_XFER_SIZE, &max_xfer_size) < 0) err(EX_IOERR, "query max transfer size failed"); - if (max_xfer_size > NVME_MAX_XFER_SIZE) - max_xfer_size = NVME_MAX_XFER_SIZE; + if (fwug != 0 && fwug != 0xFF) + max_xfer_size = MIN(max_xfer_size, (uint64_t)fwug << 12); if ((chunk = aligned_alloc(PAGE_SIZE, max_xfer_size)) == NULL) errx(EX_OSERR, "unable to malloc %zd bytes", (size_t)max_xfer_size); Modified: head/sbin/nvmecontrol/modules/wdc/wdc.c == --- head/sbin/nvmecontrol/modules/wdc/wdc.c Tue Nov 17 14:59:58 2020 (r367767) +++ head/sbin/nvmecontrol/modules/wdc/wdc.c Tue Nov 17 16:34:58 2020 (r367768) @@ -165,6 +165,7 @@ wdc_do_dump_e6(int fd, char *tmpl, const char *suffix, int first; int fd2; uint8_t *buf, *hdr; + uint64_t max_xfer_size; uint32_t len, offset; size_t resid; bool e6lg_flag = false; @@ -186,15 +187,17 @@ wdc_do_dump_e6(int fd, char *tmpl, const char *suffix, fd2 = open(tmpl, O_WRONLY | O_CREAT | O_TRUNC, 0644); if (fd2 < 0) err(EX_CANTCREAT, "open %s", tmpl); - buf = aligned_alloc(PAGE_SIZE, NVME_MAX_XFER_SIZE); + if (ioctl(fd, NVME_GET_MAX_XFER_SIZE, &max_xfer_size) < 0) + err(EX_IOERR, "query max transfer size failed"); + buf = aligned_alloc(PAGE_SIZE, max_xfer_size); if (buf == NULL) errx(EX_OSERR, "Can't get buffer to read dump"); offset = 0; - len = NVME_MAX_XFER_SIZE; + len = max_xfer_size; first = 1; do { - resid = len > NVME_MAX_XFER_SIZE ? NVME_MAX_XFER_SIZE : len; + resid = MIN(len, max_xfer_size); wdc_get_data(fd, opcode, resid, offset, cmd, buf, resid, e6lg_flag); if (first) { @@ -321,6 +324,7 @@ wdc_do_dump_dui(int fd, char *tmpl, uint8_t data_area, { int fd2, first; uint8_t *buf; + uint64_t max_xfer_size; uint16_t hdr_ver; uint64_t log_len, offset; size_t resid; @@ -332,14 +336,16 @@ wdc_do_dump_dui(int fd, char *tmpl, uint8_t data_area, fd2 = open(tmpl, O_WRONLY | O_CREAT | O_TRUNC, 0644); if (fd2 < 0) err(EX_CANTCREAT, "open %s", tmpl); - buf = aligned_alloc(PAGE_SIZE, NVME_MAX_XFER_SIZE); + if (ioctl(fd, NVME_GET_MAX_XFER_SIZE, &max_xfer_size) < 0) + err(EX_IOERR, "query max transfer size failed"); + buf = aligned_alloc(PAGE_SIZE, max_xfer_size); if (buf == NULL) errx(EX_OSERR, "Can't get buffer to read dump"); offset = 0; first = 1; while (log_len > 0) { - resid = log_len > NVME_MAX_XFER_SIZE ? NVME_MAX_XFER_SIZE : log_len; + resid = MIN(log_len, max_xfer_size); wdc_get_data_dui(fd, opcode, resid, offset, buf, resid); if (first) { hdr_ver = ((buf[len_off] & 0xF) != 0) ? ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r367769 - head/usr.bin/chpass
Author: 0mp (doc,ports committer) Date: Tue Nov 17 16:54:12 2020 New Revision: 367769 URL: https://svnweb.freebsd.org/changeset/base/367769 Log: Partially revert r367756 (chpass(1) synopsis changes) Let's have two entries in the synopsis: - chpass now lists options which can be used for non-NIS-specific functionalities. - ypchpass additionally lists the NIS-specific flags. Technically, it is an artificial distinction, as chpass and ypchpass behave identically. Nevertheless, it might help navigating the synopsis section. Reviewed by: imp MFC after:2 weeks Differential Revision:https://reviews.freebsd.org/D27251 Modified: head/usr.bin/chpass/chpass.1 Modified: head/usr.bin/chpass/chpass.1 == --- head/usr.bin/chpass/chpass.1Tue Nov 17 16:34:58 2020 (r367768) +++ head/usr.bin/chpass/chpass.1Tue Nov 17 16:54:12 2020 (r367769) @@ -40,7 +40,13 @@ .Nm ypchsh .Nd add or change user database information .Sh SYNOPSIS -.Nm +.Nm chpass +.Op Fl a Ar list +.Op Fl e Ar expiretime +.Op Fl p Ar encpass +.Op Fl s Ar newshell +.Op user +.Nm ypchpass .Op Fl loy .Op Fl a Ar list .Op Fl d Ar domain ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r367744 - in head/sys: compat/freebsd32 kern sys
On Tue, Nov 17, 2020 at 03:36:58AM +, Kyle Evans wrote: > Modified: head/sys/compat/freebsd32/freebsd32.h > == > --- head/sys/compat/freebsd32/freebsd32.h Tue Nov 17 03:34:01 2020 > (r367743) > +++ head/sys/compat/freebsd32/freebsd32.h Tue Nov 17 03:36:58 2020 > (r367744) > @@ -94,6 +94,27 @@ struct itimerval32 { > struct timeval32 it_value; > }; > > +struct umtx_time32 { > + struct timespec32 _timeout; > + uint32_t_flags; > + uint32_t_clockid; > +}; > + > +struct umtx_robust_lists_params_compat32 { > + uint32_trobust_list_offset; > + uint32_trobust_priv_list_offset; > + uint32_trobust_inact_offset; > +}; > + > +struct umutex32 { > + volatile __lwpid_t m_owner;/* Owner of the mutex */ > + __uint32_t m_flags;/* Flags of the mutex */ > + __uint32_t m_ceilings[2]; /* Priority protect ceiling */ > + __uint32_t m_rb_lnk; /* Robust linkage */ > + __uint32_t m_pad; > + __uint32_t m_spare[2]; > +}; > + > #define FREEBSD4_MFSNAMELEN 16 > #define FREEBSD4_MNAMELEN(88 - 2 * sizeof(int32_t)) > > > Modified: head/sys/compat/freebsd32/freebsd32_misc.c > == > --- head/sys/compat/freebsd32/freebsd32_misc.cTue Nov 17 03:34:01 > 2020(r367743) > +++ head/sys/compat/freebsd32/freebsd32_misc.cTue Nov 17 03:36:58 > 2020(r367744) > @@ -84,6 +84,7 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#include > #include > #include > #include > @@ -3764,4 +3765,12 @@ freebsd32_sched_rr_get_interval(struct thread *td, > error = copyout(&ts32, uap->interval, sizeof(ts32)); > } > return (error); > +} > + > +int > +freebsd32__umtx_op(struct thread *td, struct freebsd32__umtx_op_args *uap) > +{ > + > + return (kern__umtx_op(td, uap->obj, uap->op, uap->val, uap->uaddr, > + uap->uaddr2, &umtx_native_ops32)); > } > Putting any of this under compat/freebsd32 seems like a somewhat odd choice since all the work is done in kern_umtx.h. In CheriBSD, everything just lives there so nothing has to be exposed in headers. -- Brooks signature.asc Description: PGP signature
svn commit: r367770 - head/sys/cddl/contrib/opensolaris/common/lz4
Author: adrian Date: Tue Nov 17 17:11:07 2020 New Revision: 367770 URL: https://svnweb.freebsd.org/changeset/base/367770 Log: [cddl] Fix lz4 function definitions to not tri pup compile. This tripped up in llvm compilation on amd64 noting that lz4_init/lz4_fini were lacking in being previously defined. Reviewed by: emaste, freqlabs, brooks Differential Revision:https://reviews.freebsd.org/D27240 Modified: head/sys/cddl/contrib/opensolaris/common/lz4/lz4.c head/sys/cddl/contrib/opensolaris/common/lz4/lz4.h Modified: head/sys/cddl/contrib/opensolaris/common/lz4/lz4.c == --- head/sys/cddl/contrib/opensolaris/common/lz4/lz4.c Tue Nov 17 16:54:12 2020(r367769) +++ head/sys/cddl/contrib/opensolaris/common/lz4/lz4.c Tue Nov 17 17:11:07 2020(r367770) @@ -1024,7 +1024,7 @@ LZ4_uncompress_unknownOutputSize(const char *source, c } #if defined(_KERNEL) || defined(_FAKE_KERNEL) -extern void +void lz4_init(void) { @@ -1034,7 +1034,7 @@ lz4_init(void) #endif } -extern void +void lz4_fini(void) { Modified: head/sys/cddl/contrib/opensolaris/common/lz4/lz4.h == --- head/sys/cddl/contrib/opensolaris/common/lz4/lz4.h Tue Nov 17 16:54:12 2020(r367769) +++ head/sys/cddl/contrib/opensolaris/common/lz4/lz4.h Tue Nov 17 17:11:07 2020(r367770) @@ -43,6 +43,11 @@ extern "C" { extern size_t lz4_compress(void *, void *, size_t, size_t, int); extern int lz4_decompress(void *, void *, size_t, size_t, int); +#if defined(_KERNEL) || defined(_FAKE_KERNEL) +extern void lz4_init(void); +extern void lz4_fini(void); +#endif + #ifdef __cplusplus } #endif ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r367771 - head/sbin/nvmecontrol
Author: adrian Date: Tue Nov 17 17:12:28 2020 New Revision: 367771 URL: https://svnweb.freebsd.org/changeset/base/367771 Log: [nvmecontrol] Fix type signedness warning-to-error on gcc-6.4 This fixes a type signedness comparison warning-to-error on gcc-6.4. The ternary operation casts it right but the actual assignment doesn't. Reviewed by: imp Differential Revision:https://reviews.freebsd.org/D26791 Modified: head/sbin/nvmecontrol/firmware.c Modified: head/sbin/nvmecontrol/firmware.c == --- head/sbin/nvmecontrol/firmware.cTue Nov 17 17:11:07 2020 (r367770) +++ head/sbin/nvmecontrol/firmware.cTue Nov 17 17:12:28 2020 (r367771) @@ -159,8 +159,9 @@ static void update_firmware(int fd, uint8_t *payload, int32_t payload_size, uint8_t fwug) { struct nvme_pt_command pt; - uint64_tmax_xfer_size; - int32_t off, resid, size; + uint64_tmax_xfer_size; + int32_t off; + uint32_tresid, size; void*chunk; off = 0; @@ -175,8 +176,7 @@ update_firmware(int fd, uint8_t *payload, int32_t payl errx(EX_OSERR, "unable to malloc %zd bytes", (size_t)max_xfer_size); while (resid > 0) { - size = (resid >= (int32_t)max_xfer_size) ? - max_xfer_size : resid; + size = (resid >= max_xfer_size) ? max_xfer_size : resid; memcpy(chunk, payload + off, size); memset(&pt, 0, sizeof(pt)); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r367694 - in head/sys: kern sys
On 11/14/20 11:21 AM, Mateusz Guzik wrote: > Author: mjg > Date: Sat Nov 14 19:21:46 2020 > New Revision: 367694 > URL: https://svnweb.freebsd.org/changeset/base/367694 > > Log: > thread: batch resource limit free calls > > Modified: > head/sys/kern/kern_resource.c > head/sys/kern/kern_thread.c > head/sys/sys/resourcevar.h > > Modified: head/sys/kern/kern_resource.c > == > --- head/sys/kern/kern_resource.c Sat Nov 14 19:20:58 2020 > (r367693) > +++ head/sys/kern/kern_resource.c Sat Nov 14 19:21:46 2020 > (r367694) > @@ -1236,6 +1236,14 @@ lim_free(struct plimit *limp) > free((void *)limp, M_PLIMIT); > } > > +void > +lim_freen(struct plimit *limp, int n) > +{ > + > + if (refcount_releasen(&limp->pl_refcnt, n)) > + free((void *)limp, M_PLIMIT); You don't need this cast. -- John Baldwin ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r367695 - in head/sys: kern sys
On 11/14/20 11:22 AM, Mateusz Guzik wrote: > Author: mjg > Date: Sat Nov 14 19:22:02 2020 > New Revision: 367695 > URL: https://svnweb.freebsd.org/changeset/base/367695 > > Log: > thread: batch credential freeing > > Modified: > head/sys/kern/kern_prot.c > head/sys/kern/kern_thread.c > head/sys/sys/ucred.h > > Modified: head/sys/kern/kern_prot.c > == > --- head/sys/kern/kern_prot.c Sat Nov 14 19:21:46 2020(r367694) > +++ head/sys/kern/kern_prot.c Sat Nov 14 19:22:02 2020(r367695) > @@ -2007,6 +2071,17 @@ crfree(struct ucred *cr) > mtx_unlock(&cr->cr_mtx); > return; > } > + crfree_final(cr); > +} > + > +static void > +crfree_final(struct ucred *cr) > +{ > + > + KASSERT(cr->cr_users == 0, ("%s: users %d not == 0 on cred %p", > + __func__, cr->cr_users, cr)); > + KASSERT(cr->cr_ref == 0, ("%s: ref %d not == 0 on cred %p", > + __func__, cr->cr_ref, cr)); > /* Please add blank lines before comments. It's in style(9) and I've noticed a pattern in your changes of not including them. > Modified: head/sys/sys/ucred.h > == > --- head/sys/sys/ucred.h Sat Nov 14 19:21:46 2020(r367694) > +++ head/sys/sys/ucred.h Sat Nov 14 19:22:02 2020(r367695) > @@ -114,6 +114,28 @@ struct xucred { > struct proc; > struct thread; > > +struct credbatch { > + struct ucred *cred; > + int users; > + int ref; > +}; > + > +static inline void > +credbatch_prep(struct credbatch *crb) > +{ > + crb->cred = NULL; > + crb->users = 0; > + crb->ref = 0; > +} > +void credbatch_add(struct credbatch *crb, struct thread *td); > +static inline void > +credbatch_process(struct credbatch *crb) > +{ > + > +} > +void credbatch_add(struct credbatch *crb, struct thread *td); > +void credbatch_final(struct credbatch *crb); > + Do not mix prototypes and inlines, especially without spaces around the prototype in the middle. Also, the kernel uses __inline rather than inline (for better or for worse). Better would be: static __inline void credbatch_prep() { ... } static __inline void credbatch_process() { ... } void credbatch_add(); void credbatch_final(); It seems you just have a duplicate credbatch_add() in fact. Also, why have an empty inline function? These changes would benefit from review. -- John Baldwin ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r367771 - head/sbin/nvmecontrol
On 17 Nov 2020, at 17:12, Adrian Chadd wrote: > @@ -175,8 +176,7 @@ update_firmware(int fd, uint8_t *payload, int32_t payl > errx(EX_OSERR, "unable to malloc %zd bytes", > (size_t)max_xfer_size); > > while (resid > 0) { > - size = (resid >= (int32_t)max_xfer_size) ? > - max_xfer_size : resid; > + size = (resid >= max_xfer_size) ? max_xfer_size : resid; MIN from the already-included sys/param.h? (Otherwise: you have an extra space after ?) Jess ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r367771 - head/sbin/nvmecontrol
On 17 Nov 2020, at 17:29, Jessica Clarke wrote: > On 17 Nov 2020, at 17:12, Adrian Chadd wrote: >> @@ -175,8 +176,7 @@ update_firmware(int fd, uint8_t *payload, int32_t payl >> errx(EX_OSERR, "unable to malloc %zd bytes", >> (size_t)max_xfer_size); >> >> while (resid > 0) { >> -size = (resid >= (int32_t)max_xfer_size) ? >> -max_xfer_size : resid; >> +size = (resid >= max_xfer_size) ? max_xfer_size : resid; > > MIN from the already-included sys/param.h? > > (Otherwise: you have an extra space after ?) Also why is off signed when it counts up from 0? Jess ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r367744 - in head/sys: compat/freebsd32 kern sys
On Tue, Nov 17, 2020 at 11:11 AM Brooks Davis wrote: > > On Tue, Nov 17, 2020 at 03:36:58AM +, Kyle Evans wrote: > > Modified: head/sys/compat/freebsd32/freebsd32.h > > == > > --- head/sys/compat/freebsd32/freebsd32.h Tue Nov 17 03:34:01 2020 > > (r367743) > > +++ head/sys/compat/freebsd32/freebsd32.h Tue Nov 17 03:36:58 2020 > > (r367744) > > @@ -94,6 +94,27 @@ struct itimerval32 { > > struct timeval32 it_value; > > }; > > > > +struct umtx_time32 { > > + struct timespec32 _timeout; > > + uint32_t_flags; > > + uint32_t_clockid; > > +}; > > + > > +struct umtx_robust_lists_params_compat32 { > > + uint32_trobust_list_offset; > > + uint32_trobust_priv_list_offset; > > + uint32_trobust_inact_offset; > > +}; > > + > > +struct umutex32 { > > + volatile __lwpid_t m_owner;/* Owner of the mutex */ > > + __uint32_t m_flags;/* Flags of the mutex */ > > + __uint32_t m_ceilings[2]; /* Priority protect ceiling */ > > + __uint32_t m_rb_lnk; /* Robust linkage */ > > + __uint32_t m_pad; > > + __uint32_t m_spare[2]; > > +}; > > + > > #define FREEBSD4_MFSNAMELEN 16 > > #define FREEBSD4_MNAMELEN(88 - 2 * sizeof(int32_t)) > > > > > > Modified: head/sys/compat/freebsd32/freebsd32_misc.c > > == > > --- head/sys/compat/freebsd32/freebsd32_misc.cTue Nov 17 03:34:01 > > 2020(r367743) > > +++ head/sys/compat/freebsd32/freebsd32_misc.cTue Nov 17 03:36:58 > > 2020(r367744) > > @@ -84,6 +84,7 @@ __FBSDID("$FreeBSD$"); > > #include > > #include > > #include > > +#include > > #include > > #include > > #include > > @@ -3764,4 +3765,12 @@ freebsd32_sched_rr_get_interval(struct thread *td, > > error = copyout(&ts32, uap->interval, sizeof(ts32)); > > } > > return (error); > > +} > > + > > +int > > +freebsd32__umtx_op(struct thread *td, struct freebsd32__umtx_op_args *uap) > > +{ > > + > > + return (kern__umtx_op(td, uap->obj, uap->op, uap->val, uap->uaddr, > > + uap->uaddr2, &umtx_native_ops32)); > > } > > > > Putting any of this under compat/freebsd32 seems like a somewhat > odd choice since all the work is done in kern_umtx.h. In CheriBSD, > everything just lives there so nothing has to be exposed in headers. > I have no strong opinion here -- my initial impression of the suggestion to move the struct definitions into freebsd32 was that: 1.) One can then quickly reference the definition of, e.g., timespec32 when I'm looking at a umtx_time32, and 2.) It'd be 'cleaner', requiring less #ifdef soup in kern_umtx.c The follow-up patch muddies the waters a lot, as we end up using the compat32 definitions on all 64-bit platforms anyways even without compat32. I don't object to moving any/all of this back, if you think that's better. Thanks, Kyle Evans ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r367772 - in head: share/man/man4 sys/dev/usb sys/dev/usb/serial
Author: emaste Date: Tue Nov 17 18:28:20 2020 New Revision: 367772 URL: https://svnweb.freebsd.org/changeset/base/367772 Log: uplcom: add ATen/Prolific USB-232 Controller D USB ID PR: 251166 Submitted by: marcus MFC after:2 weeks Modified: head/share/man/man4/uplcom.4 head/sys/dev/usb/serial/uplcom.c head/sys/dev/usb/usbdevs Modified: head/share/man/man4/uplcom.4 == --- head/share/man/man4/uplcom.4Tue Nov 17 17:12:28 2020 (r367771) +++ head/share/man/man4/uplcom.4Tue Nov 17 18:28:20 2020 (r367772) @@ -82,6 +82,8 @@ Anchor Serial adapter .It ATEN UC-232A .It +ATEN UC-232B +.It BAFO BF-800 and BF-810 .It Belkin F5U257 @@ -133,6 +135,8 @@ PLANEX USB-RS232 URS-03 Prolific Generic USB-Serial Adapters .It Prolific Pharos USB-Serial Adapter +.It +Prolific USB-Serial Controller D .It RATOC REX-USB60 .It Modified: head/sys/dev/usb/serial/uplcom.c == --- head/sys/dev/usb/serial/uplcom.cTue Nov 17 17:12:28 2020 (r367771) +++ head/sys/dev/usb/serial/uplcom.cTue Nov 17 18:28:20 2020 (r367772) @@ -260,6 +260,7 @@ static const STRUCT_USB_HOST_ID uplcom_devs[] = { UPLCOM_DEV(ALCOR, AU9720), /* Alcor AU9720 USB 2.0-RS232 */ UPLCOM_DEV(ANCHOR, SERIAL), /* Anchor Serial adapter */ UPLCOM_DEV(ATEN, UC232A), /* PLANEX USB-RS232 URS-03 */ + UPLCOM_DEV(ATEN, UC232B), /* Prolific USB-RS232 Controller D */ UPLCOM_DEV(BELKIN, F5U257), /* Belkin F5U257 USB to Serial */ UPLCOM_DEV(COREGA, CGUSBRS232R),/* Corega CG-USBRS232R */ UPLCOM_DEV(EPSON, CRESSI_EDY), /* Cressi Edy diving computer */ Modified: head/sys/dev/usb/usbdevs == --- head/sys/dev/usb/usbdevsTue Nov 17 17:12:28 2020(r367771) +++ head/sys/dev/usb/usbdevsTue Nov 17 18:28:20 2020(r367772) @@ -1275,6 +1275,7 @@ product ATEN UC1284 0x2001 Parallel printer product ATEN UC10T 0x2002 10Mbps Ethernet product ATEN UC110T0x2007 UC-110T Ethernet product ATEN UC232A0x2008 Serial +product ATEN UC232B0x2022 Serial product ATEN UC210T0x2009 UC-210T Ethernet product ATEN DSB650C 0x4000 DSB-650C ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r367773 - in head/sys: amd64/linux amd64/linux32 arm64/linux compat/linux i386/linux kern sys
Author: cem Date: Tue Nov 17 19:51:47 2020 New Revision: 367773 URL: https://svnweb.freebsd.org/changeset/base/367773 Log: linux(4): Implement name_to_handle_at(), open_by_handle_at() They are similar to our getfhat(2) and fhopen(2) syscalls. Differential Revision:https://reviews.freebsd.org/D27111 Modified: head/sys/amd64/linux/syscalls.master head/sys/amd64/linux32/syscalls.master head/sys/arm64/linux/syscalls.master head/sys/compat/linux/linux_dummy.c head/sys/compat/linux/linux_file.c head/sys/compat/linux/linux_file.h head/sys/i386/linux/syscalls.master head/sys/kern/vfs_syscalls.c head/sys/sys/syscallsubr.h Modified: head/sys/amd64/linux/syscalls.master == --- head/sys/amd64/linux/syscalls.masterTue Nov 17 18:28:20 2020 (r367772) +++ head/sys/amd64/linux/syscalls.masterTue Nov 17 19:51:47 2020 (r367773) @@ -1792,10 +1792,20 @@ } ; Linux 2.6.39 (glibc 2.14): 303AUE_NULLSTD { - int linux_name_to_handle_at(void); + int linux_name_to_handle_at( + l_int dirfd, + const char *name, + struct l_file_handle *handle, + l_int *mnt_id, + l_int flags + ); } 304AUE_NULLSTD { - int linux_open_by_handle_at(void); + int linux_open_by_handle_at( + l_int mountdirfd, + struct l_file_handle *handle, + l_int flags + ); } 305AUE_NULLSTD { int linux_clock_adjtime(void); Modified: head/sys/amd64/linux32/syscalls.master == --- head/sys/amd64/linux32/syscalls.master Tue Nov 17 18:28:20 2020 (r367772) +++ head/sys/amd64/linux32/syscalls.master Tue Nov 17 19:51:47 2020 (r367773) @@ -1916,10 +1916,20 @@ } ; Linux 2.6.39: 341AUE_NULLSTD { - int linux_name_to_handle_at(void); + int linux_name_to_handle_at( + l_int dirfd, + const char *name, + struct l_file_handle *handle, + l_int *mnt_id, + l_int flags + ); } 342AUE_NULLSTD { - int linux_open_by_handle_at(void); + int linux_open_by_handle_at( + l_int mountdirfd, + struct l_file_handle *handle, + l_int flags + ); } 343AUE_NULLSTD { int linux_clock_adjtime(void); Modified: head/sys/arm64/linux/syscalls.master == --- head/sys/arm64/linux/syscalls.masterTue Nov 17 18:28:20 2020 (r367772) +++ head/sys/arm64/linux/syscalls.masterTue Nov 17 19:51:47 2020 (r367773) @@ -1473,10 +1473,20 @@ int linux_fanotify_mark(void); } 264AUE_NULLSTD { - int linux_name_to_handle_at(void); + int linux_name_to_handle_at( + l_int dirfd, + const char *name, + struct l_file_handle *handle, + l_int *mnt_id, + l_int flags + ); } 265AUE_NULLSTD { - int linux_open_by_handle_at(void); + int linux_open_by_handle_at( + l_int mountdirfd, + struct l_file_handle *handle, + l_int flags + ); } 266AUE_NULLSTD { int linux_clock_adjtime(void); Modified: head/sys/compat/linux/linux_dummy.c == --- head/sys/compat/linux/linux_dummy.c Tue Nov 17 18:28:20 2020 (r367772) +++ head/sys/compat/linux/linux_dummy.c Tue Nov 17 19:51:47 2020 (r367773) @@ -101,8 +101,6 @@ DUMMY(perf_event_open); DUMMY(fanotify_init); DUMMY(fanotify_mark); /* Linux 2.6.39: */ -DUMMY(name_to_handle_at); -DUMMY(open_by_handle_at); DUMMY(clock_adjtime); /* Linux 3.0: */ DUMMY(setns); Modified: head/sys/compat/linux/linux_file.c == --- head/sys/compat/linux/linux_file.c Tue Nov 17 18:28:20 2020 (r367772) +++ head/sys/compat/linux/linux_file.c Tue Nov 17 19:51:47 2020 (r367773) @@ -121,13 +121,9 @@ linux_creat(struct thread *td, struct linux_creat_args #endif static int -linux_common_open(struct thread *td, int dirfd, const char *path, int l_flags, -int mode, enum uio_seg seg) +linux_common_openflags(int l_flags) { - struct proc *p = td->td_proc; - struct file *fp
Re: svn commit: r367744 - in head/sys: compat/freebsd32 kern sys
On Tue, Nov 17, 2020 at 11:59:50AM -0600, Kyle Evans wrote: > On Tue, Nov 17, 2020 at 11:11 AM Brooks Davis wrote: > > > > On Tue, Nov 17, 2020 at 03:36:58AM +, Kyle Evans wrote: > > > Modified: head/sys/compat/freebsd32/freebsd32.h > > > == > > > --- head/sys/compat/freebsd32/freebsd32.h Tue Nov 17 03:34:01 2020 > > > (r367743) > > > +++ head/sys/compat/freebsd32/freebsd32.h Tue Nov 17 03:36:58 2020 > > > (r367744) > > > @@ -94,6 +94,27 @@ struct itimerval32 { > > > struct timeval32 it_value; > > > }; > > > > > > +struct umtx_time32 { > > > + struct timespec32 _timeout; > > > + uint32_t_flags; > > > + uint32_t_clockid; > > > +}; > > > + > > > +struct umtx_robust_lists_params_compat32 { > > > + uint32_trobust_list_offset; > > > + uint32_trobust_priv_list_offset; > > > + uint32_trobust_inact_offset; > > > +}; > > > + > > > +struct umutex32 { > > > + volatile __lwpid_t m_owner;/* Owner of the mutex */ > > > + __uint32_t m_flags;/* Flags of the mutex */ > > > + __uint32_t m_ceilings[2]; /* Priority protect ceiling > > > */ > > > + __uint32_t m_rb_lnk; /* Robust linkage */ > > > + __uint32_t m_pad; > > > + __uint32_t m_spare[2]; > > > +}; > > > + > > > #define FREEBSD4_MFSNAMELEN 16 > > > #define FREEBSD4_MNAMELEN(88 - 2 * sizeof(int32_t)) > > > > > > > > > Modified: head/sys/compat/freebsd32/freebsd32_misc.c > > > == > > > --- head/sys/compat/freebsd32/freebsd32_misc.cTue Nov 17 03:34:01 > > > 2020(r367743) > > > +++ head/sys/compat/freebsd32/freebsd32_misc.cTue Nov 17 03:36:58 > > > 2020(r367744) > > > @@ -84,6 +84,7 @@ __FBSDID("$FreeBSD$"); > > > #include > > > #include > > > #include > > > +#include > > > #include > > > #include > > > #include > > > @@ -3764,4 +3765,12 @@ freebsd32_sched_rr_get_interval(struct thread *td, > > > error = copyout(&ts32, uap->interval, sizeof(ts32)); > > > } > > > return (error); > > > +} > > > + > > > +int > > > +freebsd32__umtx_op(struct thread *td, struct freebsd32__umtx_op_args > > > *uap) > > > +{ > > > + > > > + return (kern__umtx_op(td, uap->obj, uap->op, uap->val, uap->uaddr, > > > + uap->uaddr2, &umtx_native_ops32)); > > > } > > > > > > > Putting any of this under compat/freebsd32 seems like a somewhat > > odd choice since all the work is done in kern_umtx.h. In CheriBSD, > > everything just lives there so nothing has to be exposed in headers. > > > > I have no strong opinion here -- my initial impression of the > suggestion to move the struct definitions into freebsd32 was that: > > 1.) One can then quickly reference the definition of, e.g., timespec32 > when I'm looking at a umtx_time32, and > 2.) It'd be 'cleaner', requiring less #ifdef soup in kern_umtx.c > > The follow-up patch muddies the waters a lot, as we end up using the > compat32 definitions on all 64-bit platforms anyways even without > compat32. I don't object to moving any/all of this back, if you think > that's better. (1) makes sense to me. I'm less convinced of (2) especially given the followup. As a rule, I've been removing compat bits from headers when they only need to be defined in a single .c file. If nothing else, I don't like that it presents a somewhat-false implication that the interfaces are public (and there have been quite a few cases where they weren't correctly guarded with _KERNEL). -- Brooks signature.asc Description: PGP signature
svn commit: r367774 - in head/sys: amd64/linux amd64/linux32 arm64/linux i386/linux
Author: cem Date: Tue Nov 17 19:53:59 2020 New Revision: 367774 URL: https://svnweb.freebsd.org/changeset/base/367774 Log: 'make sysent' for r367773 X-MFC-With: r367773 Modified: head/sys/amd64/linux/linux_proto.h head/sys/amd64/linux/linux_sysent.c head/sys/amd64/linux/linux_systrace_args.c head/sys/amd64/linux32/linux32_proto.h head/sys/amd64/linux32/linux32_sysent.c head/sys/amd64/linux32/linux32_systrace_args.c head/sys/arm64/linux/linux_proto.h head/sys/arm64/linux/linux_sysent.c head/sys/arm64/linux/linux_systrace_args.c head/sys/i386/linux/linux_proto.h head/sys/i386/linux/linux_sysent.c head/sys/i386/linux/linux_systrace_args.c Modified: head/sys/amd64/linux/linux_proto.h == --- head/sys/amd64/linux/linux_proto.h Tue Nov 17 19:51:47 2020 (r367773) +++ head/sys/amd64/linux/linux_proto.h Tue Nov 17 19:53:59 2020 (r367774) @@ -1143,10 +1143,16 @@ struct linux_prlimit64_args { char old_l_[PADL_(struct rlimit *)]; struct rlimit * old; char old_r_[PADR_(struct rlimit *)]; }; struct linux_name_to_handle_at_args { - register_t dummy; + char dirfd_l_[PADL_(l_int)]; l_int dirfd; char dirfd_r_[PADR_(l_int)]; + char name_l_[PADL_(const char *)]; const char * name; char name_r_[PADR_(const char *)]; + char handle_l_[PADL_(struct l_file_handle *)]; struct l_file_handle * handle; char handle_r_[PADR_(struct l_file_handle *)]; + char mnt_id_l_[PADL_(l_int *)]; l_int * mnt_id; char mnt_id_r_[PADR_(l_int *)]; + char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)]; }; struct linux_open_by_handle_at_args { - register_t dummy; + char mountdirfd_l_[PADL_(l_int)]; l_int mountdirfd; char mountdirfd_r_[PADR_(l_int)]; + char handle_l_[PADL_(struct l_file_handle *)]; struct l_file_handle * handle; char handle_r_[PADR_(struct l_file_handle *)]; + char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)]; }; struct linux_clock_adjtime_args { register_t dummy; Modified: head/sys/amd64/linux/linux_sysent.c == --- head/sys/amd64/linux/linux_sysent.c Tue Nov 17 19:51:47 2020 (r367773) +++ head/sys/amd64/linux/linux_sysent.c Tue Nov 17 19:53:59 2020 (r367774) @@ -320,8 +320,8 @@ struct sysent linux_sysent[] = { { .sy_narg = 0, .sy_call = (sy_call_t *)linux_fanotify_init, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 300 = linux_fanotify_init */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_fanotify_mark, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 301 = linux_fanotify_mark */ { .sy_narg = AS(linux_prlimit64_args), .sy_call = (sy_call_t *)linux_prlimit64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC },/* 302 = linux_prlimit64 */ - { .sy_narg = 0, .sy_call = (sy_call_t *)linux_name_to_handle_at, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 303 = linux_name_to_handle_at */ - { .sy_narg = 0, .sy_call = (sy_call_t *)linux_open_by_handle_at, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 304 = linux_open_by_handle_at */ + { .sy_narg = AS(linux_name_to_handle_at_args), .sy_call = (sy_call_t *)linux_name_to_handle_at, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC },/* 303 = linux_name_to_handle_at */ + { .sy_narg = AS(linux_open_by_handle_at_args), .sy_call = (sy_call_t *)linux_open_by_handle_at, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC },/* 304 = linux_open_by_handle_at */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_clock_adjtime, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 305 = linux_clock_adjtime */ { .sy_narg = AS(linux_syncfs_args), .sy_call = (sy_call_t *)linux_syncfs, .sy_auevent = AUE_SYNC, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 306 = linux_syncfs */ { .sy_narg = AS(linux_sendmmsg_args), .sy_call = (sy_call_t *)linux_sendmmsg, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 307 = linux_sendmmsg */ Modified: head/sys/amd64/linux/linux_systrace_args.c == --- head/sys/amd64/linux/linux_systrace_args.c Tue Nov 17 19:51:47 2020 (r367773) +++ head/sys/amd64/linux/linux_systrace_args.c Tue Nov 17 19:53:59 2020 (r367774) @@ -2321,12 +2321,22 @@ systrace_args(int sysnum, void *params, uint64_t *uarg } /* linux_name_to_handle_at */ case 303: { - *n_args = 0; + struct linux_name_to_handle_at_args *p = params; + iarg[0] = p->dirfd; /* l_int */ + uarg[1] = (intptr_t) p->name; /*
svn commit: r367775 - head/sys/compat/linprocfs
Author: cem Date: Tue Nov 17 19:56:47 2020 New Revision: 367775 URL: https://svnweb.freebsd.org/changeset/base/367775 Log: linprocfs(5): Add rudimentary /proc//mountinfo This is used by some Linux programs using filehandles (r367773) to locate the mountpoint for a given fsid. Differential Revision:https://reviews.freebsd.org/D27136 Modified: head/sys/compat/linprocfs/linprocfs.c Modified: head/sys/compat/linprocfs/linprocfs.c == --- head/sys/compat/linprocfs/linprocfs.c Tue Nov 17 19:53:59 2020 (r367774) +++ head/sys/compat/linprocfs/linprocfs.c Tue Nov 17 19:56:47 2020 (r367775) @@ -403,24 +403,85 @@ linprocfs_docpuinfo(PFS_FILL_ARGS) } #endif /* __i386__ || __amd64__ */ +static const char *path_slash_sys = "/sys"; +static const char *fstype_sysfs = "sysfs"; + +static int +_mtab_helper(const struct pfs_node *pn, const struct statfs *sp, +const char **mntfrom, const char **mntto, const char **fstype) +{ + /* determine device name */ + *mntfrom = sp->f_mntfromname; + + /* determine mount point */ + *mntto = sp->f_mntonname; + + /* determine fs type */ + *fstype = sp->f_fstypename; + if (strcmp(*fstype, pn->pn_info->pi_name) == 0) + *mntfrom = *fstype = "proc"; + else if (strcmp(*fstype, "procfs") == 0) + return (ECANCELED); + + if (strcmp(*fstype, "autofs") == 0) { + /* +* FreeBSD uses eg "map -hosts", whereas Linux +* expects just "-hosts". +*/ + if (strncmp(*mntfrom, "map ", 4) == 0) + *mntfrom += 4; + } + + if (strcmp(*fstype, "linsysfs") == 0) { + *mntfrom = path_slash_sys; + *fstype = fstype_sysfs; + } else { + /* For Linux msdosfs is called vfat */ + if (strcmp(*fstype, "msdosfs") == 0) + *fstype = "vfat"; + } + return (0); +} + +static void +_sbuf_mntoptions_helper(struct sbuf *sb, uint64_t f_flags) +{ + sbuf_cat(sb, (f_flags & MNT_RDONLY) ? "ro" : "rw"); +#define ADD_OPTION(opt, name) \ + if (f_flags & (opt)) sbuf_cat(sb, "," name); + ADD_OPTION(MNT_SYNCHRONOUS, "sync"); + ADD_OPTION(MNT_NOEXEC, "noexec"); + ADD_OPTION(MNT_NOSUID, "nosuid"); + ADD_OPTION(MNT_UNION, "union"); + ADD_OPTION(MNT_ASYNC, "async"); + ADD_OPTION(MNT_SUIDDIR, "suiddir"); + ADD_OPTION(MNT_NOSYMFOLLOW, "nosymfollow"); + ADD_OPTION(MNT_NOATIME, "noatime"); +#undef ADD_OPTION +} + /* - * Filler function for proc/mtab + * Filler function for proc/mtab and proc//mounts. * - * This file doesn't exist in Linux' procfs, but is included here so + * /proc/mtab doesn't exist in Linux' procfs, but is included here so * users can symlink /compat/linux/etc/mtab to /proc/mtab */ static int linprocfs_domtab(PFS_FILL_ARGS) { struct nameidata nd; - const char *lep; - char *dlep, *flep, *mntto, *mntfrom, *fstype; + const char *lep, *mntto, *mntfrom, *fstype; + char *dlep, *flep; size_t lep_len; int error; struct statfs *buf, *sp; size_t count; /* resolve symlinks etc. in the emulation tree prefix */ + /* +* Ideally, this would use the current chroot rather than some +* hardcoded path. +*/ NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, linux_emul_path, td); flep = NULL; error = namei(&nd); @@ -442,55 +503,112 @@ linprocfs_domtab(PFS_FILL_ARGS) } for (sp = buf; count > 0; sp++, count--) { - /* determine device name */ - mntfrom = sp->f_mntfromname; + error = _mtab_helper(pn, sp, &mntfrom, &mntto, &fstype); + if (error != 0) { + MPASS(error == ECANCELED); + continue; + } /* determine mount point */ - mntto = sp->f_mntonname; if (strncmp(mntto, lep, lep_len) == 0 && mntto[lep_len] == '/') mntto += lep_len; - /* determine fs type */ - fstype = sp->f_fstypename; - if (strcmp(fstype, pn->pn_info->pi_name) == 0) - mntfrom = fstype = "proc"; - else if (strcmp(fstype, "procfs") == 0) - continue; + sbuf_printf(sb, "%s %s %s ", mntfrom, mntto, fstype); + _sbuf_mntoptions_helper(sb, sp->f_flags); + /* a real Linux mtab will also show NFS options */ + sbuf_printf(sb, " 0 0\n"); + } - if (strcmp(fstype, "autofs") == 0) { - /* -* FreeBSD uses eg "map -hosts", whereas Li
svn commit: r367776 - in head: share/man/man4 sys/compat/linux sys/kern sys/sys
Author: cem Date: Tue Nov 17 20:01:21 2020 New Revision: 367776 URL: https://svnweb.freebsd.org/changeset/base/367776 Log: unix(4): Enhance LOCAL_CREDS_PERSISTENT ABI As this ABI is still fresh (r367287), let's correct some mistakes now: - Version the structure to allow for future changes - Include sender's pid in control message structure - Use a distinct control message type from the cmsgcred / sockcred mess Discussed with: kib, markj, trasz Differential Revision:https://reviews.freebsd.org/D27084 Modified: head/share/man/man4/unix.4 head/sys/compat/linux/linux_socket.c head/sys/kern/uipc_usrreq.c head/sys/sys/socket.h Modified: head/share/man/man4/unix.4 == --- head/share/man/man4/unix.4 Tue Nov 17 19:56:47 2020(r367775) +++ head/share/man/man4/unix.4 Tue Nov 17 20:01:21 2020(r367776) @@ -28,7 +28,7 @@ .\" @(#)unix.4 8.1 (Berkeley) 6/9/93 .\" $FreeBSD$ .\" -.Dd November 2, 2020 +.Dd November 9, 2020 .Dt UNIX 4 .Os .Sh NAME @@ -295,6 +295,41 @@ except that socket credentials are passed on every rea or .Dv SOCK_SEQPACKET socket, instead of just the first read. +Additionally, the +.Va msg_control +field in the +.Vt msghdr +structure points to a buffer that contains a +.Vt cmsghdr +structure followed by a variable length +.Vt sockcred2 +structure, defined in +.In sys/socket.h +as follows: +.Bd -literal +struct sockcred2 { + int sc_version; /* version of this structure */ + pid_tsc_pid; /* PID of sending process */ + uid_tsc_uid; /* real user id */ + uid_tsc_euid;/* effective user id */ + gid_tsc_gid; /* real group id */ + gid_tsc_egid;/* effective group id */ + int sc_ngroups; /* number of supplemental groups */ + gid_tsc_groups[1]; /* variable length */ +}; +.Ed +.Pp +The current version is zero. +.Pp +The +.Vt cmsghdr +fields have the following values: +.Bd -literal +cmsg_len = CMSG_LEN(SOCKCRED2SIZE(ngroups)) +cmsg_level = SOL_SOCKET +cmsg_type = SCM_CREDS2 +.Ed +.Pp The .Dv LOCAL_CREDS and Modified: head/sys/compat/linux/linux_socket.c == --- head/sys/compat/linux/linux_socket.cTue Nov 17 19:56:47 2020 (r367775) +++ head/sys/compat/linux/linux_socket.cTue Nov 17 20:01:21 2020 (r367776) @@ -644,6 +644,8 @@ bsd_to_linux_cmsg_type(int cmsg_type) return (LINUX_SCM_RIGHTS); case SCM_CREDS: return (LINUX_SCM_CREDENTIALS); + case SCM_CREDS2: + return (LINUX_SCM_CREDENTIALS); case SCM_TIMESTAMP: return (LINUX_SCM_TIMESTAMP); } @@ -1508,6 +1510,7 @@ linux_recvmsg_common(struct thread *td, l_int s, struc { struct cmsghdr *cm; struct cmsgcred *cmcred; + struct sockcred2 *scred; struct l_cmsghdr *linux_cmsg = NULL; struct l_ucred linux_ucred; socklen_t datalen, maxlen, outlen; @@ -1627,6 +1630,16 @@ linux_recvmsg_common(struct thread *td, l_int s, struc linux_ucred.pid = cmcred->cmcred_pid; linux_ucred.uid = cmcred->cmcred_uid; linux_ucred.gid = cmcred->cmcred_gid; + data = &linux_ucred; + datalen = sizeof(linux_ucred); + break; + + case SCM_CREDS2: + scred = data; + bzero(&linux_ucred, sizeof(linux_ucred)); + linux_ucred.pid = scred->sc_pid; + linux_ucred.uid = scred->sc_uid; + linux_ucred.gid = scred->sc_gid; data = &linux_ucred; datalen = sizeof(linux_ucred); break; Modified: head/sys/kern/uipc_usrreq.c == --- head/sys/kern/uipc_usrreq.c Tue Nov 17 19:56:47 2020(r367775) +++ head/sys/kern/uipc_usrreq.c Tue Nov 17 20:01:21 2020(r367776) @@ -308,7 +308,7 @@ static int unp_internalize(struct mbuf **, struct thre static voidunp_internalize_fp(struct file *); static int unp_externalize(struct mbuf *, struct mbuf **, int); static int unp_externalize_fp(struct file *); -static struct mbuf *unp_addsockcred(struct thread *, struct mbuf *); +static struct mbuf *unp_addsockcred(struct thread *, struct mbuf *, int); static voidunp_process_defers(void * __unused, int); static void @@ -1043,7 +1043,8 @@ uipc_send(struct socket *so, int flags, struct mbuf *m } if (unp2->unp_flags & UNP_WANTCRED_MASK) -
svn commit: r367777 - in head: lib/libkvm lib/libprocstat sys/compat/cloudabi sys/fs/fuse sys/fs/unionfs sys/kern sys/sys
Author: cem Date: Tue Nov 17 21:14:13 2020 New Revision: 36 URL: https://svnweb.freebsd.org/changeset/base/36 Log: Split out cwd/root/jail, cmask state from filedesc table No functional change intended. Tracking these structures separately for each proc enables future work to correctly emulate clone(2) in linux(4). __FreeBSD_version is bumped (to 1300130) for consumption by, e.g., lsof. Reviewed by: kib Discussed with: markj, mjg Differential Revision:https://reviews.freebsd.org/D27037 Modified: head/lib/libkvm/kvm_proc.c head/lib/libprocstat/libprocstat.c head/sys/compat/cloudabi/cloudabi_file.c head/sys/fs/fuse/fuse_internal.c head/sys/fs/fuse/fuse_vnops.c head/sys/fs/unionfs/union_subr.c head/sys/kern/imgact_elf.c head/sys/kern/init_main.c head/sys/kern/kern_descrip.c head/sys/kern/kern_exec.c head/sys/kern/kern_exit.c head/sys/kern/kern_fork.c head/sys/kern/kern_proc.c head/sys/kern/kern_thread.c head/sys/kern/uipc_mqueue.c head/sys/kern/uipc_sem.c head/sys/kern/uipc_shm.c head/sys/kern/uipc_usrreq.c head/sys/kern/vfs_syscalls.c head/sys/sys/filedesc.h head/sys/sys/param.h head/sys/sys/proc.h head/sys/sys/user.h Modified: head/lib/libkvm/kvm_proc.c == --- head/lib/libkvm/kvm_proc.c Tue Nov 17 20:01:21 2020(r367776) +++ head/lib/libkvm/kvm_proc.c Tue Nov 17 21:14:13 2020(r36) @@ -221,6 +221,7 @@ kvm_proclist(kvm_t *kd, int what, int arg, struct proc kp->ki_tracep = proc.p_tracevp; kp->ki_textvp = proc.p_textvp; kp->ki_fd = proc.p_fd; + kp->ki_pd = proc.p_pd; kp->ki_vmspace = proc.p_vmspace; if (proc.p_sigacts != NULL) { if (KREAD(kd, (u_long)proc.p_sigacts, &sigacts)) { Modified: head/lib/libprocstat/libprocstat.c == --- head/lib/libprocstat/libprocstat.c Tue Nov 17 20:01:21 2020 (r367776) +++ head/lib/libprocstat/libprocstat.c Tue Nov 17 21:14:13 2020 (r36) @@ -460,6 +460,7 @@ procstat_getfiles_kvm(struct procstat *procstat, struc { struct file file; struct filedesc filed; + struct pwddesc pathsd; struct fdescenttbl *fdt; struct pwd pwd; unsigned long pwd_addr; @@ -484,15 +485,20 @@ procstat_getfiles_kvm(struct procstat *procstat, struc kd = procstat->kd; if (kd == NULL) return (NULL); - if (kp->ki_fd == NULL) + if (kp->ki_fd == NULL || kp->ki_pd == NULL) return (NULL); if (!kvm_read_all(kd, (unsigned long)kp->ki_fd, &filed, sizeof(filed))) { warnx("can't read filedesc at %p", (void *)kp->ki_fd); return (NULL); } + if (!kvm_read_all(kd, (unsigned long)kp->ki_pd, &pathsd, + sizeof(pathsd))) { + warnx("can't read pwddesc at %p", (void *)kp->ki_pd); + return (NULL); + } haspwd = false; - pwd_addr = (unsigned long)(FILEDESC_KVM_LOAD_PWD(&filed)); + pwd_addr = (unsigned long)(PWDDESC_KVM_LOAD_PWD(&pathsd)); if (pwd_addr != 0) { if (!kvm_read_all(kd, pwd_addr, &pwd, sizeof(pwd))) { warnx("can't read fd_pwd at %p", (void *)pwd_addr); @@ -2086,18 +2092,18 @@ procstat_freegroups(struct procstat *procstat __unused static int procstat_getumask_kvm(kvm_t *kd, struct kinfo_proc *kp, unsigned short *maskp) { - struct filedesc fd; + struct pwddesc pd; assert(kd != NULL); assert(kp != NULL); - if (kp->ki_fd == NULL) + if (kp->ki_pd == NULL) return (-1); - if (!kvm_read_all(kd, (unsigned long)kp->ki_fd, &fd, sizeof(fd))) { - warnx("can't read filedesc at %p for pid %d", kp->ki_fd, + if (!kvm_read_all(kd, (unsigned long)kp->ki_pd, &pd, sizeof(pd))) { + warnx("can't read pwddesc at %p for pid %d", kp->ki_pd, kp->ki_pid); return (-1); } - *maskp = fd.fd_cmask; + *maskp = pd.pd_cmask; return (0); } Modified: head/sys/compat/cloudabi/cloudabi_file.c == --- head/sys/compat/cloudabi/cloudabi_file.cTue Nov 17 20:01:21 2020 (r367776) +++ head/sys/compat/cloudabi/cloudabi_file.cTue Nov 17 21:14:13 2020 (r36) @@ -265,7 +265,7 @@ cloudabi_sys_file_open(struct thread *td, } NDINIT_ATRIGHTS(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, path, uap->dirfd.fd, &rights, td); - error = vn_open(&nd, &fflags, 0777 & ~td->td_proc->p_fd->fd_cmask, fp); + error = vn_open(&nd, &fflags, 0777 & ~td->td_proc->p_pd->pd_cmask, fp); cloudabi_freestr(path);
svn commit: r367778 - in head/sys: compat/linux kern sys
Author: cem Date: Tue Nov 17 21:20:11 2020 New Revision: 367778 URL: https://svnweb.freebsd.org/changeset/base/367778 Log: linux(4) clone(2): Correctly handle CLONE_FS and CLONE_FILES The two flags are distinct and it is impossible to correctly handle clone(2) without the assistance of fork1(). This change depends on the pwddesc split introduced in r36. I've added a fork_req flag, FR2_SHARE_PATHS, which indicates that p_pd should be treated the opposite way p_fd is (based on RFFDG flag). This is a little ugly, but the benefit is that existing RFFDG API is preserved. Holding FR2_SHARE_PATHS disabled, RFFDG indicates both p_fd and p_pd are copied, while !RFFDG indicates both should be cloned. In Chrome, clone(2) is used with CLONE_FS, without CLONE_FILES, and expects independent fd tables. The previous conflation of CLONE_FS and CLONE_FILES was introduced in r163371 (2006). Discussed with: markj, trasz (earlier version) Differential Revision:https://reviews.freebsd.org/D27016 Modified: head/sys/compat/linux/linux_fork.c head/sys/kern/kern_fork.c head/sys/sys/proc.h Modified: head/sys/compat/linux/linux_fork.c == --- head/sys/compat/linux/linux_fork.c Tue Nov 17 21:14:13 2020 (r36) +++ head/sys/compat/linux/linux_fork.c Tue Nov 17 21:20:11 2020 (r367778) @@ -131,12 +131,13 @@ static int linux_clone_proc(struct thread *td, struct linux_clone_args *args) { struct fork_req fr; - int error, ff = RFPROC | RFSTOPPED; + int error, ff = RFPROC | RFSTOPPED, f2; struct proc *p2; struct thread *td2; int exit_signal; struct linux_emuldata *em; + f2 = 0; exit_signal = args->flags & 0x00ff; if (LINUX_SIG_VALID(exit_signal)) { exit_signal = linux_to_bsd_signal(exit_signal); @@ -147,14 +148,14 @@ linux_clone_proc(struct thread *td, struct linux_clone ff |= RFMEM; if (args->flags & LINUX_CLONE_SIGHAND) ff |= RFSIGSHARE; - /* -* XXX: In Linux, sharing of fs info (chroot/cwd/umask) -* and open files is independent. In FreeBSD, its in one -* structure but in reality it does not cause any problems -* because both of these flags are usually set together. -*/ - if (!(args->flags & (LINUX_CLONE_FILES | LINUX_CLONE_FS))) + if (args->flags & LINUX_CLONE_FILES) { + if (!(args->flags & LINUX_CLONE_FS)) + f2 |= FR2_SHARE_PATHS; + } else { ff |= RFFDG; + if (args->flags & LINUX_CLONE_FS) + f2 |= FR2_SHARE_PATHS; + } if (args->flags & LINUX_CLONE_PARENT_SETTID) if (args->parent_tidptr == NULL) @@ -165,6 +166,7 @@ linux_clone_proc(struct thread *td, struct linux_clone bzero(&fr, sizeof(fr)); fr.fr_flags = ff; + fr.fr_flags2 = f2; fr.fr_procp = &p2; error = fork1(td, &fr); if (error) Modified: head/sys/kern/kern_fork.c == --- head/sys/kern/kern_fork.c Tue Nov 17 21:14:13 2020(r36) +++ head/sys/kern/kern_fork.c Tue Nov 17 21:20:11 2020(r367778) @@ -414,11 +414,17 @@ do_fork(struct thread *td, struct fork_req *fr, struct fd = fdinit(p1->p_fd, false, NULL); fdtol = NULL; } else if (fr->fr_flags & RFFDG) { - pd = pdcopy(p1->p_pd); + if (fr->fr_flags2 & FR2_SHARE_PATHS) + pd = pdshare(p1->p_pd); + else + pd = pdcopy(p1->p_pd); fd = fdcopy(p1->p_fd); fdtol = NULL; } else { - pd = pdshare(p1->p_pd); + if (fr->fr_flags2 & FR2_SHARE_PATHS) + pd = pdcopy(p1->p_pd); + else + pd = pdshare(p1->p_pd); fd = fdshare(p1->p_fd); if (p1->p_fdtol == NULL) p1->p_fdtol = filedesc_to_leader_alloc(NULL, NULL, Modified: head/sys/sys/proc.h == --- head/sys/sys/proc.h Tue Nov 17 21:14:13 2020(r36) +++ head/sys/sys/proc.h Tue Nov 17 21:20:11 2020(r367778) @@ -1017,7 +1017,8 @@ structfork_req { int fr_pd_flags; struct filecaps *fr_pd_fcaps; int fr_flags2; -#defineFR2_DROPSIG_CAUGHT 0x1 /* Drop caught non-DFL signals */ +#defineFR2_DROPSIG_CAUGHT 0x0001 /* Drop caught non-DFL signals */ +#defineFR2_SHARE_PATHS 0x0002 /* Invert sense of RFFDG for paths */ }; /* ___ svn-src-head@freebsd.org
Re: svn commit: r367692 - head/sys/sys
On 11/14/20 2:34 PM, Warner Losh wrote: > true, but a version bump forces that and versions are cheap enough... Strictly speaking, version bumps don't force anything to recompile, they just ensure that newer modules won't load on older kernels. In this case, the change to sys/ucred.h will result in sys/ucred.h's mtime changing so that any kernel modules being built via NO_CLEAN=yes will rebuild ok. I'm not quite sure where this mantra that version bumps force rebuilds came from, but they don't. It's true that since it lives in and most things include that, it mostly forces a rebuild, but that's mostly a side effect, not due to explicit magic around __FreeBSD_version. -- John Baldwin ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r367692 - head/sys/sys
In message <0015bc22-4568-93cc-5c77-e97c4f5e2...@freebsd.org>, John Baldwin wri tes: > On 11/14/20 2:34 PM, Warner Losh wrote: > > true, but a version bump forces that and versions are cheap enough... > > Strictly speaking, version bumps don't force anything to recompile, they > just ensure that newer modules won't load on older kernels. In this case, > the change to sys/ucred.h will result in sys/ucred.h's mtime changing so > that any kernel modules being built via NO_CLEAN=yes will rebuild ok. > > I'm not quite sure where this mantra that version bumps force rebuilds > came from, but they don't. It's true that since it lives in > and most things include that, it mostly forces a rebuild, but that's > mostly a side effect, not due to explicit magic around __FreeBSD_version. Any update to sys/param.h causes the rebuild of any object that depends on the header file. It also causes any poudriere jail built on -CURRENT to delete all its packages and restart from scratch. Poudriere assumes it means ABI or API changes whereas version bumps could simply be markers of notable change that may not affect the ABI. In which case poudriere package rebuilds are gratuitous. -- Cheers, Cy Schubert FreeBSD UNIX: Web: https://FreeBSD.org NTP: Web: https://nwtime.org The need of the many outweighs the greed of the few. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r367692 - head/sys/sys
On Tue, Nov 17, 2020 at 3:18 PM John Baldwin wrote: > On 11/14/20 2:34 PM, Warner Losh wrote: > > true, but a version bump forces that and versions are cheap enough... > > Strictly speaking, version bumps don't force anything to recompile, they > just ensure that newer modules won't load on older kernels. In this case, > the change to sys/ucred.h will result in sys/ucred.h's mtime changing so > that any kernel modules being built via NO_CLEAN=yes will rebuild ok. > > I'm not quite sure where this mantra that version bumps force rebuilds > came from, but they don't. It's true that since it lives in > and most things include that, it mostly forces a rebuild, but that's > mostly a side effect, not due to explicit magic around __FreeBSD_version. > It's more that modules stop loading when there's a version bump. This is both good and bad. It's good when there's a legit, KBI change that's likely to affect modules. This one seems on the edge. ZFS is affected, but most drivers are not. It's bad when there's not really a problem since the last bump and you have to rebuild your kernel + modules to be a matched set. For production, you always want this, but sometimes you want to be able to run slightly newer modules than the kernel and that's oftentimes OK because some bumps don't affect KBI. Warner ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r367678 - head/usr.sbin/freebsd-update
> On Sat, Nov 14, 2020 at 11:20 AM Mateusz Piotrowski <0...@freebsd.org> wrote: > > > > Hello Rodney, > > > > On 11/14/20 4:59 PM, Rodney W. Grimes wrote: > > >> Author: 0mp (doc,ports committer) > > >> Date: Sat Nov 14 13:07:41 2020 > > >> New Revision: 367678 > > >> URL: https://svnweb.freebsd.org/changeset/base/367678 > > >> > > >> Log: > > >>Document the PAGER environment variable > > >> > > >>Sometimes users want to use freebsd-update(8) in a non-interactive > > >> way and > > >>what they often miss is that they have to set PAGER to cat(1) in > > >> order to > > >>avoid interactive prompts from less(1). > > > Which was caused by the change of invoking more(1) as less(1) causing > > > this regression, as when invoked as more(1) it falls off the end of > > > empty input and causes no such interactive prompt. > > > > > > Setting PAGER to more(1) also fixes this. > > > > Mmm, I'm not sure if that would work. If I run "jot 1000 | more" in my > > terminal I still get an > > interactive prompt. Could it be that you are referring to a different > > more(1) implementation? I'm > > clearly missing something. > > Part of what your missing is freebsd-update(8) often outputs a 0 length file which less(1) well want you to respond Quit to before going to the next file. more(1) does not do that. jot 1000 produces 1 x 1000 line file, that is not whats causing the issues with freebsd-update and less(1), it is more like 1000 x 1 line files. > > more(1) is more or less like `less -E`, which is a default PAGER I had > advocated for back when it changed. It can be mostly non-interactive > as long as your diffs are small, but it's definitely much less > painful. Yes, that would of been less painful, note that iirc there are a few other places effected in similiar ways with 0 line output files sent to less(1) that cause a need to hit a bunch of q's to get the command completed. Since I am an aged more(1) user I just globally fix PAGER. It would of been far less painful had PAGER simply been changed to less rather than all the binary invokations beeing changed, but hind sight is amazing. -- Rod Grimes rgri...@freebsd.org ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r367678 - head/usr.sbin/freebsd-update
On 11/17/20 11:41 PM, Rodney W. Grimes wrote: On Sat, Nov 14, 2020 at 11:20 AM Mateusz Piotrowski <0...@freebsd.org> wrote: On 11/14/20 4:59 PM, Rodney W. Grimes wrote: Author: 0mp (doc,ports committer) Date: Sat Nov 14 13:07:41 2020 New Revision: 367678 URL: https://svnweb.freebsd.org/changeset/base/367678 Log: Document the PAGER environment variable Sometimes users want to use freebsd-update(8) in a non-interactive way and what they often miss is that they have to set PAGER to cat(1) in order to avoid interactive prompts from less(1). Which was caused by the change of invoking more(1) as less(1) causing this regression, as when invoked as more(1) it falls off the end of empty input and causes no such interactive prompt. Setting PAGER to more(1) also fixes this. Mmm, I'm not sure if that would work. If I run "jot 1000 | more" in my terminal I still get an interactive prompt. Could it be that you are referring to a different more(1) implementation? I'm clearly missing something. Part of what your missing is freebsd-update(8) often outputs a 0 length file which less(1) well want you to respond Quit to before going to the next file. more(1) does not do that. Ah, now I see! I forgot about this case. Sure, in this case the old more(1) or the new less(1) with -E are sufficient as well. Thanks a lot, Rodney! I guess that I'll leave the "cat" in the manual for now as it offers fully non-interactive experience. Cheers, Mateusz ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r367678 - head/usr.sbin/freebsd-update
On Tue, 2020-11-17 at 14:41 -0800, Rodney W. Grimes wrote: > > On Sat, Nov 14, 2020 at 11:20 AM Mateusz Piotrowski < > > 0...@freebsd.org> wrote: > > > > > > Hello Rodney, > > > > > > On 11/14/20 4:59 PM, Rodney W. Grimes wrote: > > > > > Author: 0mp (doc,ports committer) > > > > > Date: Sat Nov 14 13:07:41 2020 > > > > > New Revision: 367678 > > > > > URL: https://svnweb.freebsd.org/changeset/base/367678 > > > > > > > > > > Log: > > > > >Document the PAGER environment variable > > > > > > > > > >Sometimes users want to use freebsd-update(8) in a non- > > > > > interactive way and > > > > >what they often miss is that they have to set PAGER to > > > > > cat(1) in order to > > > > >avoid interactive prompts from less(1). > > > > > > > > Which was caused by the change of invoking more(1) as less(1) > > > > causing > > > > this regression, as when invoked as more(1) it falls off the > > > > end of > > > > empty input and causes no such interactive prompt. > > > > > > > > Setting PAGER to more(1) also fixes this. > > > > > > Mmm, I'm not sure if that would work. If I run "jot 1000 | more" > > > in my terminal I still get an > > > interactive prompt. Could it be that you are referring to a > > > different more(1) implementation? I'm > > > clearly missing something. > > > > > Part of what your missing is freebsd-update(8) often outputs a 0 > length file which less(1) well want you to respond Quit to before > going to the next file. more(1) does not do that. > > jot 1000 produces 1 x 1000 line file, that is not whats causing > the issues with freebsd-update and less(1), it is more like > 1000 x 1 line files. > > > > > more(1) is more or less like `less -E`, which is a default PAGER I > > had > > advocated for back when it changed. It can be mostly non- > > interactive > > as long as your diffs are small, but it's definitely much less > > painful. > > Yes, that would of been less painful, note that iirc there are a > few other places effected in similiar ways with 0 line output > files sent to less(1) that cause a need to hit a bunch of q's > to get the command completed. > > Since I am an aged more(1) user I just globally fix PAGER. > It would of been far less painful had PAGER simply been > changed to less rather than all the binary invokations > beeing changed, but hind sight is amazing. > You might find some solace in the brave new world by adding to your .cshrc: setenv LESS -m -E -- Ian ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r367692 - head/sys/sys
On 11/17/20 2:37 PM, Warner Losh wrote: > On Tue, Nov 17, 2020 at 3:18 PM John Baldwin wrote: > >> On 11/14/20 2:34 PM, Warner Losh wrote: >>> true, but a version bump forces that and versions are cheap enough... >> >> Strictly speaking, version bumps don't force anything to recompile, they >> just ensure that newer modules won't load on older kernels. In this case, >> the change to sys/ucred.h will result in sys/ucred.h's mtime changing so >> that any kernel modules being built via NO_CLEAN=yes will rebuild ok. >> >> I'm not quite sure where this mantra that version bumps force rebuilds >> came from, but they don't. It's true that since it lives in >> and most things include that, it mostly forces a rebuild, but that's >> mostly a side effect, not due to explicit magic around __FreeBSD_version. >> > > It's more that modules stop loading when there's a version bump. This is > both good and bad. It's good when there's a legit, KBI change that's likely > to affect modules. This one seems on the edge. ZFS is affected, but most > drivers are not. > > It's bad when there's not really a problem since the last bump and you have > to rebuild your kernel + modules to be a matched set. For production, you > always want this, but sometimes you want to be able to run slightly newer > modules than the kernel and that's oftentimes OK because some bumps don't > affect KBI. To be clear, it only blocks loading modules newer than the running kernel. This still doesn't "force" recompilation in that nothing in the base build system (I'm not counting ports here, but things in src/sys) compares __FreeBSD_version values and forces a clean if there is a mismatch. Only header mtimes force rebuilds. That is, you build by hand instead of using buildkernel, or you go ahead and run 'make reinstallkernel' and then load, or run 'make installkernel' and then go mess with the sysctl to undo the changes to rewrite your module path so you can load an old module. If you build a kernel from your development tree and boot that, then the module will load fine (it's what I generally do except in cases where I'm already running a kernel from said tree and have a module I can unload/load in which case I do the reinstallkernel route). -- John Baldwin ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r367779 - head/sys/contrib/openzfs/cmd/zpool
Author: cy Date: Wed Nov 18 01:18:45 2020 New Revision: 367779 URL: https://svnweb.freebsd.org/changeset/base/367779 Log: Restore identification of VDEVs using non-native block size. NAME STATE READ WRITE CKSUM dsk02ONLINE 0 0 0 mirror-0 ONLINE 0 0 0 ada1s4a ONLINE 0 0 0 ada2s4a ONLINE 0 0 0 block size: 512B configured, 4096B native Reviewed by: tsoome (previous FreeBSD phab version) Differential Revision:https://reviews.freebsd.org/D26880 Upstream commit: 3928ec53395fcc26be7844dd6b63df757166c281 Reviewed-by: Matt Macy Reviewed-by: Toomas Soome Reviewed-by: Brian Behlendorf Signed off by:Cy Schubert Closes #11088 Modified: head/sys/contrib/openzfs/cmd/zpool/zpool_main.c Modified: head/sys/contrib/openzfs/cmd/zpool/zpool_main.c == --- head/sys/contrib/openzfs/cmd/zpool/zpool_main.c Tue Nov 17 21:20:11 2020(r367778) +++ head/sys/contrib/openzfs/cmd/zpool/zpool_main.c Wed Nov 18 01:18:45 2020(r367779) @@ -2254,6 +2254,13 @@ print_status_config(zpool_handle_t *zhp, status_cbdata break; } color_end(); + } else if (children == 0 && !isspare && + getenv("ZPOOL_STATUS_NON_NATIVE_ASHIFT_IGNORE") == NULL && + VDEV_STAT_VALID(vs_physical_ashift, vsc) && + vs->vs_configured_ashift < vs->vs_physical_ashift) { + (void) printf( + gettext(" block size: %dB configured, %dB native"), + 1 << vs->vs_configured_ashift, 1 << vs->vs_physical_ashift); } /* The root vdev has the scrub/resilver stats */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r367781 - head/sys/dev/isp
Author: mav Date: Wed Nov 18 02:12:51 2020 New Revision: 367781 URL: https://svnweb.freebsd.org/changeset/base/367781 Log: Don't allocate full XCMD_SIZE (512 bytes) on stack. We need only 24 bytes (fcp_rsp_iu_t) there for isp_put_fcp_rsp_iu(). MFC after:1 month Modified: head/sys/dev/isp/isp_freebsd.c Modified: head/sys/dev/isp/isp_freebsd.c == --- head/sys/dev/isp/isp_freebsd.c Wed Nov 18 02:05:59 2020 (r367780) +++ head/sys/dev/isp/isp_freebsd.c Wed Nov 18 02:12:51 2020 (r367781) @@ -1285,8 +1285,7 @@ isp_target_start_ctio(ispsoftc_t *isp, union ccb *ccb, } } else { bus_addr_t addr; - char buf[XCMD_SIZE]; - fcp_rsp_iu_t *rp; + fcp_rsp_iu_t rp; if (atp->ests == NULL) { atp->ests = isp_get_ecmd(isp); @@ -1295,29 +1294,28 @@ isp_target_start_ctio(ispsoftc_t *isp, union ccb *ccb, break; } } - memset(buf, 0, sizeof (buf)); - rp = (fcp_rsp_iu_t *)buf; + memset(&rp, 0, sizeof(rp)); if (fctape) { cto->ct_flags |= CT7_CONFIRM|CT7_EXPLCT_CONF; - rp->fcp_rsp_bits |= FCP_CONF_REQ; + rp.fcp_rsp_bits |= FCP_CONF_REQ; } cto->ct_flags |= CT7_FLAG_MODE2; - rp->fcp_rsp_scsi_status = cso->scsi_status; + rp.fcp_rsp_scsi_status = cso->scsi_status; if (resid < 0) { - rp->fcp_rsp_resid = -resid; - rp->fcp_rsp_bits |= FCP_RESID_OVERFLOW; + rp.fcp_rsp_resid = -resid; + rp.fcp_rsp_bits |= FCP_RESID_OVERFLOW; } else if (resid > 0) { - rp->fcp_rsp_resid = resid; - rp->fcp_rsp_bits |= FCP_RESID_UNDERFLOW; + rp.fcp_rsp_resid = resid; + rp.fcp_rsp_bits |= FCP_RESID_UNDERFLOW; } if (sense_length) { - rp->fcp_rsp_snslen = sense_length; + rp.fcp_rsp_snslen = sense_length; cto->ct_senselen = sense_length; - rp->fcp_rsp_bits |= FCP_SNSLEN_VALID; - isp_put_fcp_rsp_iu(isp, rp, atp->ests); + rp.fcp_rsp_bits |= FCP_SNSLEN_VALID; + isp_put_fcp_rsp_iu(isp, &rp, atp->ests); memcpy(((fcp_rsp_iu_t *)atp->ests)->fcp_rsp_extra, &cso->sense_data, sense_length); } else { - isp_put_fcp_rsp_iu(isp, rp, atp->ests); + isp_put_fcp_rsp_iu(isp, &rp, atp->ests); } if (isp->isp_dblev & ISP_LOGTDEBUG1) { isp_print_bytes(isp, "FCP Response Frame After Swizzling", MIN_FCP_RESPONSE_SIZE + sense_length, atp->ests); @@ -1437,8 +1435,7 @@ isp_target_start_ctio(ispsoftc_t *isp, union ccb *ccb, } } else { bus_addr_t addr; - char buf[XCMD_SIZE]; - fcp_rsp_iu_t *rp; + fcp_rsp_iu_t rp; if (atp->ests == NULL) { atp->ests = isp_get_ecmd(isp); @@ -1447,28 +1444,27 @@ isp_target_start_ctio(ispsoftc_t *isp, union ccb *ccb, break;
svn commit: r367782 - head/sys/dev/isp
Author: mav Date: Wed Nov 18 02:54:05 2020 New Revision: 367782 URL: https://svnweb.freebsd.org/changeset/base/367782 Log: Remove bus_dma locking/sleeping when not needed. MFC after:1 month Modified: head/sys/dev/isp/isp_pci.c Modified: head/sys/dev/isp/isp_pci.c == --- head/sys/dev/isp/isp_pci.c Wed Nov 18 02:12:51 2020(r367781) +++ head/sys/dev/isp/isp_pci.c Wed Nov 18 02:54:05 2020(r367782) @@ -1520,8 +1520,7 @@ isp_pci_mbxdma(ispsoftc_t *isp) len += (N_XCMDS * XCMD_SIZE); if (bus_dma_tag_create(isp->isp_osinfo.dmat, QENTRY_LEN, slim, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, - len, 1, len, 0, busdma_lock_mutex, &isp->isp_lock, - &isp->isp_osinfo.reqdmat)) { + len, 1, len, 0, NULL, NULL, &isp->isp_osinfo.reqdmat)) { isp_prt(isp, ISP_LOGERR, "cannot create request DMA tag"); goto bad; } @@ -1534,7 +1533,7 @@ isp_pci_mbxdma(ispsoftc_t *isp) isp->isp_rquest = base; im.error = 0; if (bus_dmamap_load(isp->isp_osinfo.reqdmat, isp->isp_osinfo.reqmap, - base, len, imc, &im, 0) || im.error) { + base, len, imc, &im, BUS_DMA_NOWAIT) || im.error) { isp_prt(isp, ISP_LOGERR, "error loading request DMA map %d", im.error); goto bad; } @@ -1562,8 +1561,7 @@ isp_pci_mbxdma(ispsoftc_t *isp) len = ISP_QUEUE_SIZE(RESULT_QUEUE_LEN(isp)); if (bus_dma_tag_create(isp->isp_osinfo.dmat, QENTRY_LEN, slim, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, - len, 1, len, 0, busdma_lock_mutex, &isp->isp_lock, - &isp->isp_osinfo.respdmat)) { + len, 1, len, 0, NULL, NULL, &isp->isp_osinfo.respdmat)) { isp_prt(isp, ISP_LOGERR, "cannot create response DMA tag"); goto bad; } @@ -1576,7 +1574,7 @@ isp_pci_mbxdma(ispsoftc_t *isp) isp->isp_result = base; im.error = 0; if (bus_dmamap_load(isp->isp_osinfo.respdmat, isp->isp_osinfo.respmap, - base, len, imc, &im, 0) || im.error) { + base, len, imc, &im, BUS_DMA_NOWAIT) || im.error) { isp_prt(isp, ISP_LOGERR, "error loading response DMA map %d", im.error); goto bad; } @@ -1592,8 +1590,7 @@ isp_pci_mbxdma(ispsoftc_t *isp) len = ISP_QUEUE_SIZE(RESULT_QUEUE_LEN(isp)); if (bus_dma_tag_create(isp->isp_osinfo.dmat, QENTRY_LEN, slim, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, - len, 1, len, 0, busdma_lock_mutex, &isp->isp_lock, - &isp->isp_osinfo.atiodmat)) { + len, 1, len, 0, NULL, NULL, &isp->isp_osinfo.atiodmat)) { isp_prt(isp, ISP_LOGERR, "cannot create ATIO DMA tag"); goto bad; } @@ -1606,7 +1603,7 @@ isp_pci_mbxdma(ispsoftc_t *isp) isp->isp_atioq = base; im.error = 0; if (bus_dmamap_load(isp->isp_osinfo.atiodmat, isp->isp_osinfo.atiomap, - base, len, imc, &im, 0) || im.error) { + base, len, imc, &im, BUS_DMA_NOWAIT) || im.error) { isp_prt(isp, ISP_LOGERR, "error loading ATIO DMA map %d", im.error); goto bad; } @@ -1619,8 +1616,8 @@ isp_pci_mbxdma(ispsoftc_t *isp) if (IS_FC(isp)) { if (bus_dma_tag_create(isp->isp_osinfo.dmat, 64, slim, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, - 2*QENTRY_LEN, 1, 2*QENTRY_LEN, 0, busdma_lock_mutex, - &isp->isp_lock, &isp->isp_osinfo.iocbdmat)) { + 2*QENTRY_LEN, 1, 2*QENTRY_LEN, 0, NULL, NULL, + &isp->isp_osinfo.iocbdmat)) { goto bad; } if (bus_dmamem_alloc(isp->isp_osinfo.iocbdmat, @@ -1629,14 +1626,14 @@ isp_pci_mbxdma(ispsoftc_t *isp) isp->isp_iocb = base; im.error = 0; if (bus_dmamap_load(isp->isp_osinfo.iocbdmat, isp->isp_osinfo.iocbmap, - base, 2*QENTRY_LEN, imc, &im, 0) || im.error) + base, 2*QENTRY_LEN, imc, &im, BUS_DMA_NOWAIT) || im.error) goto bad; isp->isp_iocb_dma = im.maddr; if (bus_dma_tag_create(isp->isp_osinfo.dmat, 64, slim, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, - ISP_FC_SCRLEN, 1, ISP_FC_SCRLEN, 0, busdma_lock_mutex, - &isp->isp_lock, &isp->isp_osinfo.scdmat)) + ISP_FC_SCRLEN, 1, ISP_FC_SCRLEN, 0, NULL, NULL, + &isp->isp_osinfo.scdmat)) goto bad; for (cmap = 0; cmap <
svn commit: r367783 - head/sys/kern
Author: kevans Date: Wed Nov 18 03:30:31 2020 New Revision: 367783 URL: https://svnweb.freebsd.org/changeset/base/367783 Log: _umtx_op: fix robust lists after r367744 A copy-pasto left us copying in 24-bytes at the address of the rb pointer instead of the intended target. Reported by: sig...@gmail.com Sighing: kevans Modified: head/sys/kern/kern_umtx.c Modified: head/sys/kern/kern_umtx.c == --- head/sys/kern/kern_umtx.c Wed Nov 18 02:54:05 2020(r367782) +++ head/sys/kern/kern_umtx.c Wed Nov 18 03:30:31 2020(r367783) @@ -3431,7 +3431,7 @@ umtx_copyin_robust_lists(const void *uaddr, size_t siz if (size > sizeof(*rb)) return (EINVAL); - return (copyin(uaddr, &rb, size)); + return (copyin(uaddr, rb, size)); } static int ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r367784 - head/sys/dev/isp
Author: mav Date: Wed Nov 18 03:43:03 2020 New Revision: 367784 URL: https://svnweb.freebsd.org/changeset/base/367784 Log: Move ecmd memory allocation itto separate DMA tag. Ecmd memory is not directly related to the request queue, only referenced from it sometimes in target mode. Separate allocation should be easier in case of fragmented memory and can be skipped when target is not built. MFC after:1 month Modified: head/sys/dev/isp/isp_freebsd.c head/sys/dev/isp/isp_freebsd.h head/sys/dev/isp/isp_pci.c Modified: head/sys/dev/isp/isp_freebsd.c == --- head/sys/dev/isp/isp_freebsd.c Wed Nov 18 03:30:31 2020 (r367783) +++ head/sys/dev/isp/isp_freebsd.c Wed Nov 18 03:43:03 2020 (r367784) @@ -1320,6 +1320,7 @@ isp_target_start_ctio(ispsoftc_t *isp, union ccb *ccb, if (isp->isp_dblev & ISP_LOGTDEBUG1) { isp_print_bytes(isp, "FCP Response Frame After Swizzling", MIN_FCP_RESPONSE_SIZE + sense_length, atp->ests); } + bus_dmamap_sync(isp->isp_osinfo.ecmd_dmat, isp->isp_osinfo.ecmd_map, BUS_DMASYNC_PREWRITE); addr = isp->isp_osinfo.ecmd_dma; addr += isp_ecmd_t *)atp->ests) - isp->isp_osinfo.ecmd_base) * XCMD_SIZE); isp_prt(isp, ISP_LOGTDEBUG0, "%s: ests base %p vaddr %p ecmd_dma %jx addr %jx len %u", __func__, isp->isp_osinfo.ecmd_base, atp->ests, @@ -1469,6 +1470,7 @@ isp_target_start_ctio(ispsoftc_t *isp, union ccb *ccb, if (isp->isp_dblev & ISP_LOGTDEBUG1) { isp_print_bytes(isp, "FCP Response Frame After Swizzling", MIN_FCP_RESPONSE_SIZE + sense_length, atp->ests); } + bus_dmamap_sync(isp->isp_osinfo.ecmd_dmat, isp->isp_osinfo.ecmd_map, BUS_DMASYNC_PREWRITE); addr = isp->isp_osinfo.ecmd_dma; addr += isp_ecmd_t *)atp->ests) - isp->isp_osinfo.ecmd_base) * XCMD_SIZE); isp_prt(isp, ISP_LOGTDEBUG0, "%s: ests base %p vaddr %p ecmd_dma %jx addr %jx len %u", __func__, isp->isp_osinfo.ecmd_base, atp->ests, @@ -4309,6 +4311,7 @@ isp_timer(void *arg) callout_reset(&isp->isp_osinfo.tmo, isp_timer_count, isp_timer, isp); } +#ifdef ISP_TARGET_MODE isp_ecmd_t * isp_get_ecmd(ispsoftc_t *isp) { @@ -4325,3 +4328,4 @@ isp_put_ecmd(ispsoftc_t *isp, isp_ecmd_t *ecmd) ecmd->next = isp->isp_osinfo.ecmd_free; isp->isp_osinfo.ecmd_free = ecmd; } +#endif Modified: head/sys/dev/isp/isp_freebsd.h == --- head/sys/dev/isp/isp_freebsd.h Wed Nov 18 03:30:31 2020 (r367783) +++ head/sys/dev/isp/isp_freebsd.h Wed Nov 18 03:43:03 2020 (r367784) @@ -75,6 +75,7 @@ #defineISP_IFLAGS INTR_TYPE_CAM | INTR_ENTROPY | INTR_MPSAFE +#ifdef ISP_TARGET_MODE #defineN_XCMDS 64 #defineXCMD_SIZE 512 struct ispsoftc; @@ -85,7 +86,6 @@ typedef union isp_ecmd { isp_ecmd_t * isp_get_ecmd(struct ispsoftc *); void isp_put_ecmd(struct ispsoftc *, isp_ecmd_t *); -#ifdef ISP_TARGET_MODE #defineATPDPSIZE 4096 #defineATPDPHASHSIZE 32 #defineATPDPHASH(x)x) >> 24) ^ ((x) >> 16) ^ ((x) >> 8) ^ (x)) & \ @@ -305,9 +305,13 @@ struct isposinfo { int exec_throttle; int cont_max; +#ifdef ISP_TARGET_MODE + bus_dma_tag_t ecmd_dmat; + bus_dmamap_tecmd_map; bus_addr_t ecmd_dma; isp_ecmd_t *ecmd_base; isp_ecmd_t *ecmd_free; +#endif /* * Per-type private storage... Modified: head/sys/dev/isp/isp_pci.c == --- head/sys/dev/isp/isp_pci.c Wed Nov 18 03:30:31 2020(r367783) +++ head/sys/dev/isp/isp_pci.c Wed Nov 18 03:43:03 2020(r367784) @@ -1476,7 +1476,6 @@ isp_pci_mbxdma(ispsoftc_t *isp) bus_addr_t llim;/* low limit of unavailable dma */ bus_addr_t hlim;/* high limit of unavailable dma */ struct imush im; - isp_ecmd_t *ecmd; /* Already been here? If so, leave... */ if (isp->isp_xflist != NULL) @@ -1512,12 +1511,9 @@ isp_pci_mbxdma(ispsoftc_t *isp) } /* -* Allocate and map the request queue and a region for external -* DMA addressable command/status structures (22XX and later). +
svn commit: r367785 - in head/sys: fs/nfs nfsserver
Author: asomers Date: Wed Nov 18 04:35:49 2020 New Revision: 367785 URL: https://svnweb.freebsd.org/changeset/base/367785 Log: nfs: Mark unused statistics variable as reserved FreeBSD's NFS exporter has long exported some unused statistics fields. Revision r366992 removed them from nfsstat. This revision renames those fields in the kernel's exported structures to make it clear to other consumers that they are unused. Reported by: emaste Reviewed by: emaste Sponsored by: Axcient Differential Revision:https://reviews.freebsd.org/D27258 Modified: head/sys/fs/nfs/nfs_commonport.c head/sys/fs/nfs/nfsport.h head/sys/nfsserver/nfsrvstats.h Modified: head/sys/fs/nfs/nfs_commonport.c == --- head/sys/fs/nfs/nfs_commonport.cWed Nov 18 03:43:03 2020 (r367784) +++ head/sys/fs/nfs/nfs_commonport.cWed Nov 18 04:35:49 2020 (r367785) @@ -541,16 +541,15 @@ nfssvc_call(struct thread *p, struct nfssvc_args *uap, i < NFSV42_NOPS + NFSV4OP_FAKENOPS; i++, j++) oldnfsstats.srvrpccnt[j] = nfsstatsv1.srvrpccnt[i]; - oldnfsstats.srvrpc_errs = nfsstatsv1.srvrpc_errs; - oldnfsstats.srv_errs = nfsstatsv1.srv_errs; + oldnfsstats.reserved_0 = 0; + oldnfsstats.reserved_1 = 0; oldnfsstats.rpcrequests = nfsstatsv1.rpcrequests; oldnfsstats.rpctimeouts = nfsstatsv1.rpctimeouts; oldnfsstats.rpcunexpected = nfsstatsv1.rpcunexpected; oldnfsstats.rpcinvalid = nfsstatsv1.rpcinvalid; oldnfsstats.srvcache_inproghits = nfsstatsv1.srvcache_inproghits; - oldnfsstats.srvcache_idemdonehits = - nfsstatsv1.srvcache_idemdonehits; + oldnfsstats.reserved_2 = 0; oldnfsstats.srvcache_nonidemdonehits = nfsstatsv1.srvcache_nonidemdonehits; oldnfsstats.srvcache_misses = @@ -636,10 +635,8 @@ nfssvc_call(struct thread *p, struct nfssvc_args *uap, i++, j++) nfsstatsov1.srvrpccnt[j] = nfsstatsv1.srvrpccnt[i]; - nfsstatsov1.srvrpc_errs = - nfsstatsv1.srvrpc_errs; - nfsstatsov1.srv_errs = - nfsstatsv1.srv_errs; + nfsstatsov1.reserved_0 = 0; + nfsstatsov1.reserved_1 = 0; nfsstatsov1.rpcrequests = nfsstatsv1.rpcrequests; nfsstatsov1.rpctimeouts = @@ -650,8 +647,7 @@ nfssvc_call(struct thread *p, struct nfssvc_args *uap, nfsstatsv1.rpcinvalid; nfsstatsov1.srvcache_inproghits = nfsstatsv1.srvcache_inproghits; - nfsstatsov1.srvcache_idemdonehits = - nfsstatsv1.srvcache_idemdonehits; + nfsstatsov1.reserved_2 = 0; nfsstatsov1.srvcache_nonidemdonehits = nfsstatsv1.srvcache_nonidemdonehits; nfsstatsov1.srvcache_misses = @@ -750,10 +746,7 @@ nfssvc_call(struct thread *p, struct nfssvc_args *uap, sizeof(nfsstatsv1.rpccnt)); } if ((uap->flag & NFSSVC_ZEROSRVSTATS) != 0) { - nfsstatsv1.srvrpc_errs = 0; - nfsstatsv1.srv_errs = 0; nfsstatsv1.srvcache_inproghits = 0; - nfsstatsv1.srvcache_idemdonehits = 0; nfsstatsv1.srvcache_nonidemdonehits = 0; nfsstatsv1.srvcache_misses = 0; nfsstatsv1.srvcache_tcppeak = 0; Modified: head/sys/fs/nfs/nfsport.h == --- head/sys/fs/nfs/nfsport.h Wed Nov 18 03:43:03 2020(r367784) +++ head/sys/fs/nfs/nfsport.h Wed Nov 18 04:35:49 2020(r367785) @@ -447,14 +447,14 @@ struct nfsstatsv1 { uint64_trpccnt[NFSV42_NPROCS + 15]; uint64_trpcretries; uint64_tsr
Re: svn commit: r367713 - head/sys/kern
On Tue, Nov 17, 2020 at 03:36:31PM +0100, Mateusz Guzik wrote: > On 11/17/20, Konstantin Belousov wrote: > > On Tue, Nov 17, 2020 at 04:15:12AM +0100, Mateusz Guzik wrote: > >> On 11/17/20, Konstantin Belousov wrote: > >> > On Mon, Nov 16, 2020 at 03:09:19AM +, Mateusz Guzik wrote: > >> >> Author: mjg > >> >> Date: Mon Nov 16 03:09:18 2020 > >> >> New Revision: 367713 > >> >> URL: https://svnweb.freebsd.org/changeset/base/367713 > >> >> > >> >> Log: > >> >> select: replace reference counting with memory barriers in selfd > >> >> > >> >> Refcounting was added to combat a race between selfdfree and > >> >> doselwakup, > >> >> but it adds avoidable overhead. > >> >> > >> >> selfdfree detects it can free the object by ->sf_si == NULL, thus we > >> >> can > >> >> ensure that the condition only holds after all accesses are > >> >> completed. > >> >> > >> >> Modified: > >> >> head/sys/kern/sys_generic.c > >> >> > >> >> Modified: head/sys/kern/sys_generic.c > >> >> == > >> >> --- head/sys/kern/sys_generic.c Sun Nov 15 22:49:28 2020 > >> >> (r367712) > >> >> +++ head/sys/kern/sys_generic.c Mon Nov 16 03:09:18 2020 > >> >> (r367713) > >> >> @@ -156,7 +156,6 @@ struct selfd { > >> >> struct mtx *sf_mtx;/* Pointer to selinfo > >> >> mtx. */ > >> >> struct seltd*sf_td; /* (k) owning seltd. */ > >> >> void*sf_cookie; /* (k) fd or pollfd. */ > >> >> - u_int sf_refs; > >> >> }; > >> >> > >> >> MALLOC_DEFINE(M_SELFD, "selfd", "selfd"); > >> >> @@ -1704,16 +1703,17 @@ static void > >> >> selfdfree(struct seltd *stp, struct selfd *sfp) > >> >> { > >> >> STAILQ_REMOVE(&stp->st_selq, sfp, selfd, sf_link); > >> >> - if (sfp->sf_si != NULL) { > >> >> + /* > >> >> +* Paired with doselwakeup. > >> >> +*/ > >> >> + if (atomic_load_acq_ptr((uintptr_t *)&sfp->sf_si) != > >> >> (uintptr_t)NULL) > >> >> { > >> > This could be != 0. > >> > > >> >> mtx_lock(sfp->sf_mtx); > >> >> if (sfp->sf_si != NULL) { > >> >> TAILQ_REMOVE(&sfp->sf_si->si_tdlist, sfp, > >> >> sf_threads); > >> >> - refcount_release(&sfp->sf_refs); > >> >> } > >> >> mtx_unlock(sfp->sf_mtx); > >> >> } > >> >> - if (refcount_release(&sfp->sf_refs)) > >> >> - free(sfp, M_SELFD); > >> >> + free(sfp, M_SELFD); > >> > What guarantees that doselwakeup() finished with sfp ? > >> > > >> > >> Release semantics provided by atomic_store_rel_ptr -- it means the > >> NULL store is the last access, neither CPU nor the compiler are going > >> to reorder preceding loads/stores past it. > > It only guarantees that if we observed NULL as the result of load. > > > > If that did not happen selfdfree takes the lock. If the entry is still > there, it removes it and doselwakeup will not see it after it takes > the lock. If the entry is not there, doselwaekup is done with it > because it released the lock. I still do not understand it. selfdfree() indeed takes sf_mtx and rechecks sf_si. But what prevents doselwakeup() to store NULL into sf_si at any moment. e.g. after free() is done ? selfdfree() takes seltd mutex, not selinfo. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"