Re: svn commit: r355382 - head/sys/dev/pci
> Author: se > Date: Wed Dec 4 08:03:33 2019 > New Revision: 355382 > URL: https://svnweb.freebsd.org/changeset/base/355382 > > Log: > Remove "All rights reserved" phrase from copyright notes. > > With the ratification of the Berne Convention in 2000, it became obsolete. > > I have removed that phrase and the "(c)" only from files without copyright > claims by other parties. There are 2 files (pci.c, pci_private.h) that are > also claimed by Michael Smith and by BSDi, which have > therefore not been included in this commit. > > When all member nations of the Buenos Aires Convention adopted the Berne > Convention, the phrase "All rights reserved" became unnecessary to assert > copyright. Remove it from files under my copyright. > > There are 2 files (pci.c, pci_private.h) that) that do also bear msmith's > and BSDi's copyright. I have left them unchanged for now, since I do not > know whether they (or the legal successor in case of BSDi) would agree. Picking one last one at random. I am not who or why this effort to clean up the All Rights Reserved strings got started, but I am very glad to see it happening. To all who have or shall do this a big THANK You. Regards, Rod > Modified: > head/sys/dev/pci/hostb_pci.c > head/sys/dev/pci/pci_user.c > head/sys/dev/pci/pcireg.h > head/sys/dev/pci/pcivar.h > > Modified: head/sys/dev/pci/hostb_pci.c > == > --- head/sys/dev/pci/hostb_pci.c Wed Dec 4 04:01:53 2019 > (r355381) > +++ head/sys/dev/pci/hostb_pci.c Wed Dec 4 08:03:33 2019 > (r355382) > @@ -1,8 +1,7 @@ > /*- > * SPDX-License-Identifier: BSD-2-Clause-FreeBSD > * > - * Copyright (c) 1997, Stefan Esser > - * All rights reserved. > + * Copyright 1997, Stefan Esser > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions > > Modified: head/sys/dev/pci/pci_user.c > == > --- head/sys/dev/pci/pci_user.c Wed Dec 4 04:01:53 2019 > (r355381) > +++ head/sys/dev/pci/pci_user.c Wed Dec 4 08:03:33 2019 > (r355382) > @@ -1,8 +1,7 @@ > /*- > * SPDX-License-Identifier: BSD-2-Clause-FreeBSD > * > - * Copyright (c) 1997, Stefan Esser > - * All rights reserved. > + * Copyright 1997, Stefan Esser > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions > > Modified: head/sys/dev/pci/pcireg.h > == > --- head/sys/dev/pci/pcireg.h Wed Dec 4 04:01:53 2019(r355381) > +++ head/sys/dev/pci/pcireg.h Wed Dec 4 08:03:33 2019(r355382) > @@ -1,8 +1,7 @@ > /*- > * SPDX-License-Identifier: BSD-2-Clause-FreeBSD > * > - * Copyright (c) 1997, Stefan Esser > - * All rights reserved. > + * Copyright 1997, Stefan Esser > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions > > Modified: head/sys/dev/pci/pcivar.h > == > --- head/sys/dev/pci/pcivar.h Wed Dec 4 04:01:53 2019(r355381) > +++ head/sys/dev/pci/pcivar.h Wed Dec 4 08:03:33 2019(r355382) > @@ -1,8 +1,7 @@ > /*- > * SPDX-License-Identifier: BSD-2-Clause-FreeBSD > * > - * Copyright (c) 1997, Stefan Esser > - * All rights reserved. > + * Copyright 1997, Stefan Esser > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions > -- Rod Grimes rgri...@freebsd.org ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r355301 - head/usr.sbin/bhyve
> I see, thanks for the pointers. > It looks like cfmakeraw() and tcsetattr() were what I was looking for. > A bhyve-specific printf wrapper looks the right solution to me. > I can try to sketch a patch for you guys to review, if that's useful. > > Cheers, > Vincenzo Meanwhile could you please revert the commit, and add a note to D22552 to the effects that this was not the right solution? Thanks, Rod > Il giorno mar 3 dic 2019 alle ore 18:38 John Baldwin ha > scritto: > > > On 12/3/19 7:14 AM, Ian Lepore wrote: > > > On Mon, 2019-12-02 at 23:22 -0800, Rodney W. Grimes wrote: > > >>> On Mon, 2019-12-02 at 20:51 +, Vincenzo Maffione wrote: > > Author: vmaffione > > Date: Mon Dec 2 20:51:46 2019 > > New Revision: 355301 > > URL: https://svnweb.freebsd.org/changeset/base/355301 > > > > Log: > > bhyve: uniform printf format string newlines > > > > Some of the printf statements only use LF to get a newline. > > However, a CR character is also required for the serial console to > > print debug logs in a nice way. > > Fix those code locations that only use LF, by adding a CR > > character. > > > > Reviewed by: markj, aleksandr.fedo...@itglobal.com > > MFC after: 1 week > > Differential Revision: https://reviews.freebsd.org/D22552 > > > > Modified: > > head/usr.sbin/bhyve/audio.c > > head/usr.sbin/bhyve/hda_codec.c > > head/usr.sbin/bhyve/net_backends.c > > head/usr.sbin/bhyve/pci_ahci.c > > head/usr.sbin/bhyve/pci_e82545.c > > head/usr.sbin/bhyve/pci_hda.c > > head/usr.sbin/bhyve/pci_nvme.c > > head/usr.sbin/bhyve/pci_virtio_block.c > > head/usr.sbin/bhyve/pci_virtio_console.c > > head/usr.sbin/bhyve/pci_virtio_net.c > > head/usr.sbin/bhyve/pci_virtio_rnd.c > > head/usr.sbin/bhyve/pci_virtio_scsi.c > > head/usr.sbin/bhyve/pci_xhci.c > > head/usr.sbin/bhyve/rfb.c > > > > >>> > > >>> These changes seem wrong in a couple ways... > > >>> > > >>> - Lines are terminated by linefeeds in unix-like systems. If > > >>> linefeeds need to be translated to include carriage returns, that's the > > >>> responsibility of the terminal/line-discipline layer, not the source > > >>> strings being printed. > > >> > > >> Fully agree, this change seems wrong to me for Ian's stated reason here. > > >> > > >>> > > >>> - The sequence \n\r is very strange. For systems that do prefer > > >>> carriage returns, the \r always comes before the \n (or stands alone on > > >>> Mac systems), not after. > > >>> > > >>> I have a feeling that the root of this is something like "lots of > > >>> people use bhyve for Windows, so they use Windows apps to look at logs, > > >>> so the logs should be formatted for Windows." If that's the reasoning, > > >>> then why shouldn't we convert EVERY printf in the source base to > > >>> include carriage returns, just in case a windows user wants to browse a > > >>> log file? > > >> > > >> This is not that issue, it is something going on with the line > > >> discipline when using the bhyve console device. I believe the > > >> line displine being different from what bhyve itself is expecting > > >> so when console output is intermixed with output from bhyve itself > > >> things go wrong. > > >> > > >> The printf's in this patch are coming from the bhyve process that > > >> has a fd open to the launching tty, the line discipline on that tty > > >> is changed to something different after you open the > > >> console device from that same controlling tty, or that is my hypothosis > > >> on what is going wrong. > > > > > > There is a cfmakeraw() call in usr.sbin/bhyve/consport.c; that would > > > definitely turn off nl->crnl translations. I think that is the other > > > end of the bhyve console that I posted a patch for yesterday, and I > > > think the console driver is probably still the right place to do that > > > translation (because other console drivers do it that way). But I'm > > > not set up to run bhyve here, so I can't test my theory. > > > > That patch won't work alone. Most people don't use bvmcons, most people > > running bhyve use a standard uart as the console (bvmcons was an early > > console devices before bhyve had a ns8250 uart device model). When using > > the uart as the device model you still have raw output in the bhyve > > process itself. (See cfmakeraw() in uart_emul.c as well). We don't > > get to change how guest OS's use a uart, so any changes have to be in > > usr.sbin/bhyve, not in sys/. > > > > However, to do that you have to actually do something more complicated to > > turn \r\n and \n\r sequences from the guest into plain \n to stdout while > > still DTRT for "bare" \r and \n characters. You also have to make sure > > you do the right thing for input and not just output in the device models. > > > > I'm not quite a fan of this commit as-is since
Re: svn commit: r355362 - in stable/12: share/man/man4 sys/dev/imcsmb sys/dev/jedec_dimm
> Author: rpokala > Date: Tue Dec 3 22:49:24 2019 > New Revision: 355362 > URL: https://svnweb.freebsd.org/changeset/base/355362 > > Log: > MFC r343583: > > Remove unecessary "All rights reserved" from files under my or Panasas's > copyright. > > When all member nations of the Buenos Aires Convention adopted the Berne > Convention, the phrase "All rights reserved" became unnecessary to assert > copyright. Remove it from files under my or Panasas's copyright. The files > related to jedec_dimm(4) also bear avg@'s copyright; he has approved this > change. Thank you! -- Rod Grimes rgri...@freebsd.org ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r355330 - head/share/man/man9
> Author: imp > Date: Tue Dec 3 15:48:28 2019 > New Revision: 355330 > URL: https://svnweb.freebsd.org/changeset/base/355330 > > Log: > Regularize copyright notices for me. > > Remove stray All Rights Reserved and other non-license stuff. Make sure all > copyrights have year. Thank you! -- Rod Grimes rgri...@freebsd.org ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r355412 - head/sys/geom
Hi. On 05.12.2019 00:00, Ravi Pokala wrote: > -Original Message- > From: on behalf of Alexander Motin > > Date: 2019-12-04, Wednesday at 20:52 > To: , , > > Subject: svn commit: r355412 - head/sys/geom > > Author: mav > Date: Thu Dec 5 04:52:19 2019 > New Revision: 355412 > URL: https://svnweb.freebsd.org/changeset/base/355412 > > Log: > Wrap g_trace() into a macro to avoid unneeded calls. > > In most cases with debug disabled this function does nothing, but > argument > passing and the call still cost measurable time due to cache misses, > etc. > > Hi Alexander, > > I'm having trouble understanding this change, on a few levels. > > - Why did you add parentheses around the function declaration and definition? To make pre-processor not replace them also. > - How can that function with that name co-exist with a macro of the same name? The macro is handled first by pre-processor, compiler goes second on the result. > - Isn't the "g_debugflags" test in geom_dump.c:g_trace() now redundant? > - Why not simply convert geom_dump.c:g_trace() into a 'static inline' in > geom.h, and not have to bother with the macro at all? One answer to both questions: compatibility with already built modules require the function to be present and behave same as before, while newly built code should be more efficient without changes. > What am I missing? > > Thanks, > > Ravi (rpokala@) > > MFC after: 2 weeks > Sponsored by: iXsystems, Inc. > > Modified: > head/sys/geom/geom.h > head/sys/geom/geom_dump.c > > Modified: head/sys/geom/geom.h > > == > --- head/sys/geom/geom.h Thu Dec 5 04:18:22 2019(r355411) > +++ head/sys/geom/geom.h Thu Dec 5 04:52:19 2019(r355412) > @@ -255,11 +255,15 @@ void g_dev_physpath_changed(void); > struct g_provider *g_dev_getprovider(struct cdev *dev); > > /* geom_dump.c */ > -void g_trace(int level, const char *, ...); > +void (g_trace)(int level, const char *, ...) __printflike(2, 3); > #define G_T_TOPOLOGY 1 > #define G_T_BIO 2 > #define G_T_ACCESS 4 > - > +extern int g_debugflags; > +#define g_trace(level, fmt, ...) do { \ > + if (__predict_false(g_debugflags & (level)))\ > + (g_trace)(level, fmt, ## __VA_ARGS__); \ > +} while (0) > > /* geom_event.c */ > typedef void g_event_t(void *, int flag); > > Modified: head/sys/geom/geom_dump.c > > == > --- head/sys/geom/geom_dump.c Thu Dec 5 04:18:22 2019 > (r355411) > +++ head/sys/geom/geom_dump.c Thu Dec 5 04:52:19 2019 > (r355412) > @@ -319,7 +319,7 @@ g_confxml(void *p, int flag) > } > > void > -g_trace(int level, const char *fmt, ...) > +(g_trace)(int level, const char *fmt, ...) > { > va_list ap; -- Alexander Motin ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r355412 - head/sys/geom
On Wed, Dec 4, 2019, 10:01 PM Ravi Pokala wrote: > -Original Message- > From: on behalf of Alexander Motin > > Date: 2019-12-04, Wednesday at 20:52 > To: , , < > svn-src-h...@freebsd.org> > Subject: svn commit: r355412 - head/sys/geom > > Author: mav > Date: Thu Dec 5 04:52:19 2019 > New Revision: 355412 > URL: https://svnweb.freebsd.org/changeset/base/355412 > > Log: > Wrap g_trace() into a macro to avoid unneeded calls. > > In most cases with debug disabled this function does nothing, but > argument > passing and the call still cost measurable time due to cache misses, > etc. > > Hi Alexander, > > I'm having trouble understanding this change, on a few levels. > > - Why did you add parentheses around the function declaration and > definition? > To prevent macro expansion. - How can that function with that name co-exist with a macro of the same > name? > See above. - Isn't the "g_debugflags" test in geom_dump.c:g_trace() now redundant? > I think so... - Why not simply convert geom_dump.c:g_trace() into a 'static inline' in > geom.h, and not have to bother with the macro at all? > I'd have done that :) you wouldn't have that weird (corner) of the language exposed... but the static inline might have been bigger... Warner What am I missing? > > Thanks, > > Ravi (rpokala@) > > MFC after:2 weeks > Sponsored by: iXsystems, Inc. > > Modified: > head/sys/geom/geom.h > head/sys/geom/geom_dump.c > > Modified: head/sys/geom/geom.h > > == > --- head/sys/geom/geom.hThu Dec 5 04:18:22 2019(r355411) > +++ head/sys/geom/geom.hThu Dec 5 04:52:19 2019(r355412) > @@ -255,11 +255,15 @@ void g_dev_physpath_changed(void); > struct g_provider *g_dev_getprovider(struct cdev *dev); > > /* geom_dump.c */ > -void g_trace(int level, const char *, ...); > +void (g_trace)(int level, const char *, ...) __printflike(2, 3); > # define G_T_TOPOLOGY 1 > # define G_T_BIO 2 > # define G_T_ACCESS 4 > - > +extern int g_debugflags; > +#defineg_trace(level, fmt, ...) do { \ > + if (__predict_false(g_debugflags & (level)))\ > + (g_trace)(level, fmt, ## __VA_ARGS__); \ > +} while (0) > > /* geom_event.c */ > typedef void g_event_t(void *, int flag); > > Modified: head/sys/geom/geom_dump.c > > == > --- head/sys/geom/geom_dump.c Thu Dec 5 04:18:22 2019 > (r355411) > +++ head/sys/geom/geom_dump.c Thu Dec 5 04:52:19 2019 > (r355412) > @@ -319,7 +319,7 @@ g_confxml(void *p, int flag) > } > > void > -g_trace(int level, const char *fmt, ...) > +(g_trace)(int level, const char *fmt, ...) > { > va_list ap; > > > > > ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r355412 - head/sys/geom
-Original Message- From: on behalf of Alexander Motin Date: 2019-12-04, Wednesday at 20:52 To: , , Subject: svn commit: r355412 - head/sys/geom Author: mav Date: Thu Dec 5 04:52:19 2019 New Revision: 355412 URL: https://svnweb.freebsd.org/changeset/base/355412 Log: Wrap g_trace() into a macro to avoid unneeded calls. In most cases with debug disabled this function does nothing, but argument passing and the call still cost measurable time due to cache misses, etc. Hi Alexander, I'm having trouble understanding this change, on a few levels. - Why did you add parentheses around the function declaration and definition? - How can that function with that name co-exist with a macro of the same name? - Isn't the "g_debugflags" test in geom_dump.c:g_trace() now redundant? - Why not simply convert geom_dump.c:g_trace() into a 'static inline' in geom.h, and not have to bother with the macro at all? What am I missing? Thanks, Ravi (rpokala@) MFC after:2 weeks Sponsored by: iXsystems, Inc. Modified: head/sys/geom/geom.h head/sys/geom/geom_dump.c Modified: head/sys/geom/geom.h == --- head/sys/geom/geom.hThu Dec 5 04:18:22 2019(r355411) +++ head/sys/geom/geom.hThu Dec 5 04:52:19 2019(r355412) @@ -255,11 +255,15 @@ void g_dev_physpath_changed(void); struct g_provider *g_dev_getprovider(struct cdev *dev); /* geom_dump.c */ -void g_trace(int level, const char *, ...); +void (g_trace)(int level, const char *, ...) __printflike(2, 3); # define G_T_TOPOLOGY 1 # define G_T_BIO 2 # define G_T_ACCESS 4 - +extern int g_debugflags; +#defineg_trace(level, fmt, ...) do { \ + if (__predict_false(g_debugflags & (level)))\ + (g_trace)(level, fmt, ## __VA_ARGS__); \ +} while (0) /* geom_event.c */ typedef void g_event_t(void *, int flag); Modified: head/sys/geom/geom_dump.c == --- head/sys/geom/geom_dump.c Thu Dec 5 04:18:22 2019 (r355411) +++ head/sys/geom/geom_dump.c Thu Dec 5 04:52:19 2019 (r355412) @@ -319,7 +319,7 @@ g_confxml(void *p, int flag) } void -g_trace(int level, const char *fmt, ...) +(g_trace)(int level, const char *fmt, ...) { va_list ap; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r355412 - head/sys/geom
Author: mav Date: Thu Dec 5 04:52:19 2019 New Revision: 355412 URL: https://svnweb.freebsd.org/changeset/base/355412 Log: Wrap g_trace() into a macro to avoid unneeded calls. In most cases with debug disabled this function does nothing, but argument passing and the call still cost measurable time due to cache misses, etc. MFC after:2 weeks Sponsored by: iXsystems, Inc. Modified: head/sys/geom/geom.h head/sys/geom/geom_dump.c Modified: head/sys/geom/geom.h == --- head/sys/geom/geom.hThu Dec 5 04:18:22 2019(r355411) +++ head/sys/geom/geom.hThu Dec 5 04:52:19 2019(r355412) @@ -255,11 +255,15 @@ void g_dev_physpath_changed(void); struct g_provider *g_dev_getprovider(struct cdev *dev); /* geom_dump.c */ -void g_trace(int level, const char *, ...); +void (g_trace)(int level, const char *, ...) __printflike(2, 3); # define G_T_TOPOLOGY 1 # define G_T_BIO 2 # define G_T_ACCESS 4 - +extern int g_debugflags; +#defineg_trace(level, fmt, ...) do { \ + if (__predict_false(g_debugflags & (level)))\ + (g_trace)(level, fmt, ## __VA_ARGS__); \ +} while (0) /* geom_event.c */ typedef void g_event_t(void *, int flag); Modified: head/sys/geom/geom_dump.c == --- head/sys/geom/geom_dump.c Thu Dec 5 04:18:22 2019(r355411) +++ head/sys/geom/geom_dump.c Thu Dec 5 04:52:19 2019(r355412) @@ -319,7 +319,7 @@ g_confxml(void *p, int flag) } void -g_trace(int level, const char *fmt, ...) +(g_trace)(int level, const char *fmt, ...) { va_list ap; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r355411 - head/share/man/man7
Author: ian Date: Thu Dec 5 04:18:22 2019 New Revision: 355411 URL: https://svnweb.freebsd.org/changeset/base/355411 Log: Fix a trivial typo and add a missing word. Modified: head/share/man/man7/arch.7 Modified: head/share/man/man7/arch.7 == --- head/share/man/man7/arch.7 Thu Dec 5 04:03:08 2019(r355410) +++ head/share/man/man7/arch.7 Thu Dec 5 04:18:22 2019(r355411) @@ -145,7 +145,7 @@ symbol when compiling for an .Dv LP64 ABI. .Pp -Some machines support more that one +Some machines support more than one .Fx ABI. Typically these are 64-bit machines, where the @@ -154,7 +154,7 @@ Typically these are 64-bit machines, where the execution environment is accompanied by the .Dq legacy .Dv ILP32 -environment, which was historical 32-bit predecessor for 64-bit evolution. +environment, which was the historical 32-bit predecessor for 64-bit evolution. Examples are: .Bl -column -offset indent "Dv powerpc64" "Sy ILP32 counterpart" .It Sy LP64Ta Sy ILP32 counterpart ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r355410 - head/sys/geom
Author: mav Date: Thu Dec 5 04:03:08 2019 New Revision: 355410 URL: https://svnweb.freebsd.org/changeset/base/355410 Log: Switch GEOM_DEV from make_dev_p() to make_dev_s(). It closes the race condition and so allows to remove few NULL checks. Also while there, use dev->si_drv1 in addition to cp->private to store softc pointer. For calls coming from the dev side it gives reliable cache hit instead of often miss before. MFC after:2 weeks Sponsored by: iXsystems, Inc. Modified: head/sys/geom/geom_dev.c Modified: head/sys/geom/geom_dev.c == --- head/sys/geom/geom_dev.cThu Dec 5 02:01:47 2019(r355409) +++ head/sys/geom/geom_dev.cThu Dec 5 04:03:08 2019(r355410) @@ -334,6 +334,7 @@ g_dev_taste(struct g_class *mp, struct g_provider *pp, int error; struct cdev *dev, *adev; char buf[SPECNAMELEN + 6]; + struct make_dev_args args; g_trace(G_T_TOPOLOGY, "dev_taste(%s,%s)", mp->name, pp->name); g_topology_assert(); @@ -346,8 +347,17 @@ g_dev_taste(struct g_class *mp, struct g_provider *pp, error = g_attach(cp, pp); KASSERT(error == 0, ("g_dev_taste(%s) failed to g_attach, err=%d", pp->name, error)); - error = make_dev_p(MAKEDEV_CHECKNAME | MAKEDEV_WAITOK, , - _dev_cdevsw, NULL, UID_ROOT, GID_OPERATOR, 0640, "%s", gp->name); + + make_dev_args_init(); + args.mda_flags = MAKEDEV_CHECKNAME | MAKEDEV_WAITOK; + args.mda_devsw = _dev_cdevsw; + args.mda_cr = NULL; + args.mda_uid = UID_ROOT; + args.mda_gid = GID_OPERATOR; + args.mda_mode = 0640; + args.mda_si_drv1 = sc; + args.mda_si_drv2 = cp; + error = make_dev_s(, >sc_dev, "%s", gp->name); if (error != 0) { printf("%s: make_dev_p() failed (gp->name=%s, error=%d)\n", __func__, gp->name, error); @@ -358,11 +368,9 @@ g_dev_taste(struct g_class *mp, struct g_provider *pp, g_free(sc); return (NULL); } + dev = sc->sc_dev; dev->si_flags |= SI_UNMAPPED; - sc->sc_dev = dev; - dev->si_iosize_max = MAXPHYS; - dev->si_drv2 = cp; error = init_dumpdev(dev); if (error != 0) printf("%s: init_dumpdev() failed (gp->name=%s, error=%d)\n", @@ -397,8 +405,6 @@ g_dev_open(struct cdev *dev, int flags, int fmt, struc int error, r, w, e; cp = dev->si_drv2; - if (cp == NULL) - return (ENXIO); /* g_dev_taste() not done yet */ g_trace(G_T_ACCESS, "g_dev_open(%s, %d, %d, %p)", cp->geom->name, flags, fmt, td); @@ -429,7 +435,7 @@ g_dev_open(struct cdev *dev, int flags, int fmt, struc error = g_access(cp, r, w, e); g_topology_unlock(); if (error == 0) { - sc = cp->private; + sc = dev->si_drv1; mtx_lock(>sc_mtx); if (sc->sc_open == 0 && (sc->sc_active & SC_A_ACTIVE) != 0) wakeup(>sc_active); @@ -451,8 +457,6 @@ g_dev_close(struct cdev *dev, int flags, int fmt, stru int error, r, w, e; cp = dev->si_drv2; - if (cp == NULL) - return (ENXIO); g_trace(G_T_ACCESS, "g_dev_close(%s, %d, %d, %p)", cp->geom->name, flags, fmt, td); @@ -477,7 +481,7 @@ g_dev_close(struct cdev *dev, int flags, int fmt, stru if (r + w + e == 0) return (EINVAL); - sc = cp->private; + sc = dev->si_drv1; mtx_lock(>sc_mtx); sc->sc_open += r + w + e; if (sc->sc_open == 0) @@ -797,7 +801,6 @@ g_dev_strategy(struct bio *bp) ("Wrong bio_cmd bio=%p cmd=%d", bp, bp->bio_cmd)); dev = bp->bio_dev; cp = dev->si_drv2; - sc = cp->private; KASSERT(cp->acr || cp->acw, ("Consumer with zero access count in g_dev_strategy")); biotrack(bp, __func__); @@ -809,6 +812,7 @@ g_dev_strategy(struct bio *bp) return; } #endif + sc = dev->si_drv1; KASSERT(sc->sc_open > 0, ("Closed device in g_dev_strategy")); atomic_add_int(>sc_active, 1); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r355407 - head/sys/fs/tmpfs
On 5/12/2019 11:03 am, Konstantin Belousov wrote: Author: kib Date: Thu Dec 5 00:03:17 2019 New Revision: 355407 URL: https://svnweb.freebsd.org/changeset/base/355407 Could you elaborate on the why/rationale? Is there memory wastage/duplication, bug(s), performance or development/maintenance benefit? The review summary doesnt appear to include this information either Log: Stop using per-mount tmpfs zones. Requested and reviewed by: jeff Sponsored by:The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D22643 Modified: head/sys/fs/tmpfs/tmpfs.h head/sys/fs/tmpfs/tmpfs_subr.c head/sys/fs/tmpfs/tmpfs_vfsops.c Modified: head/sys/fs/tmpfs/tmpfs.h == --- head/sys/fs/tmpfs/tmpfs.h Wed Dec 4 23:24:40 2019(r355406) +++ head/sys/fs/tmpfs/tmpfs.h Thu Dec 5 00:03:17 2019(r355407) @@ -378,10 +378,6 @@ struct tmpfs_mount { /* All node lock to protect the node list and tmp_pages_used. */ struct mtx tm_allnode_lock; - /* Zones used to store file system meta data, per tmpfs mount. */ - uma_zone_t tm_dirent_pool; - uma_zone_t tm_node_pool; - /* Read-only status. */ booltm_ronly; /* Do not use namecache. */ @@ -493,8 +489,9 @@ struct tmpfs_dirent *tmpfs_dir_next(struct tmpfs_node #endif size_t tmpfs_mem_avail(void); - size_t tmpfs_pages_used(struct tmpfs_mount *tmp); +void tmpfs_subr_init(void); +void tmpfs_subr_uninit(void); #endif Modified: head/sys/fs/tmpfs/tmpfs_subr.c == --- head/sys/fs/tmpfs/tmpfs_subr.c Wed Dec 4 23:24:40 2019 (r355406) +++ head/sys/fs/tmpfs/tmpfs_subr.c Thu Dec 5 00:03:17 2019 (r355407) @@ -72,7 +72,74 @@ SYSCTL_NODE(_vfs, OID_AUTO, tmpfs, CTLFLAG_RW, 0, "tmp static long tmpfs_pages_reserved = TMPFS_PAGES_MINRESERVED; +static uma_zone_t tmpfs_dirent_pool; +static uma_zone_t tmpfs_node_pool; + static int +tmpfs_node_ctor(void *mem, int size, void *arg, int flags) +{ + struct tmpfs_node *node; + + node = mem; + node->tn_gen++; + node->tn_size = 0; + node->tn_status = 0; + node->tn_flags = 0; + node->tn_links = 0; + node->tn_vnode = NULL; + node->tn_vpstate = 0; + return (0); +} + +static void +tmpfs_node_dtor(void *mem, int size, void *arg) +{ + struct tmpfs_node *node; + + node = mem; + node->tn_type = VNON; +} + +static int +tmpfs_node_init(void *mem, int size, int flags) +{ + struct tmpfs_node *node; + + node = mem; + node->tn_id = 0; + mtx_init(>tn_interlock, "tmpfsni", NULL, MTX_DEF); + node->tn_gen = arc4random(); + return (0); +} + +static void +tmpfs_node_fini(void *mem, int size) +{ + struct tmpfs_node *node; + + node = mem; + mtx_destroy(>tn_interlock); +} + +void +tmpfs_subr_init(void) +{ + tmpfs_dirent_pool = uma_zcreate("TMPFS dirent", + sizeof(struct tmpfs_dirent), NULL, NULL, NULL, NULL, + UMA_ALIGN_PTR, 0); + tmpfs_node_pool = uma_zcreate("TMPFS node", + sizeof(struct tmpfs_node), tmpfs_node_ctor, tmpfs_node_dtor, + tmpfs_node_init, tmpfs_node_fini, UMA_ALIGN_PTR, 0); +} + +void +tmpfs_subr_uninit(void) +{ + uma_zdestroy(tmpfs_node_pool); + uma_zdestroy(tmpfs_dirent_pool); +} + +static int sysctl_mem_reserved(SYSCTL_HANDLER_ARGS) { int error; @@ -219,8 +286,7 @@ tmpfs_alloc_node(struct mount *mp, struct tmpfs_mount if ((mp->mnt_kern_flag & MNT_RDONLY) != 0) return (EROFS); - nnode = (struct tmpfs_node *)uma_zalloc_arg(tmp->tm_node_pool, tmp, - M_WAITOK); + nnode = uma_zalloc_arg(tmpfs_node_pool, tmp, M_WAITOK); /* Generic initialization. */ nnode->tn_type = type; @@ -367,7 +433,7 @@ tmpfs_free_node_locked(struct tmpfs_mount *tmp, struct panic("tmpfs_free_node: type %p %d", node, (int)node->tn_type); } - uma_zfree(tmp->tm_node_pool, node); + uma_zfree(tmpfs_node_pool, node); TMPFS_LOCK(tmp); tmpfs_free_tmp(tmp); return (true); @@ -434,7 +500,7 @@ tmpfs_alloc_dirent(struct tmpfs_mount *tmp, struct tmp { struct tmpfs_dirent *nde; - nde = uma_zalloc(tmp->tm_dirent_pool, M_WAITOK); + nde = uma_zalloc(tmpfs_dirent_pool, M_WAITOK); nde->td_node = node; if (name != NULL) { nde->ud.td_name = malloc(len, M_TMPFSNAME, M_WAITOK); @@ -470,7 +536,7 @@ tmpfs_free_dirent(struct tmpfs_mount *tmp, struct tmpf } if (!tmpfs_dirent_duphead(de) && de->ud.td_name != NULL) free(de->ud.td_name, M_TMPFSNAME); - uma_zfree(tmp->tm_dirent_pool, de); +
svn commit: r355409 - head/sys/arm/mv
Author: loos Date: Thu Dec 5 02:01:47 2019 New Revision: 355409 URL: https://svnweb.freebsd.org/changeset/base/355409 Log: Fix the build, use the correct include path. Pointy hat to:loos Modified: head/sys/arm/mv/a37x0_iic.c Modified: head/sys/arm/mv/a37x0_iic.c == --- head/sys/arm/mv/a37x0_iic.c Thu Dec 5 00:56:03 2019(r355408) +++ head/sys/arm/mv/a37x0_iic.c Thu Dec 5 02:01:47 2019(r355409) @@ -49,7 +49,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include "iicbus_if.h" ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r355408 - in head/sys: arm/mv arm64/conf conf
Author: loos Date: Thu Dec 5 00:56:03 2019 New Revision: 355408 URL: https://svnweb.freebsd.org/changeset/base/355408 Log: Add the I2C driver for the Armada 37x0. This controller is a bit tricky as the STOP condition must be indicated in the last tranferred byte, some devices will not like the repeated start behavior of this controller. A proper fix to this issue is in the works. This driver works in polling mode, can be used early in the boot (required in some cases). Tested on espressobin/SG-1100 and the SG-3200. Obtained from:pfSense Sponsored by: Rubicon Communications, LLC (Netgate) Added: head/sys/arm/mv/a37x0_iic.c (contents, props changed) head/sys/arm/mv/a37x0_iicreg.h (contents, props changed) Modified: head/sys/arm64/conf/GENERIC head/sys/conf/files.arm64 Added: head/sys/arm/mv/a37x0_iic.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/mv/a37x0_iic.c Thu Dec 5 00:56:03 2019(r355408) @@ -0,0 +1,484 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2018, 2019 Rubicon Communications, LLC (Netgate) + * + * 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 above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ +#include +__FBSDID("$FreeBSD$"); + +/* + * Driver for Armada 37x0 i2c controller. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include "iicbus_if.h" + +struct a37x0_iic_softc { + boolean_t sc_fast_mode; + bus_space_tag_t sc_bst; + bus_space_handle_t sc_bsh; + device_tsc_dev; + device_tsc_iicbus; + struct mtx sc_mtx; + struct resource *sc_mem_res; + struct resource *sc_irq_res; + void*sc_intrhand; +}; + +#defineA37X0_IIC_WRITE(_sc, _off, _val)\ +bus_space_write_4((_sc)->sc_bst, (_sc)->sc_bsh, _off, _val) +#defineA37X0_IIC_READ(_sc, _off) \ +bus_space_read_4((_sc)->sc_bst, (_sc)->sc_bsh, _off) +#defineA37X0_IIC_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) +#defineA37X0_IIC_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) + +static struct ofw_compat_data compat_data[] = { + { "marvell,armada-3700-i2c",1 }, + { NULL, 0 } +}; + +#undef A37x0_IIC_DEBUG + +static void a37x0_iic_intr(void *); +static int a37x0_iic_detach(device_t); + +static void +a37x0_iic_rmw(struct a37x0_iic_softc *sc, uint32_t off, uint32_t mask, +uint32_t value) +{ + uint32_t reg; + + mtx_assert(>sc_mtx, MA_OWNED); + reg = A37X0_IIC_READ(sc, off); + reg &= ~mask; + reg |= value; + A37X0_IIC_WRITE(sc, off, reg); +} + +static int +a37x0_iic_wait_clear(struct a37x0_iic_softc *sc, uint32_t mask) +{ + int timeout; + uint32_t status; + + mtx_assert(>sc_mtx, MA_OWNED); + timeout = 1000; + do { + DELAY(10); + status = A37X0_IIC_READ(sc, A37X0_IIC_ISR); + if (--timeout == 0) + return (0); + } while ((status & mask) != 0); + + return (1); +} + +static int +a37x0_iic_wait_set(struct a37x0_iic_softc *sc, uint32_t mask) +{ + int timeout; + uint32_t status; + + mtx_assert(>sc_mtx, MA_OWNED); + timeout = 1000; + do { + DELAY(10); + status = A37X0_IIC_READ(sc, A37X0_IIC_ISR); + if (--timeout == 0) +
svn commit: r355407 - head/sys/fs/tmpfs
Author: kib Date: Thu Dec 5 00:03:17 2019 New Revision: 355407 URL: https://svnweb.freebsd.org/changeset/base/355407 Log: Stop using per-mount tmpfs zones. Requested and reviewed by:jeff Sponsored by: The FreeBSD Foundation MFC after:1 week Differential revision:https://reviews.freebsd.org/D22643 Modified: head/sys/fs/tmpfs/tmpfs.h head/sys/fs/tmpfs/tmpfs_subr.c head/sys/fs/tmpfs/tmpfs_vfsops.c Modified: head/sys/fs/tmpfs/tmpfs.h == --- head/sys/fs/tmpfs/tmpfs.h Wed Dec 4 23:24:40 2019(r355406) +++ head/sys/fs/tmpfs/tmpfs.h Thu Dec 5 00:03:17 2019(r355407) @@ -378,10 +378,6 @@ struct tmpfs_mount { /* All node lock to protect the node list and tmp_pages_used. */ struct mtx tm_allnode_lock; - /* Zones used to store file system meta data, per tmpfs mount. */ - uma_zone_t tm_dirent_pool; - uma_zone_t tm_node_pool; - /* Read-only status. */ booltm_ronly; /* Do not use namecache. */ @@ -493,8 +489,9 @@ struct tmpfs_dirent *tmpfs_dir_next(struct tmpfs_node #endif size_t tmpfs_mem_avail(void); - size_t tmpfs_pages_used(struct tmpfs_mount *tmp); +void tmpfs_subr_init(void); +void tmpfs_subr_uninit(void); #endif Modified: head/sys/fs/tmpfs/tmpfs_subr.c == --- head/sys/fs/tmpfs/tmpfs_subr.c Wed Dec 4 23:24:40 2019 (r355406) +++ head/sys/fs/tmpfs/tmpfs_subr.c Thu Dec 5 00:03:17 2019 (r355407) @@ -72,7 +72,74 @@ SYSCTL_NODE(_vfs, OID_AUTO, tmpfs, CTLFLAG_RW, 0, "tmp static long tmpfs_pages_reserved = TMPFS_PAGES_MINRESERVED; +static uma_zone_t tmpfs_dirent_pool; +static uma_zone_t tmpfs_node_pool; + static int +tmpfs_node_ctor(void *mem, int size, void *arg, int flags) +{ + struct tmpfs_node *node; + + node = mem; + node->tn_gen++; + node->tn_size = 0; + node->tn_status = 0; + node->tn_flags = 0; + node->tn_links = 0; + node->tn_vnode = NULL; + node->tn_vpstate = 0; + return (0); +} + +static void +tmpfs_node_dtor(void *mem, int size, void *arg) +{ + struct tmpfs_node *node; + + node = mem; + node->tn_type = VNON; +} + +static int +tmpfs_node_init(void *mem, int size, int flags) +{ + struct tmpfs_node *node; + + node = mem; + node->tn_id = 0; + mtx_init(>tn_interlock, "tmpfsni", NULL, MTX_DEF); + node->tn_gen = arc4random(); + return (0); +} + +static void +tmpfs_node_fini(void *mem, int size) +{ + struct tmpfs_node *node; + + node = mem; + mtx_destroy(>tn_interlock); +} + +void +tmpfs_subr_init(void) +{ + tmpfs_dirent_pool = uma_zcreate("TMPFS dirent", + sizeof(struct tmpfs_dirent), NULL, NULL, NULL, NULL, + UMA_ALIGN_PTR, 0); + tmpfs_node_pool = uma_zcreate("TMPFS node", + sizeof(struct tmpfs_node), tmpfs_node_ctor, tmpfs_node_dtor, + tmpfs_node_init, tmpfs_node_fini, UMA_ALIGN_PTR, 0); +} + +void +tmpfs_subr_uninit(void) +{ + uma_zdestroy(tmpfs_node_pool); + uma_zdestroy(tmpfs_dirent_pool); +} + +static int sysctl_mem_reserved(SYSCTL_HANDLER_ARGS) { int error; @@ -219,8 +286,7 @@ tmpfs_alloc_node(struct mount *mp, struct tmpfs_mount if ((mp->mnt_kern_flag & MNT_RDONLY) != 0) return (EROFS); - nnode = (struct tmpfs_node *)uma_zalloc_arg(tmp->tm_node_pool, tmp, - M_WAITOK); + nnode = uma_zalloc_arg(tmpfs_node_pool, tmp, M_WAITOK); /* Generic initialization. */ nnode->tn_type = type; @@ -367,7 +433,7 @@ tmpfs_free_node_locked(struct tmpfs_mount *tmp, struct panic("tmpfs_free_node: type %p %d", node, (int)node->tn_type); } - uma_zfree(tmp->tm_node_pool, node); + uma_zfree(tmpfs_node_pool, node); TMPFS_LOCK(tmp); tmpfs_free_tmp(tmp); return (true); @@ -434,7 +500,7 @@ tmpfs_alloc_dirent(struct tmpfs_mount *tmp, struct tmp { struct tmpfs_dirent *nde; - nde = uma_zalloc(tmp->tm_dirent_pool, M_WAITOK); + nde = uma_zalloc(tmpfs_dirent_pool, M_WAITOK); nde->td_node = node; if (name != NULL) { nde->ud.td_name = malloc(len, M_TMPFSNAME, M_WAITOK); @@ -470,7 +536,7 @@ tmpfs_free_dirent(struct tmpfs_mount *tmp, struct tmpf } if (!tmpfs_dirent_duphead(de) && de->ud.td_name != NULL) free(de->ud.td_name, M_TMPFSNAME); - uma_zfree(tmp->tm_dirent_pool, de); + uma_zfree(tmpfs_dirent_pool, de); } void Modified: head/sys/fs/tmpfs/tmpfs_vfsops.c == --- head/sys/fs/tmpfs/tmpfs_vfsops.cWed Dec 4 23:24:40 2019 (r355406) +++
svn commit: r355406 - head/sys/fs/nfs
Author: rmacklem Date: Wed Dec 4 23:24:40 2019 New Revision: 355406 URL: https://svnweb.freebsd.org/changeset/base/355406 Log: Add some definitions for NFSv4.2 which will be used by subsequent commits. This is a preliminary commit of NFSv4.2 definitions that will be used by subsequent commits which adds NFSv4.2 support to the NFS client and server. There will be a series of these preliminary commits that will prepare for a major commit of the NFSv4.2 client/server changes currently found in subversion under projects/nfsv42/sys. Modified: head/sys/fs/nfs/nfsproto.h Modified: head/sys/fs/nfs/nfsproto.h == --- head/sys/fs/nfs/nfsproto.h Wed Dec 4 22:41:52 2019(r355405) +++ head/sys/fs/nfs/nfsproto.h Wed Dec 4 23:24:40 2019(r355406) @@ -78,6 +78,7 @@ #defineNFS_FABLKSIZE 512 /* Size in bytes of a block wrt fa_blocks */ #defineNFSV4_MINORVERSION 0 /* V4 Minor version */ #defineNFSV41_MINORVERSION 1 /* V4 Minor version */ +#defineNFSV42_MINORVERSION 2 /* V4 Minor version */ #defineNFSV4_CBVERS1 /* V4 CB Version */ #defineNFSV41_CBVERS 4 /* V4.1 CB Version */ #defineNFSV4_SMALLSTR 50 /* Strings small enough for stack */ @@ -214,6 +215,22 @@ #defineNFSERR_RETURNCONFLICT 10086 #defineNFSERR_DELEGREVOKED 10087 +/* NFSv4.2 specific errors. */ +#defineNFSERR_PARTNERNOTSUPP 10088 +#defineNFSERR_PARTNERNOAUTH10089 +#defineNFSERR_UNIONNOTSUPP 10090 +#defineNFSERR_OFFLOADDENIED10091 +#defineNFSERR_WRONGLFS 10092 +#defineNFSERR_BADLABEL 10093 +#defineNFSERR_OFFLOADNOREQS10094 + +/* NFSv4.2 Extended Attribute errors. */ +#defineNFSERR_NOXATTR 10095 +#defineNFSERR_XATTR2BIG10096 + +/* Maximum value of all the NFS error values. */ +#defineNFSERR_MAXERRVALNFSERR_XATTR2BIG + #defineNFSERR_STALEWRITEVERF 30001 /* Fake return for nfs_commit() */ #defineNFSERR_DONTREPLY30003 /* Don't process request */ #defineNFSERR_RETVOID 30004 /* Return void, not error */ @@ -364,6 +381,24 @@ */ #defineNFSV41_NPROCS 56 +/* Additional procedures for NFSv4.2. */ +#defineNFSPROC_IOADVISE56 +#defineNFSPROC_ALLOCATE57 +#defineNFSPROC_COPY58 +#defineNFSPROC_SEEK59 +#defineNFSPROC_SEEKDS 60 + +/* and the ones for the optional Extended attribute support (RFC-8276). */ +#defineNFSPROC_GETEXTATTR 61 +#defineNFSPROC_SETEXTATTR 62 +#defineNFSPROC_RMEXTATTR 63 +#defineNFSPROC_LISTEXTATTR 64 + +/* + * Must be defined as one higher than the last NFSv4.2 Proc# above. + */ +#defineNFSV42_NPROCS 65 + #endif /* NFS_V3NPROCS */ /* @@ -593,6 +628,11 @@ #defineNFSACCESS_EXTEND0x08 #defineNFSACCESS_DELETE0x10 #defineNFSACCESS_EXECUTE 0x20 + +/* Additional Extended Attribute access bits RFC-8276. */ +#defineNFSACCESS_XAREAD0x40 +#defineNFSACCESS_XAWRITE 0x80 +#defineNFSACCESS_XALIST0x100 #defineNFSWRITE_UNSTABLE 0 #defineNFSWRITE_DATASYNC 1 ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r355405 - head/sys/netinet
Author: glebius Date: Wed Dec 4 22:41:52 2019 New Revision: 355405 URL: https://svnweb.freebsd.org/changeset/base/355405 Log: Fix regression from r354484. Don't leak pcb lock if cr_canseeinpcb() returns non-zero. PR: 242415 Modified: head/sys/netinet/tcp_subr.c Modified: head/sys/netinet/tcp_subr.c == --- head/sys/netinet/tcp_subr.c Wed Dec 4 21:26:03 2019(r355404) +++ head/sys/netinet/tcp_subr.c Wed Dec 4 22:41:52 2019(r355405) @@ -2204,9 +2204,11 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS) error = SYSCTL_OUT(req, , sizeof xt); if (error) break; + else + continue; } - } else - INP_RUNLOCK(inp); + } + INP_RUNLOCK(inp); } NET_EPOCH_EXIT(et); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r355404 - in head/sys: cam geom kern
Author: mav Date: Wed Dec 4 21:26:03 2019 New Revision: 355404 URL: https://svnweb.freebsd.org/changeset/base/355404 Log: Mark some more hot global variables with __read_mostly. MFC after:1 week Modified: head/sys/cam/cam_xpt.c head/sys/geom/geom_io.c head/sys/geom/geom_kern.c head/sys/kern/kern_mtxpool.c head/sys/kern/kern_shutdown.c head/sys/kern/kern_timeout.c head/sys/kern/sched_4bsd.c head/sys/kern/sched_ule.c head/sys/kern/vfs_bio.c Modified: head/sys/cam/cam_xpt.c == --- head/sys/cam/cam_xpt.c Wed Dec 4 21:01:13 2019(r355403) +++ head/sys/cam/cam_xpt.c Wed Dec 4 21:26:03 2019(r355404) @@ -214,7 +214,7 @@ static struct cdevsw xpt_cdevsw = { /* Storage for debugging datastructures */ struct cam_path *cam_dpath; -u_int32_t cam_dflags = CAM_DEBUG_FLAGS; +u_int32_t __read_mostly cam_dflags = CAM_DEBUG_FLAGS; SYSCTL_UINT(_kern_cam, OID_AUTO, dflags, CTLFLAG_RWTUN, _dflags, 0, "Enabled debug flags"); u_int32_t cam_debug_delay = CAM_DEBUG_DELAY; Modified: head/sys/geom/geom_io.c == --- head/sys/geom/geom_io.c Wed Dec 4 21:01:13 2019(r355403) +++ head/sys/geom/geom_io.c Wed Dec 4 21:26:03 2019(r355404) @@ -83,9 +83,9 @@ static struct g_bioq g_bio_run_up; * pressures exist. See g_io_schedule_down() for more details * and limitations. */ -static volatile u_int pace; +static volatile u_int __read_mostly pace; -static uma_zone_t biozone; +static uma_zone_t __read_mostly biozone; /* * The head of the list of classifiers used in g_io_request. @@ -93,8 +93,8 @@ static uma_zone_t biozone; * to add/remove entries to the list. * Classifiers are invoked in registration order. */ -static TAILQ_HEAD(g_classifier_tailq, g_classifier_hook) -g_classifier_tailq = TAILQ_HEAD_INITIALIZER(g_classifier_tailq); +static TAILQ_HEAD(, g_classifier_hook) g_classifier_tailq __read_mostly = +TAILQ_HEAD_INITIALIZER(g_classifier_tailq); #include Modified: head/sys/geom/geom_kern.c == --- head/sys/geom/geom_kern.c Wed Dec 4 21:01:13 2019(r355403) +++ head/sys/geom/geom_kern.c Wed Dec 4 21:26:03 2019(r355404) @@ -61,12 +61,12 @@ MALLOC_DEFINE(M_GEOM, "GEOM", "Geom data structures"); struct sx topology_lock; static struct proc *g_proc; -static struct thread *g_up_td; -static struct thread *g_down_td; -static struct thread *g_event_td; +static struct thread __read_mostly *g_up_td; +static struct thread __read_mostly *g_down_td; +static struct thread __read_mostly *g_event_td; -int g_debugflags; -int g_collectstats = 1; +int __read_mostly g_debugflags; +int __read_mostly g_collectstats = G_STATS_PROVIDERS; int g_shutdown; int g_notaste; Modified: head/sys/kern/kern_mtxpool.c == --- head/sys/kern/kern_mtxpool.cWed Dec 4 21:01:13 2019 (r355403) +++ head/sys/kern/kern_mtxpool.cWed Dec 4 21:26:03 2019 (r355404) @@ -82,7 +82,7 @@ struct mtx_pool { #define mtx_pool_shift mtx_pool_header.mtxpool_shift #define mtx_pool_next mtx_pool_header.mtxpool_next -struct mtx_pool *mtxpool_sleep; +struct mtx_pool __read_frequently *mtxpool_sleep; #if UINTPTR_MAX == UINT64_MAX /* 64 bits */ # define POINTER_BITS 64 Modified: head/sys/kern/kern_shutdown.c == --- head/sys/kern/kern_shutdown.c Wed Dec 4 21:01:13 2019 (r355403) +++ head/sys/kern/kern_shutdown.c Wed Dec 4 21:26:03 2019 (r355404) @@ -217,9 +217,9 @@ SYSCTL_INT(_kern, OID_AUTO, kerneldump_gzlevel, CTLFLA * Variable panicstr contains argument to first call to panic; used as flag * to indicate that the kernel has already called panic. */ -const char *panicstr; +const char __read_mostly *panicstr; -int dumping; /* system is dumping */ +int __read_mostly dumping; /* system is dumping */ int rebooting; /* system is rebooting */ /* * Used to serialize between sysctl kern.shutdown.dumpdevname and list Modified: head/sys/kern/kern_timeout.c == --- head/sys/kern/kern_timeout.cWed Dec 4 21:01:13 2019 (r355403) +++ head/sys/kern/kern_timeout.cWed Dec 4 21:26:03 2019 (r355404) @@ -130,7 +130,8 @@ SYSCTL_INT(_kern, OID_AUTO, pin_pcpu_swi, CTLFLAG_RDTU * TODO: * allocate more timeout table slots when table overflows. */ -u_int callwheelsize, callwheelmask; +static u_int __read_mostly callwheelsize; +static u_int __read_mostly callwheelmask; /* * The callout cpu exec entities represent
svn commit: r355403 - head/lib/libc/riscv/gen
Author: jhb Date: Wed Dec 4 21:01:13 2019 New Revision: 355403 URL: https://svnweb.freebsd.org/changeset/base/355403 Log: Use "far" calls and branches so that lld uses valid relocations. Conditional branch and jump instructions do not always call via PLT stubs and thus will not honor LD_PRELOAD, etc. lld warns about using non-preemptible relocations for preemptible or unknown symbols whereas bfd does not (at least for RISC-V). Reviewed by: br, James Clarke Sponsored by: DARPA Differential Revision:https://reviews.freebsd.org/D22658 Modified: head/lib/libc/riscv/gen/setjmp.S head/lib/libc/riscv/gen/sigsetjmp.S Modified: head/lib/libc/riscv/gen/setjmp.S == --- head/lib/libc/riscv/gen/setjmp.SWed Dec 4 20:50:49 2019 (r355402) +++ head/lib/libc/riscv/gen/setjmp.SWed Dec 4 21:01:13 2019 (r355403) @@ -46,7 +46,7 @@ ENTRY(setjmp) addia2, a0, (_JB_SIGMASK * 8) /* oset */ li a1, 0 /* set */ li a0, 1 /* SIG_BLOCK */ - jal sigprocmask + call_C_LABEL(sigprocmask) ld a0, 0(sp) ld ra, 8(sp) @@ -109,7 +109,7 @@ ENTRY(longjmp) li a2, 0 /* oset */ addia1, a0, (_JB_SIGMASK * 8) /* set */ li a0, 3 /* SIG_BLOCK */ - jal sigprocmask + call_C_LABEL(sigprocmask) ld a1, (2 * 8)(sp) ld ra, (1 * 8)(sp) Modified: head/lib/libc/riscv/gen/sigsetjmp.S == --- head/lib/libc/riscv/gen/sigsetjmp.S Wed Dec 4 20:50:49 2019 (r355402) +++ head/lib/libc/riscv/gen/sigsetjmp.S Wed Dec 4 21:01:13 2019 (r355403) @@ -38,8 +38,10 @@ __FBSDID("$FreeBSD$"); #include ENTRY(sigsetjmp) - beqza1, _C_LABEL(_setjmp) - j _C_LABEL(setjmp) + beqza1, 1f + tail_C_LABEL(setjmp) +1: + tail_C_LABEL(_setjmp) END(sigsetjmp) ENTRY(siglongjmp) @@ -48,8 +50,10 @@ ENTRY(siglongjmp) ld a3, 0(a0) /* Check the magic */ - beq a2, a3, _C_LABEL(_longjmp) - j _C_LABEL(longjmp) + beq a2, a3, 1f + tail_C_LABEL(longjmp) +1: + tail_C_LABEL(_longjmp) .align 3 .Lmagic: ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r355402 - head/lib/libc/riscv/gen
Author: jhb Date: Wed Dec 4 20:50:49 2019 New Revision: 355402 URL: https://svnweb.freebsd.org/changeset/base/355402 Log: Use a single 'ld' to read the jmpbuf magic values instead of 'la; ld'. This saves an instruction in each case as well as an extra memory indirection via the GOT for PIC code. Reviewed by: br, James Clarke Sponsored by: DARPA Differential Revision:https://reviews.freebsd.org/D22656 Modified: head/lib/libc/riscv/gen/_setjmp.S head/lib/libc/riscv/gen/setjmp.S Modified: head/lib/libc/riscv/gen/_setjmp.S == --- head/lib/libc/riscv/gen/_setjmp.S Wed Dec 4 20:18:12 2019 (r355401) +++ head/lib/libc/riscv/gen/_setjmp.S Wed Dec 4 20:50:49 2019 (r355402) @@ -39,8 +39,7 @@ __FBSDID("$FreeBSD$"); ENTRY(_setjmp) /* Store the magic value and stack pointer */ - la t0, .Lmagic - ld t0, 0(t0) + ld t0, .Lmagic sd t0, (0 * 8)(a0) sd sp, (1 * 8)(a0) addia0, a0, (2 * 8) @@ -89,8 +88,7 @@ END(_setjmp) ENTRY(_longjmp) /* Check the magic value */ ld t0, 0(a0) - la t1, .Lmagic - ld t1, 0(t1) + ld t1, .Lmagic bne t0, t1, botch /* Restore the stack pointer */ Modified: head/lib/libc/riscv/gen/setjmp.S == --- head/lib/libc/riscv/gen/setjmp.SWed Dec 4 20:18:12 2019 (r355401) +++ head/lib/libc/riscv/gen/setjmp.SWed Dec 4 20:50:49 2019 (r355402) @@ -53,8 +53,7 @@ ENTRY(setjmp) addisp, sp, (2 * 8) /* Store the magic value and stack pointer */ - la t0, .Lmagic - ld t0, 0(t0) + ld t0, .Lmagic sd t0, (0 * 8)(a0) sd sp, (1 * 8)(a0) addia0, a0, (2 * 8) @@ -119,8 +118,7 @@ ENTRY(longjmp) /* Check the magic value */ ld t0, 0(a0) - la t1, .Lmagic - ld t1, 0(t1) + ld t1, .Lmagic bne t0, t1, botch /* Restore the stack pointer */ ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r355401 - head/lib/libcompiler_rt
Author: jhb Date: Wed Dec 4 20:18:12 2019 New Revision: 355401 URL: https://svnweb.freebsd.org/changeset/base/355401 Log: Define __SOFT_FP__ for riscv64sf to avoid infinite recursion. Submitted by: James Clarke Reviewed by: imp Sponsored by: DARPA Differential Revision:https://reviews.freebsd.org/D22660 Modified: head/lib/libcompiler_rt/Makefile.inc Modified: head/lib/libcompiler_rt/Makefile.inc == --- head/lib/libcompiler_rt/Makefile.incWed Dec 4 20:15:17 2019 (r355400) +++ head/lib/libcompiler_rt/Makefile.incWed Dec 4 20:18:12 2019 (r355401) @@ -241,3 +241,7 @@ SRCS+= sync_synchronize.S SRCS+= bswapdi2.c SRCS+= bswapsi2.c .endif + +.if ${MACHINE_ARCH:Mriscv*sf} +CFLAGS+= -D__SOFT_FP__ +.endif ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r355400 - head/sys/sys
Author: rlibby Date: Wed Dec 4 20:15:17 2019 New Revision: 355400 URL: https://svnweb.freebsd.org/changeset/base/355400 Log: bistring: avoid gcc -Wsign-compare Appease gcc after after r355377, which broke gcc builds. Reviewed by: dougm MFC with: r355377 Differential Revision:https://reviews.freebsd.org/D22682 Modified: head/sys/sys/bitstring.h Modified: head/sys/sys/bitstring.h == --- head/sys/sys/bitstring.hWed Dec 4 19:46:48 2019(r355399) +++ head/sys/sys/bitstring.hWed Dec 4 20:15:17 2019(r355400) @@ -306,7 +306,7 @@ bit_ffs_area_at(bitstr_t *_bitstr, int _start, int _nb while ((_test & (_test + 1)) != 0 && _b-- > 0) _test |= _test >> (((_size - 1) >> _b) + 1) / 2; /* Find the start of the first 0-area in _test. */ - _offset = (~_test == 0) ? _BITSTR_BITS : + _offset = (~_test == 0) ? (int)_BITSTR_BITS : ffsl(~_test) - 1; _value = (_curbitstr - _bitstr) * _BITSTR_BITS + _offset; @@ -353,7 +353,7 @@ bit_ffc_area_at(bitstr_t *_bitstr, int _start, int _nb while ((_test & (_test + 1)) != 0 && _b-- > 0) _test |= _test >> (((_size - 1) >> _b) + 1) / 2; /* Find the start of the first 0-area in _test. */ - _offset = (~_test == 0) ? _BITSTR_BITS : + _offset = (~_test == 0) ? (int)_BITSTR_BITS : ffsl(~_test) - 1; _value = (_curbitstr - _bitstr) * _BITSTR_BITS + _offset; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r355399 - head/sys/vm
Author: markj Date: Wed Dec 4 19:46:48 2019 New Revision: 355399 URL: https://svnweb.freebsd.org/changeset/base/355399 Log: Fix an off-by-one error in vm_map_pmap_enter(). If the starting pindex is equal to object->size, there is nothing to do. This was harmless since the rest of vm_map_pmap_enter() has no effect when psize == 0. Submitted by: Wuyang Chung Reviewed by: alc, dougm, kib MFC after:1 week Github PR:https://github.com/freebsd/freebsd/pull/417 Differential Revision:https://reviews.freebsd.org/D22678 Modified: head/sys/vm/vm_map.c Modified: head/sys/vm/vm_map.c == --- head/sys/vm/vm_map.cWed Dec 4 18:40:05 2019(r355398) +++ head/sys/vm/vm_map.cWed Dec 4 19:46:48 2019(r355399) @@ -2467,7 +2467,7 @@ vm_map_pmap_enter(vm_map_t map, vm_offset_t addr, vm_p psize = atop(size); if (psize + pindex > object->size) { - if (object->size < pindex) { + if (pindex >= object->size) { VM_OBJECT_RUNLOCK(object); return; } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r355398 - head/sys/vm
Author: andrew Date: Wed Dec 4 18:40:05 2019 New Revision: 355398 URL: https://svnweb.freebsd.org/changeset/base/355398 Log: Fix the signature for zone_import and zone_release These are cast to uma_import and uma_release functions. Use the signature for these in the zone functions. This was found with an experimental Kernel CFI. It will complain if the signature is different than what a function pointer expects. The simplest way to fix these is to correct the signature. Reviewed by: rlibby Sponsored by: DARPA, AFRL Differential Revision:https://reviews.freebsd.org/D22671 Modified: head/sys/vm/uma_core.c Modified: head/sys/vm/uma_core.c == --- head/sys/vm/uma_core.c Wed Dec 4 18:38:50 2019(r355397) +++ head/sys/vm/uma_core.c Wed Dec 4 18:40:05 2019(r355398) @@ -279,8 +279,8 @@ static void *slab_alloc_item(uma_keg_t keg, uma_slab_t static void slab_free_item(uma_zone_t zone, uma_slab_t slab, void *item); static uma_keg_t uma_kcreate(uma_zone_t zone, size_t size, uma_init uminit, uma_fini fini, int align, uint32_t flags); -static int zone_import(uma_zone_t, void **, int, int, int); -static void zone_release(uma_zone_t, void **, int); +static int zone_import(void *, void **, int, int, int); +static void zone_release(void *, void **, int); static void uma_zero_item(void *, uma_zone_t); static bool cache_alloc(uma_zone_t, uma_cache_t, void *, int); static bool cache_free(uma_zone_t, uma_cache_t, void *, void *, int); @@ -2094,8 +2094,8 @@ zone_ctor(void *mem, int size, void *udata, int flags) /* * Use the regular zone/keg/slab allocator. */ - zone->uz_import = (uma_import)zone_import; - zone->uz_release = (uma_release)zone_release; + zone->uz_import = zone_import; + zone->uz_release = zone_release; zone->uz_arg = zone; keg = arg->keg; @@ -3112,8 +3112,9 @@ slab_alloc_item(uma_keg_t keg, uma_slab_t slab) } static int -zone_import(uma_zone_t zone, void **bucket, int max, int domain, int flags) +zone_import(void *arg, void **bucket, int max, int domain, int flags) { + uma_zone_t zone; uma_slab_t slab; uma_keg_t keg; #ifdef NUMA @@ -3121,6 +3122,7 @@ zone_import(uma_zone_t zone, void **bucket, int max, i #endif int i; + zone = arg; slab = NULL; keg = zone->uz_keg; KEG_LOCK(keg); @@ -3616,14 +3618,16 @@ slab_free_item(uma_zone_t zone, uma_slab_t slab, void } static void -zone_release(uma_zone_t zone, void **bucket, int cnt) +zone_release(void *arg, void **bucket, int cnt) { + uma_zone_t zone; void *item; uma_slab_t slab; uma_keg_t keg; uint8_t *mem; int i; + zone = arg; keg = zone->uz_keg; KEG_LOCK(keg); for (i = 0; i < cnt; i++) { ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r355397 - head/contrib/llvm/lib/Target/PowerPC
Author: dim Date: Wed Dec 4 18:38:50 2019 New Revision: 355397 URL: https://svnweb.freebsd.org/changeset/base/355397 Log: Merge commit 241cbf201 from llvm git (by Nemanja Ivanovic): [PowerPC] Fix crash in peephole optimization When converting reg+reg shifts to reg+imm rotates, we neglect to consider the CodeGenOnly versions of the 32-bit shift mnemonics. This means we produce a rotate with missing operands which causes a crash. Committing this fix without review since it is non-controversial that the list of mnemonics to consider should include the 64-bit aliases for the exact mnemonics. Fixes PR44183. This should fix "Assertion failed: (idx < size()), function operator[], file /usr/src/contrib/llvm/include/llvm/ADT/SmallVector.h, line 153" when building the graphics/mesa-dri port for the PowerPC64 ELFv2 ABI. Reported by: Alfredo Dal'Ava Júnior MFC after: 1 month X-MFC-With: r353358 Modified: head/contrib/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp Modified: head/contrib/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp == --- head/contrib/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp Wed Dec 4 18:21:29 2019(r355396) +++ head/contrib/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp Wed Dec 4 18:38:50 2019(r355397) @@ -3529,8 +3529,10 @@ bool PPCInstrInfo::transformToImmFormFedByLI(MachineIn ForwardKilledOperandReg = MI.getOperand(ConstantOpNo).getReg(); unsigned Opc = MI.getOpcode(); - bool SpecialShift32 = -Opc == PPC::SLW || Opc == PPC::SLWo || Opc == PPC::SRW || Opc == PPC::SRWo; + bool SpecialShift32 = Opc == PPC::SLW || Opc == PPC::SLWo || +Opc == PPC::SRW || Opc == PPC::SRWo || +Opc == PPC::SLW8 || Opc == PPC::SLW8o || +Opc == PPC::SRW8 || Opc == PPC::SRW8o; bool SpecialShift64 = Opc == PPC::SLD || Opc == PPC::SLDo || Opc == PPC::SRD || Opc == PPC::SRDo; bool SetCR = Opc == PPC::SLWo || Opc == PPC::SRWo || ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r355396 - head/sys/kern
Author: rlibby Date: Wed Dec 4 18:21:29 2019 New Revision: 355396 URL: https://svnweb.freebsd.org/changeset/base/355396 Log: mbuf zones: take out the trash The mbuf zones were explicitly specifying the uma trash procedures on zcreate, conditionally on INVARIANTS, because that used to be necessary in order to get use-after-free checking for uma zones with non-empty constructors or destructors. After r355137 uma automatically invokes the trash constructor and destructor as long as no init and fini are specified. This now allows the mbuf zones to pass their constructors and destructors without needing to add on the uma trash procedures conditionally. Reviewed by: cem, jhb, markj Sponsored by: Dell EMC Isilon Differential Revision:https://reviews.freebsd.org/D22583 Modified: head/sys/kern/kern_mbuf.c Modified: head/sys/kern/kern_mbuf.c == --- head/sys/kern/kern_mbuf.c Wed Dec 4 17:45:34 2019(r355395) +++ head/sys/kern/kern_mbuf.c Wed Dec 4 18:21:29 2019(r355396) @@ -322,12 +322,7 @@ mbuf_init(void *dummy) * Configure UMA zones for Mbufs, Clusters, and Packets. */ zone_mbuf = uma_zcreate(MBUF_MEM_NAME, MSIZE, - mb_ctor_mbuf, mb_dtor_mbuf, -#ifdef INVARIANTS - trash_init, trash_fini, -#else - NULL, NULL, -#endif + mb_ctor_mbuf, mb_dtor_mbuf, NULL, NULL, MSIZE - 1, UMA_ZONE_MAXBUCKET); if (nmbufs > 0) nmbufs = uma_zone_set_max(zone_mbuf, nmbufs); @@ -335,12 +330,7 @@ mbuf_init(void *dummy) uma_zone_set_maxaction(zone_mbuf, mb_reclaim); zone_clust = uma_zcreate(MBUF_CLUSTER_MEM_NAME, MCLBYTES, - mb_ctor_clust, -#ifdef INVARIANTS - trash_dtor, trash_init, trash_fini, -#else - NULL, NULL, NULL, -#endif + mb_ctor_clust, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); if (nmbclusters > 0) nmbclusters = uma_zone_set_max(zone_clust, nmbclusters); @@ -352,12 +342,7 @@ mbuf_init(void *dummy) /* Make jumbo frame zone too. Page size, 9k and 16k. */ zone_jumbop = uma_zcreate(MBUF_JUMBOP_MEM_NAME, MJUMPAGESIZE, - mb_ctor_clust, -#ifdef INVARIANTS - trash_dtor, trash_init, trash_fini, -#else - NULL, NULL, NULL, -#endif + mb_ctor_clust, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); if (nmbjumbop > 0) nmbjumbop = uma_zone_set_max(zone_jumbop, nmbjumbop); @@ -365,12 +350,7 @@ mbuf_init(void *dummy) uma_zone_set_maxaction(zone_jumbop, mb_reclaim); zone_jumbo9 = uma_zcreate(MBUF_JUMBO9_MEM_NAME, MJUM9BYTES, - mb_ctor_clust, -#ifdef INVARIANTS - trash_dtor, trash_init, trash_fini, -#else - NULL, NULL, NULL, -#endif + mb_ctor_clust, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); uma_zone_set_allocf(zone_jumbo9, mbuf_jumbo_alloc); if (nmbjumbo9 > 0) @@ -379,12 +359,7 @@ mbuf_init(void *dummy) uma_zone_set_maxaction(zone_jumbo9, mb_reclaim); zone_jumbo16 = uma_zcreate(MBUF_JUMBO16_MEM_NAME, MJUM16BYTES, - mb_ctor_clust, -#ifdef INVARIANTS - trash_dtor, trash_init, trash_fini, -#else - NULL, NULL, NULL, -#endif + mb_ctor_clust, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); uma_zone_set_allocf(zone_jumbo16, mbuf_jumbo_alloc); if (nmbjumbo16 > 0) @@ -394,11 +369,7 @@ mbuf_init(void *dummy) zone_extpgs = uma_zcreate(MBUF_EXTPGS_MEM_NAME, sizeof(struct mbuf_ext_pgs), -#ifdef INVARIANTS - trash_ctor, trash_dtor, trash_init, trash_fini, -#else NULL, NULL, NULL, NULL, -#endif UMA_ALIGN_CACHE, 0); /* @@ -618,22 +589,12 @@ debugnet_mbuf_reinit(int nmbuf, int nclust, int clsize dn_clsize = clsize; dn_zone_mbuf = uma_zcache_create("debugnet_" MBUF_MEM_NAME, - MSIZE, mb_ctor_mbuf, mb_dtor_mbuf, -#ifdef INVARIANTS - trash_init, trash_fini, -#else - NULL, NULL, -#endif + MSIZE, mb_ctor_mbuf, mb_dtor_mbuf, NULL, NULL, dn_buf_import, dn_buf_release, _mbufq, UMA_ZONE_NOBUCKET); dn_zone_clust = uma_zcache_create("debugnet_" MBUF_CLUSTER_MEM_NAME, - clsize, mb_ctor_clust, -#ifdef INVARIANTS - trash_dtor, trash_init, trash_fini, -#else - NULL, NULL, NULL, -#endif + clsize, mb_ctor_clust, NULL, NULL, NULL, dn_buf_import, dn_buf_release, _clustq, UMA_ZONE_NOBUCKET); @@ -687,9 +648,6 @@ mb_ctor_mbuf(void *mem, int size, void *arg, int how) int flags; short type; -#ifdef INVARIANTS - trash_ctor(mem, size, arg, how); -#endif args = (struct mb_args *)arg; type = args->type; @@ -724,9 +682,6 @@ mb_dtor_mbuf(void *mem, int size, void *arg)
svn commit: r355395 - in stable: 10/lib/msun/src 11/lib/msun/src 12/lib/msun/src
Author: dim Date: Wed Dec 4 17:45:34 2019 New Revision: 355395 URL: https://svnweb.freebsd.org/changeset/base/355395 Log: r355120 | dim | 2019-11-26 23:01:09 +0100 (Tue, 26 Nov 2019) | 32 lines The fdlibm hypot() implementations shouldn't potentially left-shift negative numbers (invoking undefined behavior) Summary: Various paths through hypot(x, y) will multiply x and y by a power of two, perform the calculation in a range where IEEE-754 provides greater precision, then undo the multiplication to determine the true result. Undoing that multiplication is implemented as t1*w, where t1=2**k. 2**k is often computed by taking the high word of 1.0, then adding k<<20 (for doubles or long doubles) or k<<23 (for floats) to it, then overwriting that high word. But when k is negative this left-shifts a negative value -- and that's undefined behavior in many editions of C and C++. This patch should fix all hypot implementations to compute 2**k without triggering this particular bit of undefined behavior. Test Plan: I've only very lightly tested out the hypot(double, double) change, in SpiderMonkey's JavaScript engine, for consistency with prior behavior. The other functions' changes have more or less only been eyeballed. Careful examination appreciated! Do note, however, that an error in any of these changes would most likely produce a value that is incorrect by a factor of two, so any mistake would most likely be glaring if invoked. Submitted by: Jeff Walden Obtained from:https://github.com/freebsd/freebsd/pull/414 Reviewed by: dim, lwhsu Differential Revision: https://reviews.freebsd.org/D22354 Modified: stable/11/lib/msun/src/e_hypot.c stable/11/lib/msun/src/e_hypotf.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/lib/msun/src/e_hypot.c stable/10/lib/msun/src/e_hypotf.c stable/12/lib/msun/src/e_hypot.c stable/12/lib/msun/src/e_hypotf.c Directory Properties: stable/10/ (props changed) stable/12/ (props changed) Modified: stable/11/lib/msun/src/e_hypot.c == --- stable/11/lib/msun/src/e_hypot.cWed Dec 4 16:56:11 2019 (r355394) +++ stable/11/lib/msun/src/e_hypot.cWed Dec 4 17:45:34 2019 (r355395) @@ -118,10 +118,8 @@ __ieee754_hypot(double x, double y) w = sqrt(t1*y1-(w*(-w)-(t1*y2+t2*b))); } if(k!=0) { - u_int32_t high; - t1 = 1.0; - GET_HIGH_WORD(high,t1); - SET_HIGH_WORD(t1,high+(k<<20)); + t1 = 0.0; + SET_HIGH_WORD(t1,(1023+k)<<20); return t1*w; } else return w; } Modified: stable/11/lib/msun/src/e_hypotf.c == --- stable/11/lib/msun/src/e_hypotf.c Wed Dec 4 16:56:11 2019 (r355394) +++ stable/11/lib/msun/src/e_hypotf.c Wed Dec 4 17:45:34 2019 (r355395) @@ -77,7 +77,7 @@ __ieee754_hypotf(float x, float y) w = __ieee754_sqrtf(t1*y1-(w*(-w)-(t1*y2+t2*b))); } if(k!=0) { - SET_FLOAT_WORD(t1,0x3f80+(k<<23)); + SET_FLOAT_WORD(t1,(127+k)<<23); return t1*w; } else return w; } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r355395 - in stable: 10/lib/msun/src 11/lib/msun/src 12/lib/msun/src
Author: dim Date: Wed Dec 4 17:45:34 2019 New Revision: 355395 URL: https://svnweb.freebsd.org/changeset/base/355395 Log: r355120 | dim | 2019-11-26 23:01:09 +0100 (Tue, 26 Nov 2019) | 32 lines The fdlibm hypot() implementations shouldn't potentially left-shift negative numbers (invoking undefined behavior) Summary: Various paths through hypot(x, y) will multiply x and y by a power of two, perform the calculation in a range where IEEE-754 provides greater precision, then undo the multiplication to determine the true result. Undoing that multiplication is implemented as t1*w, where t1=2**k. 2**k is often computed by taking the high word of 1.0, then adding k<<20 (for doubles or long doubles) or k<<23 (for floats) to it, then overwriting that high word. But when k is negative this left-shifts a negative value -- and that's undefined behavior in many editions of C and C++. This patch should fix all hypot implementations to compute 2**k without triggering this particular bit of undefined behavior. Test Plan: I've only very lightly tested out the hypot(double, double) change, in SpiderMonkey's JavaScript engine, for consistency with prior behavior. The other functions' changes have more or less only been eyeballed. Careful examination appreciated! Do note, however, that an error in any of these changes would most likely produce a value that is incorrect by a factor of two, so any mistake would most likely be glaring if invoked. Submitted by: Jeff Walden Obtained from:https://github.com/freebsd/freebsd/pull/414 Reviewed by: dim, lwhsu Differential Revision: https://reviews.freebsd.org/D22354 Modified: stable/10/lib/msun/src/e_hypot.c stable/10/lib/msun/src/e_hypotf.c Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/lib/msun/src/e_hypot.c stable/11/lib/msun/src/e_hypotf.c stable/12/lib/msun/src/e_hypot.c stable/12/lib/msun/src/e_hypotf.c Directory Properties: stable/11/ (props changed) stable/12/ (props changed) Modified: stable/10/lib/msun/src/e_hypot.c == --- stable/10/lib/msun/src/e_hypot.cWed Dec 4 16:56:11 2019 (r355394) +++ stable/10/lib/msun/src/e_hypot.cWed Dec 4 17:45:34 2019 (r355395) @@ -118,10 +118,8 @@ __ieee754_hypot(double x, double y) w = sqrt(t1*y1-(w*(-w)-(t1*y2+t2*b))); } if(k!=0) { - u_int32_t high; - t1 = 1.0; - GET_HIGH_WORD(high,t1); - SET_HIGH_WORD(t1,high+(k<<20)); + t1 = 0.0; + SET_HIGH_WORD(t1,(1023+k)<<20); return t1*w; } else return w; } Modified: stable/10/lib/msun/src/e_hypotf.c == --- stable/10/lib/msun/src/e_hypotf.c Wed Dec 4 16:56:11 2019 (r355394) +++ stable/10/lib/msun/src/e_hypotf.c Wed Dec 4 17:45:34 2019 (r355395) @@ -77,7 +77,7 @@ __ieee754_hypotf(float x, float y) w = __ieee754_sqrtf(t1*y1-(w*(-w)-(t1*y2+t2*b))); } if(k!=0) { - SET_FLOAT_WORD(t1,0x3f80+(k<<23)); + SET_FLOAT_WORD(t1,(127+k)<<23); return t1*w; } else return w; } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r355395 - in stable: 10/lib/msun/src 11/lib/msun/src 12/lib/msun/src
Author: dim Date: Wed Dec 4 17:45:34 2019 New Revision: 355395 URL: https://svnweb.freebsd.org/changeset/base/355395 Log: r355120 | dim | 2019-11-26 23:01:09 +0100 (Tue, 26 Nov 2019) | 32 lines The fdlibm hypot() implementations shouldn't potentially left-shift negative numbers (invoking undefined behavior) Summary: Various paths through hypot(x, y) will multiply x and y by a power of two, perform the calculation in a range where IEEE-754 provides greater precision, then undo the multiplication to determine the true result. Undoing that multiplication is implemented as t1*w, where t1=2**k. 2**k is often computed by taking the high word of 1.0, then adding k<<20 (for doubles or long doubles) or k<<23 (for floats) to it, then overwriting that high word. But when k is negative this left-shifts a negative value -- and that's undefined behavior in many editions of C and C++. This patch should fix all hypot implementations to compute 2**k without triggering this particular bit of undefined behavior. Test Plan: I've only very lightly tested out the hypot(double, double) change, in SpiderMonkey's JavaScript engine, for consistency with prior behavior. The other functions' changes have more or less only been eyeballed. Careful examination appreciated! Do note, however, that an error in any of these changes would most likely produce a value that is incorrect by a factor of two, so any mistake would most likely be glaring if invoked. Submitted by: Jeff Walden Obtained from:https://github.com/freebsd/freebsd/pull/414 Reviewed by: dim, lwhsu Differential Revision: https://reviews.freebsd.org/D22354 Modified: stable/12/lib/msun/src/e_hypot.c stable/12/lib/msun/src/e_hypotf.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/10/lib/msun/src/e_hypot.c stable/10/lib/msun/src/e_hypotf.c stable/11/lib/msun/src/e_hypot.c stable/11/lib/msun/src/e_hypotf.c Directory Properties: stable/10/ (props changed) stable/11/ (props changed) Modified: stable/12/lib/msun/src/e_hypot.c == --- stable/12/lib/msun/src/e_hypot.cWed Dec 4 16:56:11 2019 (r355394) +++ stable/12/lib/msun/src/e_hypot.cWed Dec 4 17:45:34 2019 (r355395) @@ -118,10 +118,8 @@ __ieee754_hypot(double x, double y) w = sqrt(t1*y1-(w*(-w)-(t1*y2+t2*b))); } if(k!=0) { - u_int32_t high; - t1 = 1.0; - GET_HIGH_WORD(high,t1); - SET_HIGH_WORD(t1,high+(k<<20)); + t1 = 0.0; + SET_HIGH_WORD(t1,(1023+k)<<20); return t1*w; } else return w; } Modified: stable/12/lib/msun/src/e_hypotf.c == --- stable/12/lib/msun/src/e_hypotf.c Wed Dec 4 16:56:11 2019 (r355394) +++ stable/12/lib/msun/src/e_hypotf.c Wed Dec 4 17:45:34 2019 (r355395) @@ -77,7 +77,7 @@ __ieee754_hypotf(float x, float y) w = __ieee754_sqrtf(t1*y1-(w*(-w)-(t1*y2+t2*b))); } if(k!=0) { - SET_FLOAT_WORD(t1,0x3f80+(k<<23)); + SET_FLOAT_WORD(t1,(127+k)<<23); return t1*w; } else return w; } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r355383 - head/sys/arm64/linux
On 12/4/19 12:21 AM, Li-Wen Hsu wrote: > Author: lwhsu > Date: Wed Dec 4 08:21:54 2019 > New Revision: 355383 > URL: https://svnweb.freebsd.org/changeset/base/355383 > > Log: > Fix arm64 build after r355373 > > Sponsored by: The FreeBSD Foundation Thanks. Not sure how that slipped through as I do keep cross-building the relevant kernels for all of these changes. :( -- John Baldwin ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r355394 - in head: . lib/libc/stdlib lib/libc/sys libexec/rc/rc.d libexec/talkd sbin/devd share/man/man4 share/man/man5 stand/common stand/liblua stand/libsa sys/amd64/include sys/arm/
On Wed, Dec 4, 2019 at 9:56 AM Warner Losh wrote: > Author: imp > Date: Wed Dec 4 16:56:11 2019 > New Revision: 355394 > URL: https://svnweb.freebsd.org/changeset/base/355394 > > Log: > Regularize my copyright notice > > o Remove All Rights Reserved from my notices > o i...@freebsd.org everywhere > o regularize punctiation, eliminate date ranges > That last bit is backwards... 'prefer date ranges' is what I should have said. Warner > o Make sure that it's clear that I don't claim All Rights reserved by > listing > All Rights Reserved on same line as other copyright holders (but not > me). Other such holders are also listed last where it's clear. > ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r355394 - in head: . lib/libc/stdlib lib/libc/sys libexec/rc/rc.d libexec/talkd sbin/devd share/man/man4 share/man/man5 stand/common stand/liblua stand/libsa sys/amd64/include sys/arm/a...
Author: imp Date: Wed Dec 4 16:56:11 2019 New Revision: 355394 URL: https://svnweb.freebsd.org/changeset/base/355394 Log: Regularize my copyright notice o Remove All Rights Reserved from my notices o i...@freebsd.org everywhere o regularize punctiation, eliminate date ranges o Make sure that it's clear that I don't claim All Rights reserved by listing All Rights Reserved on same line as other copyright holders (but not me). Other such holders are also listed last where it's clear. Modified: head/UPDATING head/lib/libc/stdlib/reallocf.c head/lib/libc/sys/compat-ino64.h head/lib/libc/sys/fstat.c head/lib/libc/sys/fstatat.c head/lib/libc/sys/fstatfs.c head/lib/libc/sys/getdirentries.c head/lib/libc/sys/getfsstat.c head/lib/libc/sys/lstat.c head/lib/libc/sys/stat.c head/lib/libc/sys/statfs.c head/libexec/rc/rc.d/devmatch head/libexec/talkd/extern.h head/sbin/devd/devd.8 head/sbin/devd/devd.cc head/sbin/devd/devd.conf.5 head/sbin/devd/devd.h head/sbin/devd/devd.hh head/sbin/devd/parse.y head/sbin/devd/token.l head/share/man/man4/cardbus.4 head/share/man/man4/devctl.4 head/share/man/man4/exca.4 head/share/man/man4/iic.4 head/share/man/man4/mmc.4 head/share/man/man4/mmcsd.4 head/share/man/man4/ow.4 head/share/man/man4/ow_temp.4 head/share/man/man4/owc.4 head/share/man/man4/pccard.4 head/share/man/man4/pccbb.4 head/share/man/man4/pcib.4 head/share/man/man4/pcic.4 head/share/man/man4/ufm.4 head/share/man/man5/os-release.5 head/stand/common/paths.h head/stand/common/zfs_cmd.c head/stand/liblua/float.h head/stand/liblua/locale.h head/stand/liblua/math.h head/stand/libsa/uuid_from_string.c head/stand/libsa/uuid_to_string.c head/sys/amd64/include/_bus.h head/sys/arm/allwinner/a10_ahci.c head/sys/arm/conf/genboardid.awk head/sys/arm/include/_bus.h head/sys/arm/include/atags.h head/sys/arm/include/board.h head/sys/arm/xilinx/uart_dev_cdnc.c head/sys/arm64/include/_bus.h head/sys/cam/mmc/mmc_da.c head/sys/dev/cardbus/cardbus.c head/sys/dev/cardbus/cardbus_cis.c head/sys/dev/cardbus/cardbus_device.c head/sys/dev/cardbus/cardbusvar.h head/sys/dev/exca/exca.c head/sys/dev/exca/excareg.h head/sys/dev/exca/excavar.h head/sys/dev/fdc/fdc_isa.c head/sys/dev/fdc/fdc_pccard.c head/sys/dev/fdc/fdcvar.h head/sys/dev/flash/at45d.c head/sys/dev/flash/mx25l.c head/sys/dev/flash/n25q.c head/sys/dev/iicbus/icee.c head/sys/dev/mii/axphy.c head/sys/dev/mmc/bridge.h head/sys/dev/mmc/mmc.c head/sys/dev/mmc/mmc_private.h head/sys/dev/mmc/mmc_subr.c head/sys/dev/mmc/mmc_subr.h head/sys/dev/mmc/mmcbr_if.m head/sys/dev/mmc/mmcbrvar.h head/sys/dev/mmc/mmcbus_if.m head/sys/dev/mmc/mmcreg.h head/sys/dev/mmc/mmcsd.c head/sys/dev/mmc/mmcvar.h head/sys/dev/ow/ow.c head/sys/dev/ow/ow.h head/sys/dev/ow/ow_temp.c head/sys/dev/ow/owc_gpiobus.c head/sys/dev/ow/owll.h head/sys/dev/ow/owll_if.m head/sys/dev/ow/own.h head/sys/dev/ow/own_if.m head/sys/dev/pccard/card_if.m head/sys/dev/pccard/pccard_device.c head/sys/dev/pccard/pccardvarp.h head/sys/dev/pccard/power_if.m head/sys/dev/pccbb/pccbb.c head/sys/dev/pccbb/pccbb_isa.c head/sys/dev/pccbb/pccbb_pci.c head/sys/dev/pccbb/pccbbdevid.h head/sys/dev/pccbb/pccbbvar.h head/sys/dev/puc/puc_pci.c head/sys/dev/sdhci/sdhci_if.m head/sys/dev/spibus/spi.h head/sys/dev/spibus/spibus.c head/sys/dev/spibus/spibus_if.m head/sys/dev/spibus/spibusvar.h head/sys/dev/uart/uart_bus_acpi.c head/sys/dev/uart/uart_bus_isa.c head/sys/dev/uart/uart_bus_pccard.c head/sys/dev/uart/uart_bus_pci.c head/sys/dev/uart/uart_bus_puc.c head/sys/dev/usb/controller/generic_ohci.c head/sys/dev/usb/misc/ufm.c head/sys/dev/usb/serial/ufoma.c head/sys/dev/usb/serial/umodem.c head/sys/dev/usb/ufm_ioctl.h head/sys/dev/wi/if_wivar.h head/sys/i386/include/_bus.h head/sys/mips/cavium/uart_cpu_octeonusart.c head/sys/mips/include/_bus.h head/sys/mips/include/elf.h head/sys/mips/mips/ptrace_machdep.c head/sys/powerpc/include/_bus.h head/sys/riscv/include/_bus.h head/sys/sparc64/include/_bus.h head/tools/tools/git/git-svn-rebase head/tools/tools/nanobsd/dhcpd/common head/tools/tools/nanobsd/dhcpd/os-base head/tools/tools/nanobsd/embedded/beaglebone.cfg head/tools/tools/nanobsd/embedded/common head/tools/tools/nanobsd/embedded/i386.cfg head/tools/tools/nanobsd/embedded/pandaboard.cfg head/tools/tools/nanobsd/embedded/qemu-amd64-uefi-bios.cfg head/tools/tools/nanobsd/embedded/qemu-amd64-uefi.cfg head/tools/tools/nanobsd/embedded/qemu-amd64.cfg head/tools/tools/nanobsd/embedded/qemu-armv7.cfg head/tools/tools/nanobsd/embedded/qemu-i386.cfg head/tools/tools/nanobsd/embedded/qemu-mips.cfg head/tools/tools/nanobsd/embedded/qemu-mips64.cfg head/tools/tools/nanobsd/embedded/qemu-powerpc.cfg head/tools/tools/nanobsd/embedded/qemu-powerpc64.cfg
svn commit: r355393 - head/share/man/man9
Author: imp Date: Wed Dec 4 16:55:55 2019 New Revision: 355393 URL: https://svnweb.freebsd.org/changeset/base/355393 Log: Fix accidentally changed copyright year. Noticed by: bapt@ Modified: head/share/man/man9/bus_activate_resource.9 Modified: head/share/man/man9/bus_activate_resource.9 == --- head/share/man/man9/bus_activate_resource.9 Wed Dec 4 16:41:00 2019 (r355392) +++ head/share/man/man9/bus_activate_resource.9 Wed Dec 4 16:55:55 2019 (r355393) @@ -1,6 +1,6 @@ .\" -*- nroff -*- .\" -.\" Copyright (c) 2004 M. Warner Losh +.\" Copyright (c) 2003 M. Warner Losh .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r355392 - head/stand/efi/libefi
Author: tsoome Date: Wed Dec 4 16:41:00 2019 New Revision: 355392 URL: https://svnweb.freebsd.org/changeset/base/355392 Log: loader: clean up efipart filter expressions Small cleanup based on illumos review. Modified: head/stand/efi/libefi/efipart.c Modified: head/stand/efi/libefi/efipart.c == --- head/stand/efi/libefi/efipart.c Wed Dec 4 15:14:14 2019 (r355391) +++ head/stand/efi/libefi/efipart.c Wed Dec 4 16:41:00 2019 (r355392) @@ -324,22 +324,21 @@ efipart_ignore_device(EFI_HANDLE h, EFI_BLOCK_IO *blki parent_is_usb = true; free(parent); - /* no media, parent is USB and devicepath is lun. */ node = efi_devpath_last_node(devpath); if (node == NULL) return (false); if (parent_is_usb && - DevicePathType(node) == MESSAGING_DEVICE_PATH && - DevicePathSubType(node) == MSG_DEVICE_LOGICAL_UNIT_DP) { - efi_close_devpath(h); - return (true); - } - /* no media, parent is USB and devicepath is SCSI. */ - if (parent_is_usb && - DevicePathType(node) == MESSAGING_DEVICE_PATH && - DevicePathSubType(node) == MSG_SCSI_DP) { - efi_close_devpath(h); - return (true); + DevicePathType(node) == MESSAGING_DEVICE_PATH) { + /* +* no media, parent is USB and devicepath is +* LUN or SCSI. +*/ + if (DevicePathSubType(node) == + MSG_DEVICE_LOGICAL_UNIT_DP || + DevicePathSubType(node) == MSG_SCSI_DP) { + efi_close_devpath(h); + return (true); + } } } return (false); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r355391 - stable/12/sys/dev/ntb/ntb_hw
Author: mav Date: Wed Dec 4 15:14:14 2019 New Revision: 355391 URL: https://svnweb.freebsd.org/changeset/base/355391 Log: MFC r355165: Make DMAR allow Intel NTB device to access its own BAR0. I have no good explanation why it happens, but I found that in B2B mode at least Xeon v4 NTB leaks accesses to its configuration memory at BAR0 originated from the link side to its host side. DMAR predictably blocks those, making access to remote scratchpad registers in B2B mode impossible. This change creates identity mapping in DMAR covering the BAR0 addresses, making the NTB work fine with DMAR enabled. It seems like allowing single 4KB range at 32KB offset may be enough, but I don't see a reason to be so specific. Modified: stable/12/sys/dev/ntb/ntb_hw/ntb_hw_intel.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/ntb/ntb_hw/ntb_hw_intel.c == --- stable/12/sys/dev/ntb/ntb_hw/ntb_hw_intel.c Wed Dec 4 15:12:09 2019 (r355390) +++ stable/12/sys/dev/ntb/ntb_hw/ntb_hw_intel.c Wed Dec 4 15:14:14 2019 (r355391) @@ -218,6 +218,9 @@ struct ntb_softc { struct ntb_pci_bar_info *peer_lapic_bar; struct callout peer_msix_work; + bus_dma_tag_t bar0_dma_tag; + bus_dmamap_tbar0_dma_map; + struct callout heartbeat_timer; struct callout lr_timer; @@ -790,6 +793,29 @@ intel_ntb_map_pci_bars(struct ntb_softc *ntb) if (rc != 0) goto out; + /* +* At least on Xeon v4 NTB device leaks to host some remote side +* BAR0 writes supposed to update scratchpad registers. I am not +* sure why it happens, but it may be related to the fact that +* on a link side BAR0 is 32KB, while on a host side it is 64KB. +* Without this hack DMAR blocks those accesses as not allowed. +*/ + if (bus_dma_tag_create(bus_get_dma_tag(ntb->device), 1, 0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, + bar->size, 1, bar->size, 0, NULL, NULL, >bar0_dma_tag)) { + device_printf(ntb->device, "Unable to create BAR0 tag\n"); + return (ENOMEM); + } + if (bus_dmamap_create(ntb->bar0_dma_tag, 0, >bar0_dma_map)) { + device_printf(ntb->device, "Unable to create BAR0 map\n"); + return (ENOMEM); + } + if (bus_dma_dmar_load_ident(ntb->bar0_dma_tag, ntb->bar0_dma_map, + bar->pbase, bar->size, 0)) { + device_printf(ntb->device, "Unable to load BAR0 map\n"); + return (ENOMEM); + } + bar = >bar_info[NTB_B2B_BAR_1]; bar->pci_resource_id = PCIR_BAR(2); rc = map_memory_window_bar(ntb, bar); @@ -942,6 +968,12 @@ intel_ntb_unmap_pci_bar(struct ntb_softc *ntb) struct ntb_pci_bar_info *bar; int i; + if (ntb->bar0_dma_map != NULL) { + bus_dmamap_unload(ntb->bar0_dma_tag, ntb->bar0_dma_map); + bus_dmamap_destroy(ntb->bar0_dma_tag, ntb->bar0_dma_map); + } + if (ntb->bar0_dma_tag != NULL) + bus_dma_tag_destroy(ntb->bar0_dma_tag); for (i = 0; i < NTB_MAX_BARS; i++) { bar = >bar_info[i]; if (bar->pci_resource != NULL) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r355389 - stable/12/sys/dev/ntb/ntb_hw
Author: mav Date: Wed Dec 4 15:11:42 2019 New Revision: 355389 URL: https://svnweb.freebsd.org/changeset/base/355389 Log: MFC r355074: Report XLAT0 register for completeness. Modified: stable/12/sys/dev/ntb/ntb_hw/ntb_hw_intel.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/ntb/ntb_hw/ntb_hw_intel.c == --- stable/12/sys/dev/ntb/ntb_hw/ntb_hw_intel.c Wed Dec 4 15:04:06 2019 (r355388) +++ stable/12/sys/dev/ntb/ntb_hw/ntb_hw_intel.c Wed Dec 4 15:11:42 2019 (r355389) @@ -2408,6 +2408,14 @@ intel_ntb_sysctl_init(struct ntb_softc *ntb) if (ntb->conn_type != NTB_CONN_B2B) return; + SYSCTL_ADD_PROC(ctx, regpar, OID_AUTO, "outgoing_xlat01l", + CTLFLAG_RD | CTLTYPE_OPAQUE, ntb, + NTB_REG_32 | XEON_B2B_XLAT_OFFSETL, + sysctl_handle_register, "IU", "Outgoing XLAT0L register"); + SYSCTL_ADD_PROC(ctx, regpar, OID_AUTO, "outgoing_xlat01u", + CTLFLAG_RD | CTLTYPE_OPAQUE, ntb, + NTB_REG_32 | XEON_B2B_XLAT_OFFSETU, + sysctl_handle_register, "IU", "Outgoing XLAT0U register"); SYSCTL_ADD_PROC(ctx, regpar, OID_AUTO, "outgoing_xlat23", CTLFLAG_RD | CTLTYPE_OPAQUE, ntb, NTB_REG_64 | ntb->bar_info[NTB_B2B_BAR_1].pbarxlat_off, ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r355390 - stable/12/sys/dev/ntb/ntb_hw
Author: mav Date: Wed Dec 4 15:12:09 2019 New Revision: 355390 URL: https://svnweb.freebsd.org/changeset/base/355390 Log: MFC r355163: Make the code slightly more compact. There should be no functional change. Modified: stable/12/sys/dev/ntb/ntb_hw/ntb_hw_intel.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/ntb/ntb_hw/ntb_hw_intel.c == --- stable/12/sys/dev/ntb/ntb_hw/ntb_hw_intel.c Wed Dec 4 15:11:42 2019 (r355389) +++ stable/12/sys/dev/ntb/ntb_hw/ntb_hw_intel.c Wed Dec 4 15:12:09 2019 (r355390) @@ -781,37 +781,42 @@ bar_get_xlat_params(struct ntb_softc *ntb, enum ntb_ba static int intel_ntb_map_pci_bars(struct ntb_softc *ntb) { + struct ntb_pci_bar_info *bar; int rc; - ntb->bar_info[NTB_CONFIG_BAR].pci_resource_id = PCIR_BAR(0); - rc = map_mmr_bar(ntb, >bar_info[NTB_CONFIG_BAR]); + bar = >bar_info[NTB_CONFIG_BAR]; + bar->pci_resource_id = PCIR_BAR(0); + rc = map_mmr_bar(ntb, bar); if (rc != 0) goto out; - ntb->bar_info[NTB_B2B_BAR_1].pci_resource_id = PCIR_BAR(2); - rc = map_memory_window_bar(ntb, >bar_info[NTB_B2B_BAR_1]); + bar = >bar_info[NTB_B2B_BAR_1]; + bar->pci_resource_id = PCIR_BAR(2); + rc = map_memory_window_bar(ntb, bar); if (rc != 0) goto out; - ntb->bar_info[NTB_B2B_BAR_1].psz_off = XEON_PBAR23SZ_OFFSET; - ntb->bar_info[NTB_B2B_BAR_1].ssz_off = XEON_SBAR23SZ_OFFSET; - ntb->bar_info[NTB_B2B_BAR_1].pbarxlat_off = XEON_PBAR2XLAT_OFFSET; + bar->psz_off = XEON_PBAR23SZ_OFFSET; + bar->ssz_off = XEON_SBAR23SZ_OFFSET; + bar->pbarxlat_off = XEON_PBAR2XLAT_OFFSET; - ntb->bar_info[NTB_B2B_BAR_2].pci_resource_id = PCIR_BAR(4); - rc = map_memory_window_bar(ntb, >bar_info[NTB_B2B_BAR_2]); + bar = >bar_info[NTB_B2B_BAR_2]; + bar->pci_resource_id = PCIR_BAR(4); + rc = map_memory_window_bar(ntb, bar); if (rc != 0) goto out; - ntb->bar_info[NTB_B2B_BAR_2].psz_off = XEON_PBAR4SZ_OFFSET; - ntb->bar_info[NTB_B2B_BAR_2].ssz_off = XEON_SBAR4SZ_OFFSET; - ntb->bar_info[NTB_B2B_BAR_2].pbarxlat_off = XEON_PBAR4XLAT_OFFSET; + bar->psz_off = XEON_PBAR4SZ_OFFSET; + bar->ssz_off = XEON_SBAR4SZ_OFFSET; + bar->pbarxlat_off = XEON_PBAR4XLAT_OFFSET; if (!HAS_FEATURE(ntb, NTB_SPLIT_BAR)) goto out; - ntb->bar_info[NTB_B2B_BAR_3].pci_resource_id = PCIR_BAR(5); - rc = map_memory_window_bar(ntb, >bar_info[NTB_B2B_BAR_3]); - ntb->bar_info[NTB_B2B_BAR_3].psz_off = XEON_PBAR5SZ_OFFSET; - ntb->bar_info[NTB_B2B_BAR_3].ssz_off = XEON_SBAR5SZ_OFFSET; - ntb->bar_info[NTB_B2B_BAR_3].pbarxlat_off = XEON_PBAR5XLAT_OFFSET; + bar = >bar_info[NTB_B2B_BAR_3]; + bar->pci_resource_id = PCIR_BAR(5); + rc = map_memory_window_bar(ntb, bar); + bar->psz_off = XEON_PBAR5SZ_OFFSET; + bar->ssz_off = XEON_SBAR5SZ_OFFSET; + bar->pbarxlat_off = XEON_PBAR5XLAT_OFFSET; out: if (rc != 0) @@ -934,15 +939,14 @@ map_memory_window_bar(struct ntb_softc *ntb, struct nt static void intel_ntb_unmap_pci_bar(struct ntb_softc *ntb) { - struct ntb_pci_bar_info *current_bar; + struct ntb_pci_bar_info *bar; int i; for (i = 0; i < NTB_MAX_BARS; i++) { - current_bar = >bar_info[i]; - if (current_bar->pci_resource != NULL) + bar = >bar_info[i]; + if (bar->pci_resource != NULL) bus_release_resource(ntb->device, SYS_RES_MEMORY, - current_bar->pci_resource_id, - current_bar->pci_resource); + bar->pci_resource_id, bar->pci_resource); } } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r355388 - head/usr.sbin/ntp/doc
Author: cy Date: Wed Dec 4 15:04:06 2019 New Revision: 355388 URL: https://svnweb.freebsd.org/changeset/base/355388 Log: Chase r352304. The default rlimit memlock is no memory locking. Reported by: egypcio@ MFC after:3 days Modified: head/usr.sbin/ntp/doc/ntp.conf.5 Modified: head/usr.sbin/ntp/doc/ntp.conf.5 == --- head/usr.sbin/ntp/doc/ntp.conf.5Wed Dec 4 13:28:17 2019 (r355387) +++ head/usr.sbin/ntp/doc/ntp.conf.5Wed Dec 4 15:04:06 2019 (r355388) @@ -2965,7 +2965,7 @@ Probably only available under Linux, this option may b when dropping root (the .Fl i option). -The default is 32 megabytes on non\-Linux machines, and \-1 under Linux. +The default is \-1. -1 means "do not lock the process into memory". 0 means "lock whatever memory the process wants into memory". .It Cm stacksize Ar N4kPages ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r355387 - stable/11/sys/dev/iicbus/twsi
Author: loos Date: Wed Dec 4 13:28:17 2019 New Revision: 355387 URL: https://svnweb.freebsd.org/changeset/base/355387 Log: MFC r320159: Add the ofw_bus_get_node() callback in mv_twsi, it is mandatory for the ofw_iicbus usage. Sponsored by: Rubicon Communications, LLC (Netgate) Modified: stable/11/sys/dev/iicbus/twsi/mv_twsi.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/iicbus/twsi/mv_twsi.c == --- stable/11/sys/dev/iicbus/twsi/mv_twsi.c Wed Dec 4 09:24:36 2019 (r355386) +++ stable/11/sys/dev/iicbus/twsi/mv_twsi.c Wed Dec 4 13:28:17 2019 (r355387) @@ -91,6 +91,7 @@ __FBSDID("$FreeBSD$"); #define debugf(fmt, args...) #endif +static phandle_t mv_twsi_get_node(device_t, device_t); static int mv_twsi_probe(device_t); static int mv_twsi_attach(device_t); @@ -105,7 +106,10 @@ static device_method_t mv_twsi_methods[] = { DEVMETHOD(device_probe, mv_twsi_probe), DEVMETHOD(device_attach,mv_twsi_attach), - { 0, 0 } + /* ofw_bus interface */ + DEVMETHOD(ofw_bus_get_node, mv_twsi_get_node), + + DEVMETHOD_END }; DEFINE_CLASS_1(twsi, mv_twsi_driver, mv_twsi_methods, @@ -116,6 +120,14 @@ static devclass_t mv_twsi_devclass; DRIVER_MODULE(twsi, simplebus, mv_twsi_driver, mv_twsi_devclass, 0, 0); DRIVER_MODULE(iicbus, twsi, iicbus_driver, iicbus_devclass, 0, 0); MODULE_DEPEND(twsi, iicbus, 1, 1, 1); + +static phandle_t +mv_twsi_get_node(device_t bus, device_t dev) +{ + + /* Used by ofw_iicbus. */ + return (ofw_bus_get_node(bus)); +} static int mv_twsi_probe(device_t dev) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r355318 - head/sbin/newfs_msdos
On Wed, Dec 04, 2019 at 12:51:44AM -0800, Xin Li wrote: > On 12/3/19 14:02, Conrad Meyer wrote: > > Hi Xin Li, > > > > Is there a reason to prefer exit() over returning from main? I have > > No, this should be case-by-case (and also assumes you are using C and > not C++). > > The two are actually subtly different (return means teardown main's > stack first, then implicitly call exit from C runtime, while exit() > would terminate immediately). This is even more subtle. If libthr is loaded into the process, then exit() also causes stack unwinding. > > If the command is meant to be used as a built-in module of something > else, like the case of kill(1) builtin of sh(1), then one must not use > exit() and also need to pay special attention to not exit() implicitly, > because the caller will not fork() prior to calling the aliased main() > function for performance reasons. > > For other cases, using exit() might be a good idea, because it's easier > to find the exit points especially if one is following sysexits(3) > values. Another reason is that if one allocates memory in main but not > free them (these shouldn't be free'ed because the kernel would unmap all > pages upon exit), return would mean these memory would be leaked: these > are legitimate issues when main() would be called by someone else. With > an explicit exit(), these memory are never leaked because stack frame of > main() remains valid before the final _exit(2) call. > > > not surveyed the source tree, but I suspect most programs in base exit > > by returning from main rather than explicit exit(3).> Thanks, > > Conrad > > > > On Mon, Dec 2, 2019 at 11:03 PM Xin LI wrote: > >> > >> Author: delphij > >> Date: Tue Dec 3 07:03:25 2019 > >> New Revision: 355318 > >> URL: https://svnweb.freebsd.org/changeset/base/355318 > >> > >> Log: > >> Explicitly exit() instead of return in main(). > >> > >> MFC after:2 weeks > >> > >> Modified: > >> head/sbin/newfs_msdos/newfs_msdos.c > >> > >> Modified: head/sbin/newfs_msdos/newfs_msdos.c > >> == > >> --- head/sbin/newfs_msdos/newfs_msdos.c Tue Dec 3 07:01:28 2019 > >> (r355317) > >> +++ head/sbin/newfs_msdos/newfs_msdos.c Tue Dec 3 07:03:25 2019 > >> (r355318) > >> @@ -189,7 +189,7 @@ main(int argc, char *argv[]) > >> err(1, NULL); > >> } > >> dtype = *argv; > >> -return !!mkfs_msdos(fname, dtype, ); > >> +exit(!!mkfs_msdos(fname, dtype, )); > >> } > >> > >> /* > > ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r355386 - stable/11/sys/kern
Author: kib Date: Wed Dec 4 09:24:36 2019 New Revision: 355386 URL: https://svnweb.freebsd.org/changeset/base/355386 Log: MFC r355146: Ease the life of PT_TO_SCE/PT_TO_SCX users when debuggee sleeps in sigsuspend(2)/sig{timed,}wait(2). Modified: stable/11/sys/kern/kern_sig.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/kern_sig.c == --- stable/11/sys/kern/kern_sig.c Wed Dec 4 09:21:00 2019 (r355385) +++ stable/11/sys/kern/kern_sig.c Wed Dec 4 09:24:36 2019 (r355386) @@ -63,6 +63,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -1253,11 +1254,13 @@ kern_sigtimedwait(struct thread *td, sigset_t waitset, int error, sig, timo, timevalid = 0; struct timespec rts, ets, ts; struct timeval tv; + bool traced; p = td->td_proc; error = 0; ets.tv_sec = 0; ets.tv_nsec = 0; + traced = false; if (timeout != NULL) { if (timeout->tv_nsec >= 0 && timeout->tv_nsec < 10) { @@ -1312,6 +1315,11 @@ kern_sigtimedwait(struct thread *td, sigset_t waitset, timo = 0; } + if (traced) { + error = EINTR; + break; + } + error = msleep(ps, >p_mtx, PPAUSE|PCATCH, "sigwait", timo); if (timeout != NULL) { @@ -1323,6 +1331,16 @@ kern_sigtimedwait(struct thread *td, sigset_t waitset, error = 0; } } + + /* +* If PTRACE_SCE or PTRACE_SCX were set after +* userspace entered the syscall, return spurious +* EINTR after wait was done. Only do this as last +* resort after rechecking for possible queued signals +* and expired timeouts. +*/ + if (error == 0 && (p->p_ptevents & PTRACE_SYSCALL) != 0) + traced = true; } new_block = saved_mask; @@ -1535,6 +1553,14 @@ kern_sigsuspend(struct thread *td, sigset_t mask) has_sig += postsig(sig); } mtx_unlock(>p_sigacts->ps_mtx); + + /* +* If PTRACE_SCE or PTRACE_SCX were set after +* userspace entered the syscall, return spurious +* EINTR. +*/ + if ((p->p_ptevents & PTRACE_SYSCALL) != 0) + has_sig += 1; } PROC_UNLOCK(p); td->td_errno = EINTR; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r355385 - stable/12/sys/kern
Author: kib Date: Wed Dec 4 09:21:00 2019 New Revision: 355385 URL: https://svnweb.freebsd.org/changeset/base/355385 Log: MFC r355146: Ease the life of PT_TO_SCE/PT_TO_SCX users when debuggee sleeps in sigsuspend(2)/sig{timed,}wait(2). Modified: stable/12/sys/kern/kern_sig.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/kern_sig.c == --- stable/12/sys/kern/kern_sig.c Wed Dec 4 09:18:32 2019 (r355384) +++ stable/12/sys/kern/kern_sig.c Wed Dec 4 09:21:00 2019 (r355385) @@ -65,6 +65,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -1252,11 +1253,13 @@ kern_sigtimedwait(struct thread *td, sigset_t waitset, int error, sig, timo, timevalid = 0; struct timespec rts, ets, ts; struct timeval tv; + bool traced; p = td->td_proc; error = 0; ets.tv_sec = 0; ets.tv_nsec = 0; + traced = false; if (timeout != NULL) { if (timeout->tv_nsec >= 0 && timeout->tv_nsec < 10) { @@ -1309,6 +1312,11 @@ kern_sigtimedwait(struct thread *td, sigset_t waitset, timo = 0; } + if (traced) { + error = EINTR; + break; + } + error = msleep(ps, >p_mtx, PPAUSE|PCATCH, "sigwait", timo); if (timeout != NULL) { @@ -1320,6 +1328,16 @@ kern_sigtimedwait(struct thread *td, sigset_t waitset, error = 0; } } + + /* +* If PTRACE_SCE or PTRACE_SCX were set after +* userspace entered the syscall, return spurious +* EINTR after wait was done. Only do this as last +* resort after rechecking for possible queued signals +* and expired timeouts. +*/ + if (error == 0 && (p->p_ptevents & PTRACE_SYSCALL) != 0) + traced = true; } new_block = saved_mask; @@ -1532,6 +1550,14 @@ kern_sigsuspend(struct thread *td, sigset_t mask) has_sig += postsig(sig); } mtx_unlock(>p_sigacts->ps_mtx); + + /* +* If PTRACE_SCE or PTRACE_SCX were set after +* userspace entered the syscall, return spurious +* EINTR. +*/ + if ((p->p_ptevents & PTRACE_SYSCALL) != 0) + has_sig += 1; } PROC_UNLOCK(p); td->td_errno = EINTR; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r355384 - in stable/12/sys/x86: include iommu x86
Author: kib Date: Wed Dec 4 09:18:32 2019 New Revision: 355384 URL: https://svnweb.freebsd.org/changeset/base/355384 Log: MFC r355138: bus_dma_dmar_load_ident(9): load identity mapping into the map. Modified: stable/12/sys/x86/include/bus_dma.h stable/12/sys/x86/iommu/busdma_dmar.c stable/12/sys/x86/iommu/intel_ctx.c stable/12/sys/x86/iommu/intel_dmar.h stable/12/sys/x86/iommu/intel_gas.c stable/12/sys/x86/x86/busdma_machdep.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/x86/include/bus_dma.h == --- stable/12/sys/x86/include/bus_dma.h Wed Dec 4 08:21:54 2019 (r355383) +++ stable/12/sys/x86/include/bus_dma.h Wed Dec 4 09:18:32 2019 (r355384) @@ -181,6 +181,8 @@ _bus_dmamap_complete(bus_dma_tag_t dmat, bus_dmamap_t #ifdef _KERNEL bool bus_dma_dmar_set_buswide(device_t dev); +int bus_dma_dmar_load_ident(bus_dma_tag_t dmat, bus_dmamap_t map, +vm_paddr_t start, vm_size_t length, int flags); #endif #endif /* !_X86_BUS_DMA_H_ */ Modified: stable/12/sys/x86/iommu/busdma_dmar.c == --- stable/12/sys/x86/iommu/busdma_dmar.c Wed Dec 4 08:21:54 2019 (r355383) +++ stable/12/sys/x86/iommu/busdma_dmar.c Wed Dec 4 09:18:32 2019 (r355384) @@ -950,3 +950,66 @@ dmar_fini_busdma(struct dmar_unit *unit) taskqueue_free(unit->delayed_taskqueue); unit->delayed_taskqueue = NULL; } + +int +bus_dma_dmar_load_ident(bus_dma_tag_t dmat, bus_dmamap_t map1, +vm_paddr_t start, vm_size_t length, int flags) +{ + struct bus_dma_tag_common *tc; + struct bus_dma_tag_dmar *tag; + struct bus_dmamap_dmar *map; + struct dmar_ctx *ctx; + struct dmar_domain *domain; + struct dmar_map_entry *entry; + vm_page_t *ma; + vm_size_t i; + int error; + bool waitok; + + MPASS((start & PAGE_MASK) == 0); + MPASS((length & PAGE_MASK) == 0); + MPASS(length > 0); + MPASS(start + length >= start); + MPASS((flags & ~(BUS_DMA_NOWAIT | BUS_DMA_NOWRITE)) == 0); + + tc = (struct bus_dma_tag_common *)dmat; + if (tc->impl != _dma_dmar_impl) + return (0); + + tag = (struct bus_dma_tag_dmar *)dmat; + ctx = tag->ctx; + domain = ctx->domain; + map = (struct bus_dmamap_dmar *)map1; + waitok = (flags & BUS_DMA_NOWAIT) != 0; + + entry = dmar_gas_alloc_entry(domain, waitok ? 0 : DMAR_PGF_WAITOK); + if (entry == NULL) + return (ENOMEM); + entry->start = start; + entry->end = start + length; + ma = malloc(sizeof(vm_page_t) * atop(length), M_TEMP, waitok ? + M_WAITOK : M_NOWAIT); + if (ma == NULL) { + dmar_gas_free_entry(domain, entry); + return (ENOMEM); + } + for (i = 0; i < atop(length); i++) { + ma[i] = vm_page_getfake(entry->start + PAGE_SIZE * i, + VM_MEMATTR_DEFAULT); + } + error = dmar_gas_map_region(domain, entry, DMAR_MAP_ENTRY_READ | + ((flags & BUS_DMA_NOWRITE) ? 0 : DMAR_MAP_ENTRY_WRITE), + waitok ? DMAR_GM_CANWAIT : 0, ma); + if (error == 0) { + DMAR_DOMAIN_LOCK(domain); + TAILQ_INSERT_TAIL(>map_entries, entry, dmamap_link); + entry->flags |= DMAR_MAP_ENTRY_MAP; + DMAR_DOMAIN_UNLOCK(domain); + } else { + dmar_domain_unload_entry(entry, true); + } + for (i = 0; i < atop(length); i++) + vm_page_putfake(ma[i]); + free(ma, M_TEMP); + return (error); +} Modified: stable/12/sys/x86/iommu/intel_ctx.c == --- stable/12/sys/x86/iommu/intel_ctx.c Wed Dec 4 08:21:54 2019 (r355383) +++ stable/12/sys/x86/iommu/intel_ctx.c Wed Dec 4 09:18:32 2019 (r355384) @@ -279,7 +279,7 @@ domain_init_rmrr(struct dmar_domain *domain, device_t } error1 = dmar_gas_map_region(domain, entry, DMAR_MAP_ENTRY_READ | DMAR_MAP_ENTRY_WRITE, - DMAR_GM_CANWAIT, ma); + DMAR_GM_CANWAIT | DMAR_GM_RMRR, ma); /* * Non-failed RMRR entries are owned by context rb * tree. Get rid of the failed entry, but do not stop Modified: stable/12/sys/x86/iommu/intel_dmar.h == --- stable/12/sys/x86/iommu/intel_dmar.hWed Dec 4 08:21:54 2019 (r355383) +++ stable/12/sys/x86/iommu/intel_dmar.hWed Dec 4 09:18:32 2019 (r355384) @@ -391,6 +391,7 @@ bool dmar_is_buswide_ctx(struct dmar_unit *unit, u_int #defineDMAR_GM_CANWAIT 0x0001 #defineDMAR_GM_CANSPLIT 0x0002 +#define
Re: svn commit: r355318 - head/sbin/newfs_msdos
On 12/3/19 14:02, Conrad Meyer wrote: > Hi Xin Li, > > Is there a reason to prefer exit() over returning from main? I have No, this should be case-by-case (and also assumes you are using C and not C++). The two are actually subtly different (return means teardown main's stack first, then implicitly call exit from C runtime, while exit() would terminate immediately). If the command is meant to be used as a built-in module of something else, like the case of kill(1) builtin of sh(1), then one must not use exit() and also need to pay special attention to not exit() implicitly, because the caller will not fork() prior to calling the aliased main() function for performance reasons. For other cases, using exit() might be a good idea, because it's easier to find the exit points especially if one is following sysexits(3) values. Another reason is that if one allocates memory in main but not free them (these shouldn't be free'ed because the kernel would unmap all pages upon exit), return would mean these memory would be leaked: these are legitimate issues when main() would be called by someone else. With an explicit exit(), these memory are never leaked because stack frame of main() remains valid before the final _exit(2) call. > not surveyed the source tree, but I suspect most programs in base exit > by returning from main rather than explicit exit(3).> Thanks, > Conrad > > On Mon, Dec 2, 2019 at 11:03 PM Xin LI wrote: >> >> Author: delphij >> Date: Tue Dec 3 07:03:25 2019 >> New Revision: 355318 >> URL: https://svnweb.freebsd.org/changeset/base/355318 >> >> Log: >> Explicitly exit() instead of return in main(). >> >> MFC after:2 weeks >> >> Modified: >> head/sbin/newfs_msdos/newfs_msdos.c >> >> Modified: head/sbin/newfs_msdos/newfs_msdos.c >> == >> --- head/sbin/newfs_msdos/newfs_msdos.c Tue Dec 3 07:01:28 2019 >> (r355317) >> +++ head/sbin/newfs_msdos/newfs_msdos.c Tue Dec 3 07:03:25 2019 >> (r355318) >> @@ -189,7 +189,7 @@ main(int argc, char *argv[]) >> err(1, NULL); >> } >> dtype = *argv; >> -return !!mkfs_msdos(fname, dtype, ); >> +exit(!!mkfs_msdos(fname, dtype, )); >> } >> >> /* signature.asc Description: OpenPGP digital signature
svn commit: r355383 - head/sys/arm64/linux
Author: lwhsu Date: Wed Dec 4 08:21:54 2019 New Revision: 355383 URL: https://svnweb.freebsd.org/changeset/base/355383 Log: Fix arm64 build after r355373 Sponsored by: The FreeBSD Foundation Modified: head/sys/arm64/linux/linux_sysvec.c Modified: head/sys/arm64/linux/linux_sysvec.c == --- head/sys/arm64/linux/linux_sysvec.c Wed Dec 4 08:03:33 2019 (r355382) +++ head/sys/arm64/linux/linux_sysvec.c Wed Dec 4 08:21:54 2019 (r355383) @@ -217,7 +217,7 @@ linux_copyout_strings(struct image_params *imgp, uintp { char **vectp; char *stringp; - uintptr_t *destp, *ustringp; + uintptr_t destp, ustringp; struct ps_strings *arginfo; char canary[LINUX_AT_RANDOM_LEN]; size_t execpath_len; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r355382 - head/sys/dev/pci
Author: se Date: Wed Dec 4 08:03:33 2019 New Revision: 355382 URL: https://svnweb.freebsd.org/changeset/base/355382 Log: Remove "All rights reserved" phrase from copyright notes. With the ratification of the Berne Convention in 2000, it became obsolete. I have removed that phrase and the "(c)" only from files without copyright claims by other parties. There are 2 files (pci.c, pci_private.h) that are also claimed by Michael Smith and by BSDi, which have therefore not been included in this commit. When all member nations of the Buenos Aires Convention adopted the Berne Convention, the phrase "All rights reserved" became unnecessary to assert copyright. Remove it from files under my copyright. There are 2 files (pci.c, pci_private.h) that) that do also bear msmith's and BSDi's copyright. I have left them unchanged for now, since I do not know whether they (or the legal successor in case of BSDi) would agree. Modified: head/sys/dev/pci/hostb_pci.c head/sys/dev/pci/pci_user.c head/sys/dev/pci/pcireg.h head/sys/dev/pci/pcivar.h Modified: head/sys/dev/pci/hostb_pci.c == --- head/sys/dev/pci/hostb_pci.cWed Dec 4 04:01:53 2019 (r355381) +++ head/sys/dev/pci/hostb_pci.cWed Dec 4 08:03:33 2019 (r355382) @@ -1,8 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 1997, Stefan Esser - * All rights reserved. + * Copyright 1997, Stefan Esser * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/dev/pci/pci_user.c == --- head/sys/dev/pci/pci_user.c Wed Dec 4 04:01:53 2019(r355381) +++ head/sys/dev/pci/pci_user.c Wed Dec 4 08:03:33 2019(r355382) @@ -1,8 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 1997, Stefan Esser - * All rights reserved. + * Copyright 1997, Stefan Esser * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/dev/pci/pcireg.h == --- head/sys/dev/pci/pcireg.h Wed Dec 4 04:01:53 2019(r355381) +++ head/sys/dev/pci/pcireg.h Wed Dec 4 08:03:33 2019(r355382) @@ -1,8 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 1997, Stefan Esser - * All rights reserved. + * Copyright 1997, Stefan Esser * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/dev/pci/pcivar.h == --- head/sys/dev/pci/pcivar.h Wed Dec 4 04:01:53 2019(r355381) +++ head/sys/dev/pci/pcivar.h Wed Dec 4 08:03:33 2019(r355382) @@ -1,8 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 1997, Stefan Esser - * All rights reserved. + * Copyright 1997, Stefan Esser * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"