On Fri, Feb 17, 2017 at 05:05:54PM +1100, Bruce Evans wrote: > On Fri, 17 Feb 2017, Mark Johnston wrote: > > > Log: > > Directly include needed headers rather than relying on pollution. > > > > We get machine/cpu.h via kmem.h -> proc.h -> _vm_domain.h -> seq.h. > > machine/cpu.h is not added here. Do you mean machine/cpufnc.h? > > > Modified: head/sys/cddl/dev/dtrace/amd64/dtrace_subr.c > > ============================================================================== > > --- head/sys/cddl/dev/dtrace/amd64/dtrace_subr.c Fri Feb 17 00:50:00 > > 2017 (r313849) > > +++ head/sys/cddl/dev/dtrace/amd64/dtrace_subr.c Fri Feb 17 03:27:20 > > 2017 (r313850) > > @@ -41,7 +41,9 @@ > > #include <sys/dtrace_impl.h> > > #include <sys/dtrace_bsd.h> > > #include <machine/clock.h> > > +#include <machine/cpufunc.h> > > This was correct. <machine/cpufunc.h> is standard pollution in <sys/systm.h>, > and it is a style bug to include it directly, and a bug to not include > <sys/systm.h> after <sys/param.h> and before all other headers in kernel > .c files. > > It is pollution to include <machine/cpufunc.h> in any header except > <sys/systm.h>. kmem.h has grosser pollution (param, proc, malloc, vmem, > vm/uma, vm/vm, vm/vm_extern, but not systm which is a prerequisite for > most of the other headers that kmem.h includes). Most of the other headers > also have gross pollution, ending with seq.h which includes systm.h and > its standard pollution. > > seq.h also includes machine/cpu.h. Apparently kmem.h does depend on this, > and this commit doesn't fix it.
This commit was intended to address an issue with r313841, which added a "KASSERT((read_rflags() & PSL_I) == 0, ...);" to dtrace_subr.c. That change fails to compile when ported to a kernel that predates seq.h; it's only because we include kmem.h and thus seq.h that r313841 compiles on HEAD - kmem.h itself doesn't depend on cpufunc.h as far as I know. > > > #include <machine/frame.h> > > +#include <machine/psl.h> > > This include is not mentioned in the log message. > > machine/psl.h is stamdard pollution in machine/cpu.h (on at least amd64 and > i386), so would not be needed here if machine/cpu.h had been spelled > correctly. Sorry, my commit log message wasn't very good. psl.h is needed for the definition of PSL_I. I take it then that the diff below is the correct fix, since sys/systm.h isn't sufficient. diff --git a/sys/cddl/dev/dtrace/amd64/dtrace_subr.c b/sys/cddl/dev/dtrace/amd64/dtrace_subr.c index 717f4557a64d..e180f4d0a57c 100644 --- a/sys/cddl/dev/dtrace/amd64/dtrace_subr.c +++ b/sys/cddl/dev/dtrace/amd64/dtrace_subr.c @@ -41,9 +41,8 @@ #include <sys/dtrace_impl.h> #include <sys/dtrace_bsd.h> #include <machine/clock.h> -#include <machine/cpufunc.h> +#include <machine/cpu.h> #include <machine/frame.h> -#include <machine/psl.h> #include <vm/pmap.h> extern void dtrace_getnanotime(struct timespec *tsp); diff --git a/sys/cddl/dev/dtrace/i386/dtrace_subr.c b/sys/cddl/dev/dtrace/i386/dtrace_subr.c index 3801c1ba772c..c266f27bbd52 100644 --- a/sys/cddl/dev/dtrace/i386/dtrace_subr.c +++ b/sys/cddl/dev/dtrace/i386/dtrace_subr.c @@ -42,9 +42,8 @@ #include <sys/dtrace_impl.h> #include <sys/dtrace_bsd.h> #include <machine/clock.h> -#include <machine/cpufunc.h> +#include <machine/cpu.h> #include <machine/frame.h> -#include <machine/psl.h> #include <vm/pmap.h> extern uintptr_t kernelbase; _______________________________________________ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"