Re: svn commit: r327767 - in head/sys: conf i386/bios i386/conf i386/isa

2018-01-13 Thread Bruce Evans

On Sat, 13 Jan 2018, Warner Losh wrote:


[trimmed, sorry ]


Your mail client also corrupted the formatting, especially for tabs.  It
sends plain text with tabs corrupted to spaces and an html attachment with
full-width tabs corrupted to "=C2=A0 =C2=A0 =C2=A0 =C2=A0 ", both with
charset UTF-8.  The plain text is readable, but some (non-UTF-8-aware)
mail clients apparently display the html and further corrupt the tab to
"\xc2\xa0 \xc2\xa0 \xc2\xa0 \xc2\xa0".  With my default font, 0xc2 is
rendered as a line-drawing graphics character, \xa0 is rendered as a
space, and " " is rendered as a space.  The html is further mis-displayed
by adding a large left margin.  The same mail client doesn't do this for
html attachments from other senders.  The same mail client quotes only
the plain text for replies.  Other senders tend to put raw '\xa0' in the
plain text after corrupting tabs to that, and this is preserved in replies.
Non-UTF-8-aware vi renders '\xa0' as "\xa0" so that the errors are more
obvious.


Log:

 Retire pmtimer driver. Move time fixing into apm driver. Move
 Iwasaki-san's copyright over. Remove FIXME code that couldn't possibly
 work. Call tc_settime() with our estimate of the delta we've been
 alseep (the one we print) to adjust the time. Not sure what to do
 about callouts, so keep the small #ifdef in place there.
...


At least the quoting seems to be correct (in the plain text version).


@@ -331,12 +358,10 @@ apm_battery_low(void)

static struct apmhook *
apm_add_hook(struct apmhook **list, struct apmhook *ah)
{
-   int s;
struct apmhook *p, *prev;

APM_DPRINT("Add hook \"%s\"\n", ah->ah_name);

-   s = splhigh();
if (ah == NULL)
panic("illegal apm_hook!");
prev = NULL;
@@ -351,30 +376,25 @@ apm_add_hook(struct apmhook **list, struct apmhook
*ah
ah->ah_next = prev->ah_next;
prev->ah_next = ah;
}
-   splx(s);
return ah;
}



This commit also removes spl*() with no mention of this in the log message.
In FreeBSD-4 where spl's were not null, splhigh() was probably wrong, but
it
was much better than the splsoftclock() used in pmtimer.c.  Hard clock
interrupts should be disabled, and my fixes for this change softclock to
statclock + XXX.  It happens that splstatclock() == splclock() ==
splhigh(),
so these splhigh()s were good enough.


Actually, the quoting is broken by splitting long lines in a simple way --
the method seems to be to reformat to width 80 without reformatting whole
paragraphs.  This is only bad for source code.  Reformatting "paragraphs"
in source code would be worse.


Now the locking is obscure.  I think it is just Giant, and that is not
enough.  The spl's should not be removed until the locking is done
properly.
The splsoftclock()'s were removed even earlier in pmtimer.c, without doing
any proper locking of course.


Right, nothing calls these, except in attach, so I removed the broken
locking rather than fixing it.


Attach also uses Giant locking, and it is not clear that this is enough.
It is certainly not enough for detach.

Locking hints should be kept until Giant goes away.  Perhaps they could
be assertions that Giant is held (with this implicitly implying that
Giant is enough), but it is easier to keep using the spls.



static void

apm_del_hook(struct apmhook **list, struct apmhook *ah)
{
-   int s;
struct apmhook *p, *prev;

-   s = splhigh();
prev = NULL;
for (p = *list; p != NULL; prev = p, p = p->ah_next)
if (p == ah)
goto deleteit;
panic("Tried to delete unregistered apm_hook.");
-   goto nosuchnode;
+   return;
deleteit:
if (prev != NULL)
prev->ah_next = p->ah_next;
else
*list = p->ah_next;
-nosuchnode:
-   splx(s);
}



Locking for device removal is especially necessary and badly done.  New-bus
forces lots of Giant locking which is probably not enough.


what calls that?


I thought that it was for something like detach.

apm_del_hook() seems to be just unused garbage.  It is only called by
apm_hook_disestablish(), but that is never called according to grep.
Grep would have missed any magic to generate a call from a .m file.

This API also has style bugs: the verbs 'del' and 'disestablish' are
in different places; 'disestablish' is too verbose 'del' relatively
to concise; both seem to be for destructors of the same thing so why
are there 2 of them?  Well, the 'del' one is just to do most of the
work for the 'disestablish' one.  It is only called once so not doing
it directly is just an obfuscation.

Further grepping shows that apm_hook_disestablish() was last used in
FreeBSD-3.  It was used by pccard/pccard.c then.  In FreeBSD-4 and
FreeBSD-8, its non-use looks just like in -current, except its
implementation was duplicated for pc98.  FreeBSD-3 doesn't support
pc98, at least for apm hooks.

Similarly for 

svn commit: r327958 - head/sys/dev/virtio

2018-01-13 Thread Bryan Venteicher
Author: bryanv
Date: Sun Jan 14 06:03:40 2018
New Revision: 327958
URL: https://svnweb.freebsd.org/changeset/base/327958

Log:
  Sync VirtIO IDs with Linux

Modified:
  head/sys/dev/virtio/virtio.c
  head/sys/dev/virtio/virtio_ids.h

Modified: head/sys/dev/virtio/virtio.c
==
--- head/sys/dev/virtio/virtio.cSun Jan 14 05:10:02 2018
(r327957)
+++ head/sys/dev/virtio/virtio.cSun Jan 14 06:03:40 2018
(r327958)
@@ -54,14 +54,21 @@ static struct virtio_ident {
uint16_tdevid;
const char  *name;
 } virtio_ident_table[] = {
-   { VIRTIO_ID_NETWORK,"Network"   },
-   { VIRTIO_ID_BLOCK,  "Block" },
-   { VIRTIO_ID_CONSOLE,"Console"   },
-   { VIRTIO_ID_ENTROPY,"Entropy"   },
-   { VIRTIO_ID_BALLOON,"Balloon"   },
-   { VIRTIO_ID_IOMEMORY,   "IOMemory"  },
-   { VIRTIO_ID_SCSI,   "SCSI"  },
-   { VIRTIO_ID_9P, "9P Transport"  },
+   { VIRTIO_ID_NETWORK,"Network"   },
+   { VIRTIO_ID_BLOCK,  "Block" },
+   { VIRTIO_ID_CONSOLE,"Console"   },
+   { VIRTIO_ID_ENTROPY,"Entropy"   },
+   { VIRTIO_ID_BALLOON,"Balloon"   },
+   { VIRTIO_ID_IOMEMORY,   "IOMemory"  },
+   { VIRTIO_ID_RPMSG,  "Remote Processor Messaging"},
+   { VIRTIO_ID_SCSI,   "SCSI"  },
+   { VIRTIO_ID_9P, "9P Transport"  },
+   { VIRTIO_ID_RPROC_SERIAL,   "Remote Processor Serial"   },
+   { VIRTIO_ID_CAIF,   "CAIF"  },
+   { VIRTIO_ID_GPU,"GPU"   },
+   { VIRTIO_ID_INPUT,  "Input" },
+   { VIRTIO_ID_VSOCK,  "VSOCK Transport"   },
+   { VIRTIO_ID_CRYPTO, "Crypto"},
 
{ 0, NULL }
 };

Modified: head/sys/dev/virtio/virtio_ids.h
==
--- head/sys/dev/virtio/virtio_ids.hSun Jan 14 05:10:02 2018
(r327957)
+++ head/sys/dev/virtio/virtio_ids.hSun Jan 14 06:03:40 2018
(r327958)
@@ -32,13 +32,20 @@
 #define _VIRTIO_IDS_H_
 
 /* VirtIO device IDs. */
-#define VIRTIO_ID_NETWORK  0x01
-#define VIRTIO_ID_BLOCK0x02
-#define VIRTIO_ID_CONSOLE  0x03
-#define VIRTIO_ID_ENTROPY  0x04
-#define VIRTIO_ID_BALLOON  0x05
-#define VIRTIO_ID_IOMEMORY 0x06
-#define VIRTIO_ID_SCSI 0x08
-#define VIRTIO_ID_9P   0x09
+#define VIRTIO_ID_NETWORK  1
+#define VIRTIO_ID_BLOCK2
+#define VIRTIO_ID_CONSOLE  3
+#define VIRTIO_ID_ENTROPY  4
+#define VIRTIO_ID_BALLOON  5
+#define VIRTIO_ID_IOMEMORY 6
+#define VIRTIO_ID_RPMSG7
+#define VIRTIO_ID_SCSI 8
+#define VIRTIO_ID_9P   9
+#define VIRTIO_ID_RPROC_SERIAL 11
+#define VIRTIO_ID_CAIF 12
+#define VIRTIO_ID_GPU  16
+#define VIRTIO_ID_INPUT18
+#define VIRTIO_ID_VSOCK19
+#define VIRTIO_ID_CRYPTO   20
 
 #endif /* _VIRTIO_IDS_H_ */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r327876 - in head/sys/arm64: arm64 include

2018-01-13 Thread Michal Meloun


On 14.01.2018 0:54, Marcin Wojtas wrote:

Hi Michal,

2018-01-12 18:15 GMT+01:00 Michal Meloun :



On 12.01.2018 15:54, Warner Losh wrote:




On Fri, Jan 12, 2018 at 7:52 AM, Andrew Turner > wrote:




 On 12 Jan 2018, at 14:37, Warner Losh > wrote:



 On Fri, Jan 12, 2018 at 7:15 AM, Andrew Turner > wrote:




 On 12 Jan 2018, at 14:10, Marcin Wojtas > wrote:

 Hi Andrew,



 2018-01-12 15:01 GMT+01:00 Andrew Turner >:


 Author: andrew
 Date: Fri Jan 12 14:01:38 2018
 New Revision: 327876
 URL: https://svnweb.freebsd.org/changeset/base/327876
 

 Log:
  Workaround Spectre Variant 2 on arm64.

  We need to handle two cases:

  1. One process attacking another process.
  2. A process attacking the kernel.

  For the first case we clear the branch predictor state on
 context switch
  between different processes. For the second we do this when
 taking an
  instruction abort on a non-userspace address.

  To clear the branch predictor state a per-CPU function
 pointer has been
  added. This is set by the new cpu errata code based on if
 the CPU is
  known to be affected.

  On Cortex-A57, A72, A73, and A75 we call into the PSCI
 firmware as newer
  versions of this will clear the branch predictor state for us.

  It has been reported the ThunderX is unaffected, however
 the ThunderX2 is
  vulnerable. The Qualcomm Falkor core is also affected. As
 FreeBSD doesn't
  yet run on the ThunderX2 or Falkor no workaround is
 included for these CPUs.



 Regardless ThunderX2 / Falkor work-arounds, do I understand
 correctly
 that pure CA72 machines, such as Marvell Armada 7k/8k are
 immune to
 Variant 2 now?



 It is my understanding that the A72 will be immune with this
 patch and an updated Arm Trusted Firmware as documented in [1].

 Andrew

 [1]

https://github.com/ARM-software/arm-trusted-firmware/wiki/ARM-Trusted-Firmware-Security-Advisory-TFV-6




 Are you also working on aarch32 mitigation?



 No. I think a similar technique could be used, however as aarch32
 has instructions to invalidate the branch predictor these can be
 used directly.


That's my reading as well. It looks fairly easy to do it always, but I've
not researched it sufficiently.



I work on patches for armv6/7. But for aarch32, there is, unfortunately,
much less information available about affective mitigation of variant 2.
BPIALL while switching pmap is clear and we have it in code for years
(well, BPIALL is effectively NOP for A15/A17, it must be explicitly
enabled).
But is not clear for me for which trap is branch predictor flush necessary.



As for armv7, I believe the brand new patches on top of this branch
could be helpful:
https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git/log/?h=kpti



Yep, I tracking this thread from start(and I have prepared similar 
mitigation).

My biggest problem with above patchset is that I'm unable to understand
why is branch predictor mitigation applied *only* for instruction
prefetch translation/permission *page* faults but not for *section*
and/or for *access* faults.
Moreover, please, take a look to Russel's response to this:
https://www.spinics.net/lists/arm-kernel/msg628022.html

Also, situation about Cortex-A15 is extremely unclear -
this pachset and TFV6 advises:

"Note that the BPIALL instruction is not effective in invalidating the
branch predictor on Cortex-A15. For that CPU, set ACTLR[0] to 1 during
early processor initialisation, and invalidate the branch predictor by 
performing an ICIALLU instruction."


But description in Cortex-A15 TRM for ID_MMFR1 branch predictor field 
contains:


[31:28] Branch predictor Indicates branch predictor management requirements.
0x2 Branch predictor requires flushing on:
- Enabling or disabling the MMU.
- Writing new data to instruction locations.
- Writing new mappings to the translation tables.
- Any change to the TTBR0, TTBR1, or TTBCR registers without a
corresponding change to the FCSE ProcessID or ContextID.

So, where is truth?
Michal
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r327950 - in head/sys/powerpc: aim include powerpc ps3

2018-01-13 Thread Nathan Whitehorn



On 01/13/18 15:28, Nathan Whitehorn wrote:



On 01/13/18 15:24, Konstantin Belousov wrote:

On Sat, Jan 13, 2018 at 11:14:53PM +, Nathan Whitehorn wrote:

+/*
+ * We (usually) have a direct map of all physical memory. All
+ * uses of this macro must be gated by a check on hw_direct_map!
+ * The location of the direct map may not be 1:1 in future, so use
+ * of the macro is recommended; it may also grow an assert that 
hw_direct_map

+ * is set.
+ */
+#define PHYS_TO_DMAP(x) x
+#define DMAP_TO_PHYS(x) x

Take a look at the sys/vm/vm_page.c:vm_page_free_prep() function.



I think the checks in there should work as designed, unless I'm 
missing something. Am I?

-Nathan



Actually, wait, this is broken if hw_direct_map is not set. I can do an 
#ifdef __powerpc__ hack, but do you have opinions for a better MI flag 
for "yes, the macro is defined but, no, the direct map may not be 
available"?

-Nathan
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r327767 - in head/sys: conf i386/bios i386/conf i386/isa

2018-01-13 Thread Warner Losh
[trimmed, sorry ]

On Sat, Jan 13, 2018 at 4:56 AM, Bruce Evans  wrote:

> On Wed, 10 Jan 2018, Warner Losh wrote:
>
> Log:
>>  Retire pmtimer driver. Move time fixing into apm driver. Move
>>  Iwasaki-san's copyright over. Remove FIXME code that couldn't possibly
>>  work. Call tc_settime() with our estimate of the delta we've been
>>  alseep (the one we print) to adjust the time. Not sure what to do
>>  about callouts, so keep the small #ifdef in place there.
>>
>
> The FIXME code might have worked before timecounters, but never worked in
> any committed version.  You seem to have updated it correctly for
> timecounters in this commit, but then broke it by removing it in a later
> commit (see another reply).
>
> This commit obfuscates the fix by combining moving of the file with
> changing
> it.  svn is also very broken -- it doesn't show history of the file under
> its old name.  This is more broken than usual -- since the file was merged
> into a different file, svn doesn't show history of the file under its new
> name either.
>
> The callout fixup code is more broken.  It never compiled in any committed
> version, since it uses data structures and logic that went away before it
> was committed.  The option for it (APM_FIXUP_CALLTODO) is so broken that it
> is not a supported option or in LINT, so it is not normally noticed that
> the code under it never compiled.
>
> Long callouts are especially broken.  E.g., nanosleep(1 hour) at least
> used to sleep for 2 hours if the system is suspended for 1 hour during
> the sleep.  I haven't noticed any fixes for this.  Callouts mostly use
> relative timeouts, and relative timeouts just don't work across
> suspensions.
>
> Actually, I have noticed some fixes for nanosleep().  Another bug in it
> was that it is specified to sleep in the time specified by the clock id
> CLOCK_REALTIME, but used to sleep in the time specified by the clock id
> CLOCK_MONOTONIC (the latter should be as close as possible to the former
> except for leap seconds adjustments, but is quite broken -- it doesn't
> count suspended time, and non-leap seconds settings of CLOCK_REALTIME
> also make CLOCK_MONOTONIC useless for determining physical time
> differences.
> nanosleep() now sleeps on the correct clock id, and clock_nanosleep() is
> now implemented.  This is complicated, and I haven't checked if the fix
> works.  It looks to simple to work.  To work, it needs to do things like
> adjust timers whenever the timecounter jumps (mainly for resume and leap
> seconds adjustments).  APM_FIXUP_CALLTODO only tries to handle the easier
> case of resume.


Right, none of that is fixed.

Modified: head/sys/conf/files.i386
>> 
>> ==
>> --- head/sys/conf/files.i386Wed Jan 10 14:58:58 2018(r327766)
>> +++ head/sys/conf/files.i386Wed Jan 10 14:59:19 2018(r327767)
>> @@ -520,7 +520,6 @@ i386/ibcs2/ibcs2_util.c optional ibcs2
>> i386/ibcs2/ibcs2_xenix.coptional ibcs2
>> i386/ibcs2/ibcs2_xenix_sysent.c optional ibcs2
>> i386/ibcs2/imgact_coff.coptional ibcs2
>> -i386/isa/pmtimer.c optional pmtimer
>> i386/isa/prof_machdep.c optional profiling-routine
>> i386/linux/imgact_linux.c   optional compat_linux
>> i386/linux/linux_dummy.coptional compat_linux
>>
>
> pmtimer used to be needed all systems with acpi except amd64, because the
> acpi fixup of timecounters was bogusly ifdefed for amd64 only (or was not
> done by acpi in very old versions?).
>
> The pmtimer code for this fixup is still better tha the acpi code, except
> the FIXME made it unused and the next commit dumbs it down to worse than
> the acpi code (the acpi code is at least simpler).
>




> Modified: head/sys/i386/bios/apm.c
>> 
>> ==
>> --- head/sys/i386/bios/apm.cWed Jan 10 14:58:58 2018(r327766)
>> +++ head/sys/i386/bios/apm.cWed Jan 10 14:59:19 2018(r327767)
>> Modified: head/sys/i386/bios/apm.c
>> 
>> ==
>> --- head/sys/i386/bios/apm.cWed Jan 10 14:58:58 2018(r327766)
>> +++ head/sys/i386/bios/apm.cWed Jan 10 14:59:19 2018(r327767)
>> @@ -205,7 +232,7 @@ static int
>> apm_driver_version(int version)
>> {
>> struct apm_softc *sc = _softc;
>> -
>> +
>> sc->bios.r.eax = (APM_BIOS << 8) | APM_DRVVERSION;
>> sc->bios.r.ebx  = 0x0;
>> sc->bios.r.ecx  = version;
>>
>
> Unrelated style fixes make the important changes harder to see.  This
> patch was to remove trailing whitespace, but some mail program broke it
> by removing the whitespace in the source lines.
>
> [... further mangled patches for whitespace not shown]


Yea, I thought about doing two commits, but they got mixed up...


>
> @@ -331,12 +358,10 @@ apm_battery_low(void)
>> 

Re: svn commit: r327774 - in head: . sys/i386/bios

2018-01-13 Thread Warner Losh
On Sat, Jan 13, 2018 at 6:17 AM, Bruce Evans  wrote:

> On Wed, 10 Jan 2018, Warner Losh wrote:
>
> Log:
>>  inittodr(0) actually sets the time, so there's no need to call
>>  tc_setclock(). It's redundant. Tweak UPDATING based on code review of
>>  past releases.
>>
>
> No, tc_setclock() is not redundant (except for bugs).  initodr(0) sets
> a raw RTC time (plus a racy timezone offset).  tc_setclock() is supposed to
> fix this up to a less raw time using calculations done at suspend time.
> The calculations are still done, so are even more bogus then when the
> fixup was null under FIXME (then the FIXME a least indicated what
> needed to be done).
>
> Modified: head/UPDATING
>> 
>> ==
>> --- head/UPDATING   Wed Jan 10 16:56:02 2018(r327773)
>> +++ head/UPDATING   Wed Jan 10 17:25:08 2018(r327774)
>> @@ -53,8 +53,9 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW:
>>
>> 20180110:
>> On i386, pmtimer has been removed. It's functionality has been
>> folded
>> -   into apm. It was a nop on ACPI. Users may need to remove it from
>> kernel
>> -   config files.
>> +   into apm. It was a nop on ACPI in current for a while now (but
>> was still
>> +   needed on i386 in FreeBSD 11 and earlier). Users may need to
>> remove it
>> +   from kernel config files.
>>
>
> It is indeed still needed in FreeBSD-11.  acpci resume is still broken
> there
> on all arches except amd64, by bogusly ifdefing acpi_resync_clock() to do
> nothing except on amd64 (and even on amd64, there is a sysctl to give the
> same brokenness).
>
> pmtimer was made a no-op if acpi is configured in the same commit that
> fixed
> acpi resume.
>
> Modified: head/sys/i386/bios/apm.c
>> 
>> ==
>> --- head/sys/i386/bios/apm.cWed Jan 10 16:56:02 2018(r327773)
>> +++ head/sys/i386/bios/apm.cWed Jan 10 17:25:08 2018(r327774)
>> @@ -1086,7 +1086,6 @@ apm_rtc_resume(void *arg __unused)
>> {
>> u_int second, minute, hour;
>> struct timeval resume_time, tmp_time;
>> -   struct timespec ts;
>>
>> /* modified for adjkerntz */
>> timer_restore();/* restore the all timers */
>> @@ -1097,14 +1096,11 @@ apm_rtc_resume(void *arg __unused)
>> /* Calculate the delta time suspended */
>> timevalsub(_time, _time);
>>
>> -   second = ts.tv_sec = resume_time.tv_sec;
>> -   ts.tv_nsec = 0;
>> -   tc_setclock();
>> -
>>
>
> The carefully calculated tmp_time is no longer used.  It wasn't used before
> either, since ts was initialized to a wrong value.  tmp_time was last used
> under FIXME, but that shouldn't have compiled either since FIXME was
> undefineable -- tmp_time as a write-only auto variable in all cases.
> The non-use of some of the other timestamp variables is harder to detect
> since they are static.
>
> tc_setclock() takes a delta-time as an arg.  resume_time is already a
> delta-time, but I think it is complete garbage.  resume_time was initially
> actually the resume time, but is abused to hole the suspension interval
> (delta-time).  inittodr(0) already advanced the timecounter by
> approximately
> the suspension interval, and inittodr() gives a garbage time by
> advancing
> by this again.
>
> I think the correct second advance is simply diff_time which was calculated
> earlier.  The dead tmp_time is  + diff_time.  This was
> only used in the unreachable FIXME code because the "API" for that needed
> an
> absolute time.
>
> Untested fixes:
>
> X Index: apm.c
> X ===
> X --- apm.c (revision 327911)
> X +++ apm.c (working copy)
> X @@ -1067,17 +1067,17 @@
> X   } while (apm_event != PMEV_NOEVENT);
> X  }
> X X -static struct timeval suspend_time;
> X -static struct timeval diff_time;
> X +static struct timespec diff_time;
> X +static struct timespec suspend_time;
> X X  static int
> X  apm_rtc_suspend(void *arg __unused)
> X  {
> X X -   microtime(_time);
> X - inittodr(0);
> X - microtime(_time);
> X - timevalsub(_time, _time);
> X + nanotime(_time);   /* not a difference yet */
> X + inittodr(0);/* set tc to raw time seen by RTC
> */
> X + nanotime(_time);/* record this raw time */
> X + timespecsub(_time, _time); /* diff between tc and RTC
> */
> X   return (0);
> X  }
> X X @@ -1084,23 +1084,22 @@
> X  static int
> X  apm_rtc_resume(void *arg __unused)
> X  {
> X + struct timespec resume_time, suspend_interval;
> X   u_int second, minute, hour;
>
> This already changes too much, so I didn't fix blind truncation of tv_sec
> starting in 2038 or other type botches for second/minute/hour.
>

I suspect this code will no longer be running in 2028, let alone 2038.


> X - struct 

svn commit: r327954 - in head/sys: amd64/conf conf dev/acpica vm x86/acpica

2018-01-13 Thread Jeff Roberson
Author: jeff
Date: Sun Jan 14 03:36:03 2018
New Revision: 327954
URL: https://svnweb.freebsd.org/changeset/base/327954

Log:
  Move VM_NUMA_ALLOC and DEVICE_NUMA under the single global config option NUMA.
  
  Sponsored by: Netflix, Dell/EMC Isilon
  Discussed with:   jhb

Modified:
  head/sys/amd64/conf/GENERIC
  head/sys/amd64/conf/MINIMAL
  head/sys/conf/NOTES
  head/sys/conf/options
  head/sys/dev/acpica/acpi.c
  head/sys/vm/uma_core.c
  head/sys/vm/vm_domainset.c
  head/sys/vm/vm_pageout.c
  head/sys/vm/vm_phys.c
  head/sys/vm/vm_phys.h
  head/sys/x86/acpica/srat.c

Modified: head/sys/amd64/conf/GENERIC
==
--- head/sys/amd64/conf/GENERIC Sun Jan 14 00:31:34 2018(r327953)
+++ head/sys/amd64/conf/GENERIC Sun Jan 14 03:36:03 2018(r327954)
@@ -99,7 +99,6 @@ options   MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) 
 
 # Make an SMP-capable kernel by default
 optionsSMP # Symmetric MultiProcessor Kernel
-optionsDEVICE_NUMA # I/O Device Affinity
 optionsEARLY_AP_STARTUP
 
 # CPU frequency control

Modified: head/sys/amd64/conf/MINIMAL
==
--- head/sys/amd64/conf/MINIMAL Sun Jan 14 00:31:34 2018(r327953)
+++ head/sys/amd64/conf/MINIMAL Sun Jan 14 03:36:03 2018(r327954)
@@ -93,7 +93,6 @@ options   MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) 
 
 # Make an SMP-capable kernel by default
 optionsSMP # Symmetric MultiProcessor Kernel
-optionsDEVICE_NUMA # I/O Device Affinity
 optionsEARLY_AP_STARTUP
 
 # CPU frequency control

Modified: head/sys/conf/NOTES
==
--- head/sys/conf/NOTES Sun Jan 14 00:31:34 2018(r327953)
+++ head/sys/conf/NOTES Sun Jan 14 03:36:03 2018(r327954)
@@ -231,17 +231,13 @@ options   EARLY_AP_STARTUP
 # A default value should be already present, for every architecture.
 optionsMAXCPU=32
 
+# NUMA enables use of Non-Uniform Memory Access policies in various kernel
+# subsystems.
+optionsNUMA
+
 # MAXMEMDOM defines the maximum number of memory domains that can boot in the
 # system.  A default value should already be defined by every architecture.
 optionsMAXMEMDOM=2
-
-# VM_NUMA_ALLOC enables use of memory domain-aware allocation in the VM
-# system.
-optionsVM_NUMA_ALLOC
-
-# DEVICE_NUMA enables reporting of domain affinity of I/O devices via
-# bus_get_domain(), etc.
-optionsDEVICE_NUMA
 
 # ADAPTIVE_MUTEXES changes the behavior of blocking mutexes to spin
 # if the thread that currently owns the mutex is executing on another

Modified: head/sys/conf/options
==
--- head/sys/conf/options   Sun Jan 14 00:31:34 2018(r327953)
+++ head/sys/conf/options   Sun Jan 14 03:36:03 2018(r327954)
@@ -95,7 +95,6 @@ COMPAT_LINUXKPI   opt_compat.h
 COMPILING_LINT opt_global.h
 CY_PCI_FASTINTR
 DEADLKRES  opt_watchdog.h
-DEVICE_NUMA
 EXT_RESOURCES  opt_global.h
 DIRECTIO
 FILEMONopt_dontuse.h
@@ -605,7 +604,6 @@ VM_KMEM_SIZEopt_vm.h
 VM_KMEM_SIZE_SCALE opt_vm.h
 VM_KMEM_SIZE_MAX   opt_vm.h
 VM_NRESERVLEVELopt_vm.h
-VM_NUMA_ALLOC  opt_vm.h
 VM_LEVEL_0_ORDER   opt_vm.h
 NO_SWAPPINGopt_vm.h
 MALLOC_MAKE_FAILURES   opt_vm.h
@@ -621,6 +619,7 @@ DEBUG_REDZONE   opt_vm.h
 # Standard SMP options
 EARLY_AP_STARTUP   opt_global.h
 SMPopt_global.h
+NUMA   opt_global.h
 
 # Size of the kernel message buffer
 MSGBUF_SIZEopt_msgbuf.h

Modified: head/sys/dev/acpica/acpi.c
==
--- head/sys/dev/acpica/acpi.c  Sun Jan 14 00:31:34 2018(r327953)
+++ head/sys/dev/acpica/acpi.c  Sun Jan 14 03:36:03 2018(r327954)
@@ -31,7 +31,6 @@
 __FBSDID("$FreeBSD$");
 
 #include "opt_acpi.h"
-#include "opt_device_numa.h"
 
 #include 
 #include 
@@ -1089,7 +1088,7 @@ acpi_hint_device_unit(device_t acdev, device_t child, 
 static int
 acpi_parse_pxm(device_t dev)
 {
-#ifdef DEVICE_NUMA
+#ifdef NUMA
ACPI_HANDLE handle;
ACPI_STATUS status;
int pxm;

Modified: head/sys/vm/uma_core.c
==
--- head/sys/vm/uma_core.c  Sun Jan 14 00:31:34 2018(r327953)
+++ head/sys/vm/uma_core.c  Sun Jan 14 03:36:03 2018(r327954)
@@ -2616,7 +2616,7 @@ zone_import(uma_zone_t zone, void **bucket, int max, i
bucket[i++] = slab_alloc_item(keg, slab);
if (keg->uk_free <= keg->uk_reserve)
break;
-#if 

Re: svn commit: r327949 - in head/sys/dev: aacraid advansys ath beri/virtio bnxt bwn ciss cxgbe/crypto esp fb gpio if_ndis iwi kbd liquidio liquidio/base mpr mps mpt mrsas mxge netmap nvme pst ral rp

2018-01-13 Thread Pedro Giffuni



On 01/13/18 19:17, Cy Schubert wrote:

In message <201801132230.w0dmuvmf081...@repo.freebsd.org>, "Pedro F.
Giffuni" w
rites:

Author: pfg
Date: Sat Jan 13 22:30:30 2018
New Revision: 327949
URL: https://svnweb.freebsd.org/changeset/base/327949

Log:
   dev: make some use of mallocarray(9).
   
   Focus on code where we are doing multiplications within malloc(9). None of

   these is likely to overflow, however the change is still useful as some
   static checkers can benefit from the allocation attributes we use for
   mallocarray.
   
   This initial sweep only covers malloc(9) calls with M_NOWAIT. No good

   reason but I started doing the changes before r327796 and at that time it
   was convenient to make sure the sorrounding code could handle NULL values.

Modified:
   head/sys/dev/aacraid/aacraid.c
   head/sys/dev/advansys/advansys.c
   head/sys/dev/ath/if_ath_rx_edma.c
   head/sys/dev/beri/virtio/virtio.c
   head/sys/dev/bnxt/if_bnxt.c
   head/sys/dev/bwn/if_bwn.c
   head/sys/dev/bwn/if_bwn_phy_lp.c
   head/sys/dev/ciss/ciss.c
   head/sys/dev/cxgbe/crypto/t4_crypto.c
   head/sys/dev/esp/ncr53c9x.c
   head/sys/dev/fb/splash.c
   head/sys/dev/gpio/gpiobus.c
   head/sys/dev/if_ndis/if_ndis.c
   head/sys/dev/iwi/if_iwi.c
   head/sys/dev/kbd/kbd.c
   head/sys/dev/liquidio/base/lio_request_manager.c
   head/sys/dev/liquidio/lio_main.c
   head/sys/dev/mpr/mpr.c
   head/sys/dev/mpr/mpr_mapping.c
   head/sys/dev/mps/mps.c
   head/sys/dev/mps/mps_mapping.c
   head/sys/dev/mpt/mpt_cam.c
   head/sys/dev/mrsas/mrsas.c
   head/sys/dev/mxge/if_mxge.c
   head/sys/dev/netmap/if_ptnet.c
   head/sys/dev/nvme/nvme_ns.c
   head/sys/dev/pst/pst-iop.c
   head/sys/dev/ral/rt2560.c
   head/sys/dev/ral/rt2661.c
   head/sys/dev/rp/rp.c
   head/sys/dev/rp/rp_isa.c
   head/sys/dev/rp/rp_pci.c
   head/sys/dev/sound/midi/midi.c
   head/sys/dev/sound/pci/hda/hdaa.c
   head/sys/dev/syscons/fire/fire_saver.c
   head/sys/dev/virtio/console/virtio_console.c
   head/sys/dev/virtio/mmio/virtio_mmio.c
   head/sys/dev/virtio/network/if_vtnet.c
   head/sys/dev/virtio/pci/virtio_pci.c
   head/sys/dev/vmware/vmxnet3/if_vmx.c
   head/sys/dev/vnic/nicvf_queues.c
   head/sys/dev/xen/blkback/blkback.c
   head/sys/dev/xen/blkfront/blkfront.c




Modified: head/sys/dev/mxge/if_mxge.c
=
=
--- head/sys/dev/mxge/if_mxge.c Sat Jan 13 21:39:46 2018(r32794
8)
+++ head/sys/dev/mxge/if_mxge.c Sat Jan 13 22:30:30 2018(r32794
9)
@@ -688,7 +688,7 @@ z_alloc(void *nil, u_int items, u_int size)
  {
void *ptr;
  
-	ptr = malloc(items * size, M_TEMP, M_NOWAIT);

+   ptr = mallocarray(items, size, M_TEMP, M_NOWAIT);
return ptr;
  }
  
@@ -4390,8 +4390,8 @@ mxge_alloc_slices(mxge_softc_t *sc)

sc->rx_ring_size = cmd.data0;
max_intr_slots = 2 * (sc->rx_ring_size / sizeof (mcp_dma_addr_t));

-   bytes = sizeof (*sc->ss) * sc->num_slices;

Hi Pedro,

This broke the build.


Very sorry ... should be fixed now (r327949).

Thanks!

Pedro.

___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r327953 - head/sys/dev/mxge

2018-01-13 Thread Pedro F. Giffuni
Author: pfg
Date: Sun Jan 14 00:31:34 2018
New Revision: 327953
URL: https://svnweb.freebsd.org/changeset/base/327953

Log:
  Fix build after r327949.
  
  Reported by:  Cy Schubert

Modified:
  head/sys/dev/mxge/if_mxge.c

Modified: head/sys/dev/mxge/if_mxge.c
==
--- head/sys/dev/mxge/if_mxge.c Sun Jan 14 00:08:34 2018(r327952)
+++ head/sys/dev/mxge/if_mxge.c Sun Jan 14 00:31:34 2018(r327953)
@@ -4535,7 +4535,6 @@ abort_with_fw:
 static int
 mxge_add_msix_irqs(mxge_softc_t *sc)
 {
-   size_t bytes;
int count, err, i, rid;
 
rid = PCIR_BAR(2);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r327949 - in head/sys/dev: aacraid advansys ath beri/virtio bnxt bwn ciss cxgbe/crypto esp fb gpio if_ndis iwi kbd liquidio liquidio/base mpr mps mpt mrsas mxge netmap nvme pst ral r

2018-01-13 Thread Cy Schubert
In message <201801132230.w0dmuvmf081...@repo.freebsd.org>, "Pedro F. 
Giffuni" w
rites:
> Author: pfg
> Date: Sat Jan 13 22:30:30 2018
> New Revision: 327949
> URL: https://svnweb.freebsd.org/changeset/base/327949
>
> Log:
>   dev: make some use of mallocarray(9).
>   
>   Focus on code where we are doing multiplications within malloc(9). None of
>   these is likely to overflow, however the change is still useful as some
>   static checkers can benefit from the allocation attributes we use for
>   mallocarray.
>   
>   This initial sweep only covers malloc(9) calls with M_NOWAIT. No good
>   reason but I started doing the changes before r327796 and at that time it
>   was convenient to make sure the sorrounding code could handle NULL values.
>
> Modified:
>   head/sys/dev/aacraid/aacraid.c
>   head/sys/dev/advansys/advansys.c
>   head/sys/dev/ath/if_ath_rx_edma.c
>   head/sys/dev/beri/virtio/virtio.c
>   head/sys/dev/bnxt/if_bnxt.c
>   head/sys/dev/bwn/if_bwn.c
>   head/sys/dev/bwn/if_bwn_phy_lp.c
>   head/sys/dev/ciss/ciss.c
>   head/sys/dev/cxgbe/crypto/t4_crypto.c
>   head/sys/dev/esp/ncr53c9x.c
>   head/sys/dev/fb/splash.c
>   head/sys/dev/gpio/gpiobus.c
>   head/sys/dev/if_ndis/if_ndis.c
>   head/sys/dev/iwi/if_iwi.c
>   head/sys/dev/kbd/kbd.c
>   head/sys/dev/liquidio/base/lio_request_manager.c
>   head/sys/dev/liquidio/lio_main.c
>   head/sys/dev/mpr/mpr.c
>   head/sys/dev/mpr/mpr_mapping.c
>   head/sys/dev/mps/mps.c
>   head/sys/dev/mps/mps_mapping.c
>   head/sys/dev/mpt/mpt_cam.c
>   head/sys/dev/mrsas/mrsas.c
>   head/sys/dev/mxge/if_mxge.c
>   head/sys/dev/netmap/if_ptnet.c
>   head/sys/dev/nvme/nvme_ns.c
>   head/sys/dev/pst/pst-iop.c
>   head/sys/dev/ral/rt2560.c
>   head/sys/dev/ral/rt2661.c
>   head/sys/dev/rp/rp.c
>   head/sys/dev/rp/rp_isa.c
>   head/sys/dev/rp/rp_pci.c
>   head/sys/dev/sound/midi/midi.c
>   head/sys/dev/sound/pci/hda/hdaa.c
>   head/sys/dev/syscons/fire/fire_saver.c
>   head/sys/dev/virtio/console/virtio_console.c
>   head/sys/dev/virtio/mmio/virtio_mmio.c
>   head/sys/dev/virtio/network/if_vtnet.c
>   head/sys/dev/virtio/pci/virtio_pci.c
>   head/sys/dev/vmware/vmxnet3/if_vmx.c
>   head/sys/dev/vnic/nicvf_queues.c
>   head/sys/dev/xen/blkback/blkback.c
>   head/sys/dev/xen/blkfront/blkfront.c
>


> Modified: head/sys/dev/mxge/if_mxge.c
> =
> =
> --- head/sys/dev/mxge/if_mxge.c   Sat Jan 13 21:39:46 2018(r32794
> 8)
> +++ head/sys/dev/mxge/if_mxge.c   Sat Jan 13 22:30:30 2018(r32794
> 9)
> @@ -688,7 +688,7 @@ z_alloc(void *nil, u_int items, u_int size)
>  {
>   void *ptr;
>  
> - ptr = malloc(items * size, M_TEMP, M_NOWAIT);
> + ptr = mallocarray(items, size, M_TEMP, M_NOWAIT);
>   return ptr;
>  }
>  
> @@ -4390,8 +4390,8 @@ mxge_alloc_slices(mxge_softc_t *sc)
>   sc->rx_ring_size = cmd.data0;
>   max_intr_slots = 2 * (sc->rx_ring_size / sizeof (mcp_dma_addr_t));
>   
> - bytes = sizeof (*sc->ss) * sc->num_slices;

Hi Pedro,

This broke the build.

> - sc->ss = malloc(bytes, M_DEVBUF, M_NOWAIT | M_ZERO);
> + sc->ss = mallocarray(sc->num_slices, sizeof(*sc->ss), M_DEVBUF,
> + M_NOWAIT | M_ZERO);
>   if (sc->ss == NULL)
>   return (ENOMEM);
>   for (i = 0; i < sc->num_slices; i++) {
> @@ -4563,8 +4563,8 @@ mxge_add_msix_irqs(mxge_softc_t *sc)
>   err = ENOSPC;
>   goto abort_with_msix;
>   }
> - bytes = sizeof (*sc->msix_irq_res) * sc->num_slices;
> - sc->msix_irq_res = malloc(bytes, M_DEVBUF, M_NOWAIT|M_ZERO);
> + sc->msix_irq_res = mallocarray(sc->num_slices,
> + sizeof(*sc->msix_irq_res), M_DEVBUF, M_NOWAIT|M_ZERO);
>   if (sc->msix_irq_res == NULL) {
>   err = ENOMEM;
>   goto abort_with_msix;
> @@ -4583,8 +4583,8 @@ mxge_add_msix_irqs(mxge_softc_t *sc)
>   }
>   }
>  
> - bytes = sizeof (*sc->msix_ih) * sc->num_slices;

===> mxge/mxge_rss_ethp_z8e (all)
--- all_subdir_mxge/mxge ---
/opt/src/svn-current/sys/dev/mxge/if_mxge.c:4538:9: error: unused variable 
'bytes' [-Werror,-Wunused-variable]
size_t bytes;
   ^
1 error generated.
*** [if_mxge.o] Error code 1

> - sc->msix_ih =  malloc(bytes, M_DEVBUF, M_NOWAIT|M_ZERO);
> + sc->msix_ih =  mallocarray(sc->num_slices, sizeof(*sc->msix_ih),
> + M_DEVBUF, M_NOWAIT|M_ZERO);
>  
>   for (i = 0; i < sc->num_slices; i++) {
>   err = bus_setup_intr(sc->dev, sc->msix_irq_res[i],
>



-- 
Cheers,
Cy Schubert 
FreeBSD UNIX:     Web:  http://www.FreeBSD.org

The need of the many outweighs the greed of the few.


___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r327876 - in head/sys/arm64: arm64 include

2018-01-13 Thread Marcin Wojtas
Hi Michal,

2018-01-12 18:15 GMT+01:00 Michal Meloun :
>
>
> On 12.01.2018 15:54, Warner Losh wrote:
>>
>>
>>
>> On Fri, Jan 12, 2018 at 7:52 AM, Andrew Turner > > wrote:
>>
>>
>>
>>> On 12 Jan 2018, at 14:37, Warner Losh >> > wrote:
>>>
>>>
>>>
>>> On Fri, Jan 12, 2018 at 7:15 AM, Andrew Turner >> > wrote:
>>>
>>>
>>>
 On 12 Jan 2018, at 14:10, Marcin Wojtas > wrote:

 Hi Andrew,



 2018-01-12 15:01 GMT+01:00 Andrew Turner >:

> Author: andrew
> Date: Fri Jan 12 14:01:38 2018
> New Revision: 327876
> URL: https://svnweb.freebsd.org/changeset/base/327876
> 
>
> Log:
>  Workaround Spectre Variant 2 on arm64.
>
>  We need to handle two cases:
>
>  1. One process attacking another process.
>  2. A process attacking the kernel.
>
>  For the first case we clear the branch predictor state on
> context switch
>  between different processes. For the second we do this when
> taking an
>  instruction abort on a non-userspace address.
>
>  To clear the branch predictor state a per-CPU function
> pointer has been
>  added. This is set by the new cpu errata code based on if
> the CPU is
>  known to be affected.
>
>  On Cortex-A57, A72, A73, and A75 we call into the PSCI
> firmware as newer
>  versions of this will clear the branch predictor state for us.
>
>  It has been reported the ThunderX is unaffected, however
> the ThunderX2 is
>  vulnerable. The Qualcomm Falkor core is also affected. As
> FreeBSD doesn't
>  yet run on the ThunderX2 or Falkor no workaround is
> included for these CPUs.


 Regardless ThunderX2 / Falkor work-arounds, do I understand
 correctly
 that pure CA72 machines, such as Marvell Armada 7k/8k are
 immune to
 Variant 2 now?
>>>
>>>
>>> It is my understanding that the A72 will be immune with this
>>> patch and an updated Arm Trusted Firmware as documented in [1].
>>>
>>> Andrew
>>>
>>> [1]
>>>
>>> https://github.com/ARM-software/arm-trusted-firmware/wiki/ARM-Trusted-Firmware-Security-Advisory-TFV-6
>>>
>>> 
>>>
>>>
>>> Are you also working on aarch32 mitigation?
>>
>>
>> No. I think a similar technique could be used, however as aarch32
>> has instructions to invalidate the branch predictor these can be
>> used directly.
>>
>>
>> That's my reading as well. It looks fairly easy to do it always, but I've
>> not researched it sufficiently.
>>
>
> I work on patches for armv6/7. But for aarch32, there is, unfortunately,
> much less information available about affective mitigation of variant 2.
> BPIALL while switching pmap is clear and we have it in code for years
> (well, BPIALL is effectively NOP for A15/A17, it must be explicitly
> enabled).
> But is not clear for me for which trap is branch predictor flush necessary.
>

As for armv7, I believe the brand new patches on top of this branch
could be helpful:
https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git/log/?h=kpti

Best regards,
Marcin
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r327951 - in head/sys/dev/usb: . serial

2018-01-13 Thread Nick Hibma
Author: n_hibma
Date: Sat Jan 13 23:31:21 2018
New Revision: 327951
URL: https://svnweb.freebsd.org/changeset/base/327951

Log:
  Add support for Quectel EC25.
  
  Submitted by: Samuel Crookes
  MFC after:3 days

Modified:
  head/sys/dev/usb/serial/u3g.c
  head/sys/dev/usb/usbdevs

Modified: head/sys/dev/usb/serial/u3g.c
==
--- head/sys/dev/usb/serial/u3g.c   Sat Jan 13 23:14:53 2018
(r327950)
+++ head/sys/dev/usb/serial/u3g.c   Sat Jan 13 23:31:21 2018
(r327951)
@@ -491,6 +491,7 @@ static const STRUCT_USB_HOST_ID u3g_devs[] = {
U3G_DEV(QUANTA, GLX, 0),
U3G_DEV(QUANTA, Q101, 0),
U3G_DEV(QUANTA, Q111, 0),
+   U3G_DEV(QUECTEL, EC25, 0),
U3G_DEV(SIERRA, AC402, 0),
U3G_DEV(SIERRA, AC595U, 0),
U3G_DEV(SIERRA, AC313U, 0),

Modified: head/sys/dev/usb/usbdevs
==
--- head/sys/dev/usb/usbdevsSat Jan 13 23:14:53 2018(r327950)
+++ head/sys/dev/usb/usbdevsSat Jan 13 23:31:21 2018(r327951)
@@ -751,6 +751,7 @@ vendor HIROSE   0x2631  Hirose Electric
 vendor NHJ 0x2770  NHJ
 vendor THINGM  0x27b8  ThingM
 vendor PLANEX  0x2c02  Planex Communications
+vendor QUECTEL 0x2c7c  Quectel Wireless Solutions
 vendor VIDZMEDIA   0x3275  VidzMedia Pte Ltd
 vendor LINKINSTRUMENTS 0x3195  Link Instruments Inc.
 vendor AEI 0x3334  AEI
@@ -3812,11 +3813,14 @@ product QUANTA GKE  0xea05  HSDPA modem
 product QUANTA GLE 0xea06  HSDPA modem
 product QUANTA RW6815R 0xf003  HP iPAQ rw6815 RNDIS
 
-/* Qtronix products */
-product QTRONIX 980N   0x2011  Scorpion-980N keyboard
+/* Quectel products */
+product QUECTEL EC25   0x0125  LTE modem
 
 /* Quickshot products */
 product QUICKSHOT STRIKEPAD0x6238  USB StrikePad
+
+/* Qtronix products */
+product QTRONIX 980N   0x2011  Scorpion-980N keyboard
 
 /* Radio Shack */
 product RADIOSHACK USBCABLE0x4026  USB to Serial Cable
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r327950 - in head/sys/powerpc: aim include powerpc ps3

2018-01-13 Thread Nathan Whitehorn



On 01/13/18 15:24, Konstantin Belousov wrote:

On Sat, Jan 13, 2018 at 11:14:53PM +, Nathan Whitehorn wrote:

+/*
+ * We (usually) have a direct map of all physical memory. All
+ * uses of this macro must be gated by a check on hw_direct_map!
+ * The location of the direct map may not be 1:1 in future, so use
+ * of the macro is recommended; it may also grow an assert that hw_direct_map
+ * is set.
+ */
+#define PHYS_TO_DMAP(x) x
+#define DMAP_TO_PHYS(x) x

Take a look at the sys/vm/vm_page.c:vm_page_free_prep() function.



I think the checks in there should work as designed, unless I'm missing 
something. Am I?

-Nathan
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r327950 - in head/sys/powerpc: aim include powerpc ps3

2018-01-13 Thread Konstantin Belousov
On Sat, Jan 13, 2018 at 11:14:53PM +, Nathan Whitehorn wrote:
> +/*
> + * We (usually) have a direct map of all physical memory. All
> + * uses of this macro must be gated by a check on hw_direct_map!
> + * The location of the direct map may not be 1:1 in future, so use
> + * of the macro is recommended; it may also grow an assert that hw_direct_map
> + * is set.
> + */
> +#define PHYS_TO_DMAP(x) x
> +#define DMAP_TO_PHYS(x) x

Take a look at the sys/vm/vm_page.c:vm_page_free_prep() function.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r327950 - in head/sys/powerpc: aim include powerpc ps3

2018-01-13 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Sat Jan 13 23:14:53 2018
New Revision: 327950
URL: https://svnweb.freebsd.org/changeset/base/327950

Log:
  Document places we assume that physical memory is direct-mapped at zero by
  using a new macro PHYS_TO_DMAP, which deliberately has the same name as the
  equivalent macro on amd64. This also sets the stage for moving the direct
  map to another base address.

Modified:
  head/sys/powerpc/aim/mmu_oea64.c
  head/sys/powerpc/aim/slb.c
  head/sys/powerpc/include/vmparam.h
  head/sys/powerpc/powerpc/uma_machdep.c
  head/sys/powerpc/ps3/platform_ps3.c

Modified: head/sys/powerpc/aim/mmu_oea64.c
==
--- head/sys/powerpc/aim/mmu_oea64.cSat Jan 13 22:30:30 2018
(r327949)
+++ head/sys/powerpc/aim/mmu_oea64.cSat Jan 13 23:14:53 2018
(r327950)
@@ -540,7 +540,8 @@ moea64_add_ofw_mappings(mmu_t mmup, phandle_t mmu, siz
DISABLE_TRANS(msr);
for (off = 0; off < translations[i].om_len; off += PAGE_SIZE) {
/* If this address is direct-mapped, skip remapping */
-   if (hw_direct_map && translations[i].om_va == pa_base &&
+   if (hw_direct_map &&
+   translations[i].om_va == PHYS_TO_DMAP(pa_base) &&
moea64_calc_wimg(pa_base + off, VM_MEMATTR_DEFAULT) 
== LPTE_M)
continue;
 
@@ -633,7 +634,7 @@ moea64_setup_direct_map(mmu_t mmup, vm_offset_t kernel
 
pvo = alloc_pvo_entry(1 /* bootstrap */);
pvo->pvo_vaddr |= PVO_WIRED | PVO_LARGE;
-   init_pvo_entry(pvo, kernel_pmap, pa);
+   init_pvo_entry(pvo, kernel_pmap, PHYS_TO_DMAP(pa));
 
/*
 * Set memory access as guarded if prefetch within
@@ -,7 +1112,8 @@ moea64_copy_page(mmu_t mmu, vm_page_t msrc, vm_page_t 
src = VM_PAGE_TO_PHYS(msrc);
 
if (hw_direct_map) {
-   bcopy((void *)src, (void *)dst, PAGE_SIZE);
+   bcopy((void *)PHYS_TO_DMAP(src), (void *)PHYS_TO_DMAP(dst),
+   PAGE_SIZE);
} else {
mtx_lock(_scratchpage_mtx);
 
@@ -1136,11 +1138,13 @@ moea64_copy_pages_dmap(mmu_t mmu, vm_page_t *ma, vm_of
while (xfersize > 0) {
a_pg_offset = a_offset & PAGE_MASK;
cnt = min(xfersize, PAGE_SIZE - a_pg_offset);
-   a_cp = (char *)VM_PAGE_TO_PHYS(ma[a_offset >> PAGE_SHIFT]) +
+   a_cp = (char *)PHYS_TO_DMAP(
+   VM_PAGE_TO_PHYS(ma[a_offset >> PAGE_SHIFT])) +
a_pg_offset;
b_pg_offset = b_offset & PAGE_MASK;
cnt = min(cnt, PAGE_SIZE - b_pg_offset);
-   b_cp = (char *)VM_PAGE_TO_PHYS(mb[b_offset >> PAGE_SHIFT]) +
+   b_cp = (char *)PHYS_TO_DMAP(
+   VM_PAGE_TO_PHYS(mb[b_offset >> PAGE_SHIFT])) +
b_pg_offset;
bcopy(a_cp, b_cp, cnt);
a_offset += cnt;
@@ -1200,7 +1204,7 @@ moea64_zero_page_area(mmu_t mmu, vm_page_t m, int off,
panic("moea64_zero_page: size + off > PAGE_SIZE");
 
if (hw_direct_map) {
-   bzero((caddr_t)pa + off, size);
+   bzero((caddr_t)PHYS_TO_DMAP(pa) + off, size);
} else {
mtx_lock(_scratchpage_mtx);
moea64_set_scratchpage_pa(mmu, 0, pa);
@@ -1224,7 +1228,7 @@ moea64_zero_page(mmu_t mmu, vm_page_t m)
moea64_set_scratchpage_pa(mmu, 0, pa);
va = moea64_scratchpage_va[0];
} else {
-   va = pa;
+   va = PHYS_TO_DMAP(pa);
}
 
for (off = 0; off < PAGE_SIZE; off += cacheline_size)
@@ -1241,7 +1245,7 @@ moea64_quick_enter_page(mmu_t mmu, vm_page_t m)
vm_paddr_t pa = VM_PAGE_TO_PHYS(m);
 
if (hw_direct_map)
-   return (pa);
+   return (PHYS_TO_DMAP(pa));
 
/*
 * MOEA64_PTE_REPLACE does some locking, so we can't just grab
@@ -1402,7 +1406,7 @@ moea64_syncicache(mmu_t mmu, pmap_t pmap, vm_offset_t 
} else if (pmap == kernel_pmap) {
__syncicache((void *)va, sz);
} else if (hw_direct_map) {
-   __syncicache((void *)pa, sz);
+   __syncicache((void *)PHYS_TO_DMAP(pa), sz);
} else {
/* Use the scratch page to set up a temp mapping */
 
@@ -1565,7 +1569,7 @@ moea64_init(mmu_t mmu)
 
if (!hw_direct_map) {
installed_mmu = mmu;
-   uma_zone_set_allocf(moea64_pvo_zone,moea64_uma_page_alloc);
+   uma_zone_set_allocf(moea64_pvo_zone, moea64_uma_page_alloc);
}
 
 #ifdef COMPAT_FREEBSD32
@@ -1855,7 +1859,7 @@ moea64_map(mmu_t mmu, vm_offset_t *virt, vm_paddr_t pa
 

Re: svn commit: r327949 - in head/sys/dev: aacraid advansys ath beri/virtio bnxt bwn ciss cxgbe/crypto esp fb gpio if_ndis iwi kbd liquidio liquidio/base mpr mps mpt mrsas mxge netmap nvme pst ral rp

2018-01-13 Thread Pedro Giffuni



On 01/13/18 17:30, Pedro F. Giffuni wrote:

Author: pfg
Date: Sat Jan 13 22:30:30 2018
New Revision: 327949
URL: https://svnweb.freebsd.org/changeset/base/327949

Log:
   dev: make some use of mallocarray(9).
   
   Focus on code where we are doing multiplications within malloc(9). None of

   these is likely to overflow, however the change is still useful as some
   static checkers can benefit from the allocation attributes we use for
   mallocarray.
   
   This initial sweep only covers malloc(9) calls with M_NOWAIT. No good

   reason but I started doing the changes before r327796 and at that time it
   was convenient to make sure the sorrounding code could handle NULL values.


For the record, this was part of

https://reviews.freebsd.org/D13837

I didn't mention it in the commit log because I am not ready to close 
the revision yet.


Pedro.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r327949 - in head/sys/dev: aacraid advansys ath beri/virtio bnxt bwn ciss cxgbe/crypto esp fb gpio if_ndis iwi kbd liquidio liquidio/base mpr mps mpt mrsas mxge netmap nvme pst ral rp s...

2018-01-13 Thread Pedro F. Giffuni
Author: pfg
Date: Sat Jan 13 22:30:30 2018
New Revision: 327949
URL: https://svnweb.freebsd.org/changeset/base/327949

Log:
  dev: make some use of mallocarray(9).
  
  Focus on code where we are doing multiplications within malloc(9). None of
  these is likely to overflow, however the change is still useful as some
  static checkers can benefit from the allocation attributes we use for
  mallocarray.
  
  This initial sweep only covers malloc(9) calls with M_NOWAIT. No good
  reason but I started doing the changes before r327796 and at that time it
  was convenient to make sure the sorrounding code could handle NULL values.

Modified:
  head/sys/dev/aacraid/aacraid.c
  head/sys/dev/advansys/advansys.c
  head/sys/dev/ath/if_ath_rx_edma.c
  head/sys/dev/beri/virtio/virtio.c
  head/sys/dev/bnxt/if_bnxt.c
  head/sys/dev/bwn/if_bwn.c
  head/sys/dev/bwn/if_bwn_phy_lp.c
  head/sys/dev/ciss/ciss.c
  head/sys/dev/cxgbe/crypto/t4_crypto.c
  head/sys/dev/esp/ncr53c9x.c
  head/sys/dev/fb/splash.c
  head/sys/dev/gpio/gpiobus.c
  head/sys/dev/if_ndis/if_ndis.c
  head/sys/dev/iwi/if_iwi.c
  head/sys/dev/kbd/kbd.c
  head/sys/dev/liquidio/base/lio_request_manager.c
  head/sys/dev/liquidio/lio_main.c
  head/sys/dev/mpr/mpr.c
  head/sys/dev/mpr/mpr_mapping.c
  head/sys/dev/mps/mps.c
  head/sys/dev/mps/mps_mapping.c
  head/sys/dev/mpt/mpt_cam.c
  head/sys/dev/mrsas/mrsas.c
  head/sys/dev/mxge/if_mxge.c
  head/sys/dev/netmap/if_ptnet.c
  head/sys/dev/nvme/nvme_ns.c
  head/sys/dev/pst/pst-iop.c
  head/sys/dev/ral/rt2560.c
  head/sys/dev/ral/rt2661.c
  head/sys/dev/rp/rp.c
  head/sys/dev/rp/rp_isa.c
  head/sys/dev/rp/rp_pci.c
  head/sys/dev/sound/midi/midi.c
  head/sys/dev/sound/pci/hda/hdaa.c
  head/sys/dev/syscons/fire/fire_saver.c
  head/sys/dev/virtio/console/virtio_console.c
  head/sys/dev/virtio/mmio/virtio_mmio.c
  head/sys/dev/virtio/network/if_vtnet.c
  head/sys/dev/virtio/pci/virtio_pci.c
  head/sys/dev/vmware/vmxnet3/if_vmx.c
  head/sys/dev/vnic/nicvf_queues.c
  head/sys/dev/xen/blkback/blkback.c
  head/sys/dev/xen/blkfront/blkfront.c

Modified: head/sys/dev/aacraid/aacraid.c
==
--- head/sys/dev/aacraid/aacraid.c  Sat Jan 13 21:39:46 2018
(r327948)
+++ head/sys/dev/aacraid/aacraid.c  Sat Jan 13 22:30:30 2018
(r327949)
@@ -1458,7 +1458,7 @@ aac_convert_sgraw2(struct aac_softc *sc, struct aac_ra
int i, j, pos;
u_int32_t addr_low;
 
-   sge = malloc(nseg_new * sizeof(struct aac_sge_ieee1212), 
+   sge = mallocarray(nseg_new, sizeof(struct aac_sge_ieee1212), 
M_AACRAIDBUF, M_NOWAIT|M_ZERO);
if (sge == NULL)
return nseg;

Modified: head/sys/dev/advansys/advansys.c
==
--- head/sys/dev/advansys/advansys.cSat Jan 13 21:39:46 2018
(r327948)
+++ head/sys/dev/advansys/advansys.cSat Jan 13 22:30:30 2018
(r327949)
@@ -1255,7 +1255,7 @@ adv_attach(adv)
 * a transaction and use it for mapping the queue to the
 * upper level SCSI transaction it represents.
 */
-   adv->ccb_infos = malloc(sizeof(*adv->ccb_infos) * adv->max_openings,
+   adv->ccb_infos = mallocarray(adv->max_openings, sizeof(*adv->ccb_infos),
M_DEVBUF, M_NOWAIT);
 
if (adv->ccb_infos == NULL)

Modified: head/sys/dev/ath/if_ath_rx_edma.c
==
--- head/sys/dev/ath/if_ath_rx_edma.c   Sat Jan 13 21:39:46 2018
(r327948)
+++ head/sys/dev/ath/if_ath_rx_edma.c   Sat Jan 13 22:30:30 2018
(r327949)
@@ -901,9 +901,8 @@ ath_edma_setup_rxfifo(struct ath_softc *sc, HAL_RX_QUE
re->m_fifolen);
 
/* Allocate ath_buf FIFO array, pre-zero'ed */
-   re->m_fifo = malloc(sizeof(struct ath_buf *) * re->m_fifolen,
-   M_ATHDEV,
-   M_NOWAIT | M_ZERO);
+   re->m_fifo = mallocarray(re->m_fifolen, sizeof(struct ath_buf *),
+   M_ATHDEV, M_NOWAIT | M_ZERO);
if (re->m_fifo == NULL) {
device_printf(sc->sc_dev, "%s: malloc failed\n",
__func__);

Modified: head/sys/dev/beri/virtio/virtio.c
==
--- head/sys/dev/beri/virtio/virtio.c   Sat Jan 13 21:39:46 2018
(r327948)
+++ head/sys/dev/beri/virtio/virtio.c   Sat Jan 13 22:30:30 2018
(r327949)
@@ -250,7 +250,7 @@ getcopy(struct iovec *iov, int n)
struct iovec *tiov;
int i;
 
-   tiov = malloc(n * sizeof(struct iovec), M_DEVBUF, M_NOWAIT);
+   tiov = mallocarray(n, sizeof(struct iovec), M_DEVBUF, M_NOWAIT);
for (i = 0; i < n; i++) {
tiov[i].iov_base = iov[i].iov_base;
tiov[i].iov_len = iov[i].iov_len;

Modified: head/sys/dev/bnxt/if_bnxt.c

svn commit: r327948 - head/sys/dev/virtio/console

2018-01-13 Thread Bryan Venteicher
Author: bryanv
Date: Sat Jan 13 21:39:46 2018
New Revision: 327948
URL: https://svnweb.freebsd.org/changeset/base/327948

Log:
  Fix possible panic when creating VirtIO console dev aliases
  
  Since we have no control over the name, the MAKEDEV_CHECKNAME flag must be
  used to return an error on an invalid (to devfs) name instead of panicing.
  
  r305900 that originally added this feature also introduced a few other bugs:
- Proper locking not performed
- Theoretically broke the expectation that the control event buffer would
  not span more than one pages, but did not update the CTASSERT that was
  in place to prevent this. However, since the struct virtio_console_control
  and the bulk buffer together were quite small, this could not have 
happened.
  
  Also workaround an QEMU VirtIO spec violation in that it includes the NUL
  terminator in the buffer length when the spec says it is not included.
  
  PR:   223531
  MFC after:1 week

Modified:
  head/sys/dev/virtio/console/virtio_console.c

Modified: head/sys/dev/virtio/console/virtio_console.c
==
--- head/sys/dev/virtio/console/virtio_console.cSat Jan 13 21:37:14 
2018(r327947)
+++ head/sys/dev/virtio/console/virtio_console.cSat Jan 13 21:39:46 
2018(r327948)
@@ -30,6 +30,7 @@
 __FBSDID("$FreeBSD$");
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -58,14 +59,19 @@ __FBSDID("$FreeBSD$");
 
 #define VTCON_MAX_PORTS 32
 #define VTCON_TTY_PREFIX "V"
+#define VTCON_TTY_ALIAS_PREFIX "vtcon"
 #define VTCON_BULK_BUFSZ 128
+#define VTCON_CTRL_BUFSZ 128
 
 /*
- * The buffer cannot cross more than one page boundary due to the
+ * The buffers cannot cross more than one page boundary due to the
  * size of the sglist segment array used.
  */
 CTASSERT(VTCON_BULK_BUFSZ <= PAGE_SIZE);
+CTASSERT(VTCON_CTRL_BUFSZ <= PAGE_SIZE);
 
+CTASSERT(sizeof(struct virtio_console_config) <= VTCON_CTRL_BUFSZ);
+
 struct vtcon_softc;
 struct vtcon_softc_port;
 
@@ -80,6 +86,7 @@ struct vtcon_port {
int  vtcport_flags;
 #define VTCON_PORT_FLAG_GONE   0x01
 #define VTCON_PORT_FLAG_CONSOLE0x02
+#define VTCON_PORT_FLAG_ALIAS  0x04
 
 #if defined(KDB)
int  vtcport_alt_break_state;
@@ -193,6 +200,8 @@ static void  vtcon_port_requeue_buf(struct vtcon_port 
 static int  vtcon_port_populate(struct vtcon_port *);
 static void vtcon_port_destroy(struct vtcon_port *);
 static int  vtcon_port_create(struct vtcon_softc *, int);
+static void vtcon_port_dev_alias(struct vtcon_port *, const char *,
+size_t);
 static void vtcon_port_drain_bufs(struct virtqueue *);
 static void vtcon_port_drain(struct vtcon_port *);
 static void vtcon_port_teardown(struct vtcon_port *);
@@ -599,8 +608,7 @@ vtcon_ctrl_event_enqueue(struct vtcon_softc *sc,
vq = sc->vtcon_ctrl_rxvq;
 
sglist_init(, 2, segs);
-   error = sglist_append(, control,
-   sizeof(struct virtio_console_control) + VTCON_BULK_BUFSZ);
+   error = sglist_append(, control, VTCON_CTRL_BUFSZ);
KASSERT(error == 0, ("%s: error %d adding control to sglist",
__func__, error));
 
@@ -613,10 +621,7 @@ vtcon_ctrl_event_create(struct vtcon_softc *sc)
struct virtio_console_control *control;
int error;
 
-   control = malloc(
-   sizeof(struct virtio_console_control) + VTCON_BULK_BUFSZ,
-   M_DEVBUF, M_ZERO | M_NOWAIT);
-
+   control = malloc(VTCON_CTRL_BUFSZ, M_DEVBUF, M_ZERO | M_NOWAIT);
if (control == NULL)
return (ENOMEM);
 
@@ -633,8 +638,7 @@ vtcon_ctrl_event_requeue(struct vtcon_softc *sc,
 {
int error;
 
-   bzero(control, sizeof(struct virtio_console_control) +
-   VTCON_BULK_BUFSZ);
+   bzero(control, VTCON_CTRL_BUFSZ);
 
error = vtcon_ctrl_event_enqueue(sc, control);
KASSERT(error == 0,
@@ -811,19 +815,36 @@ vtcon_ctrl_port_name_event(struct vtcon_softc *sc, int
dev = sc->vtcon_dev;
scport = >vtcon_ports[id];
 
+   /*
+* The VirtIO specification says the NUL terminator is not included in
+* the length, but QEMU includes it. Adjust the length if needed.
+*/
+   if (name == NULL || len == 0)
+   return;
+   if (name[len - 1] == '\0') {
+   len--;
+   if (len == 0)
+   return;
+   }
+
+   VTCON_LOCK(sc);
port = scport->vcsp_port;
if (port == NULL) {
+   VTCON_UNLOCK(sc);
device_printf(dev, "%s: name port %d, but does not exist\n",
__func__, id);
return;
}
 
-   tty_makealias(port->vtcport_tty, "vtcon/%*s", (int)len, name);
+   VTCON_PORT_LOCK(port);
+   VTCON_UNLOCK(sc);
+   vtcon_port_dev_alias(port, name, 

svn commit: r327947 - head/usr.bin/limits

2018-01-13 Thread Eitan Adler
Author: eadler
Date: Sat Jan 13 21:37:14 2018
New Revision: 327947
URL: https://svnweb.freebsd.org/changeset/base/327947

Log:
  limits(1): also bump .Dd...
  
  PR:   225147
  MFC After:1 week

Modified:
  head/usr.bin/limits/limits.1

Modified: head/usr.bin/limits/limits.1
==
--- head/usr.bin/limits/limits.1Sat Jan 13 21:36:39 2018
(r327946)
+++ head/usr.bin/limits/limits.1Sat Jan 13 21:37:14 2018
(r327947)
@@ -19,7 +19,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 1, 2013
+.Dd January 13, 2018
 .Dt LIMITS 1
 .Os
 .Sh NAME
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r327946 - head/usr.bin/limits

2018-01-13 Thread Eitan Adler
Author: eadler
Date: Sat Jan 13 21:36:39 2018
New Revision: 327946
URL: https://svnweb.freebsd.org/changeset/base/327946

Log:
  limits(1): fix grammar
  
  Submitted by: yuri
  PR:   225147
  MFC After:1 week

Modified:
  head/usr.bin/limits/limits.1

Modified: head/usr.bin/limits/limits.1
==
--- head/usr.bin/limits/limits.1Sat Jan 13 21:27:36 2018
(r327945)
+++ head/usr.bin/limits/limits.1Sat Jan 13 21:36:39 2018
(r327946)
@@ -82,7 +82,7 @@ login capabilities database.
 .It Nm Fl e Op Ar limitflags
 This usage determines values of resource settings according to
 .Ar limitflags ,
-but does not set them itself.
+but does not set them.
 Like the previous usage, it outputs these values to standard
 output, except that it will emit them in
 .Ic eval
@@ -180,7 +180,7 @@ options.
 Select
 .Dq "eval mode"
 formatting for output.
-This is valid only on display mode and cannot be used when running a
+This is valid only in display mode and cannot be used when running a
 command.
 The exact syntax used for output depends upon the type of shell from
 which
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r327943 - head/sys/powerpc/mpc85xx

2018-01-13 Thread Justin Hibbits
Author: jhibbits
Date: Sat Jan 13 21:10:42 2018
New Revision: 327943
URL: https://svnweb.freebsd.org/changeset/base/327943

Log:
  Include only the headers needed
  
  The extra headers came through evolution of the file.

Modified:
  head/sys/powerpc/mpc85xx/mpc85xx_cache.c

Modified: head/sys/powerpc/mpc85xx/mpc85xx_cache.c
==
--- head/sys/powerpc/mpc85xx/mpc85xx_cache.cSat Jan 13 21:08:38 2018
(r327942)
+++ head/sys/powerpc/mpc85xx/mpc85xx_cache.cSat Jan 13 21:10:42 2018
(r327943)
@@ -32,21 +32,12 @@
 __FBSDID("$FreeBSD$");
 
 #include 
-#include 
-#include 
 #include 
 #include 
 #include 
-#include 
-#include 
-#include 
-#include 
 
 #include 
-#include 
-#include 
 
-#include 
 #include 
 #include 
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r327941 - head/usr.sbin/timed/timed

2018-01-13 Thread Eitan Adler
Author: eadler
Date: Sat Jan 13 20:35:32 2018
New Revision: 327941
URL: https://svnweb.freebsd.org/changeset/base/327941

Log:
  timed: slave is an infinite loop, mark it as such

Modified:
  head/usr.sbin/timed/timed/extern.h
  head/usr.sbin/timed/timed/slave.c

Modified: head/usr.sbin/timed/timed/extern.h
==
--- head/usr.sbin/timed/timed/extern.h  Sat Jan 13 19:02:51 2018
(r327940)
+++ head/usr.sbin/timed/timed/extern.h  Sat Jan 13 20:35:32 2018
(r327941)
@@ -77,7 +77,7 @@ void   print(struct tsp *, struct sockaddr_in *);
 voidprthp(clock_t);
 voidrmnetmachs(struct netinfo *);
 voidsetstatus(void);
-int slave(void);
+voidslave(void) __dead2;
 voidslaveack(void);
 voidspreadtime(void);
 voidsuppress(struct sockaddr_in *, char *, struct netinfo *);

Modified: head/usr.sbin/timed/timed/slave.c
==
--- head/usr.sbin/timed/timed/slave.c   Sat Jan 13 19:02:51 2018
(r327940)
+++ head/usr.sbin/timed/timed/slave.c   Sat Jan 13 20:35:32 2018
(r327941)
@@ -56,7 +56,7 @@ static void schgdate(struct tsp *, char *);
 static void setmaster(struct tsp *);
 static void answerdelay(void);
 
-int
+void
 slave(void)
 {
int tries;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r327940 - head/sys/contrib/zstd/lib/freebsd

2018-01-13 Thread Pedro Giffuni



On 13/01/2018 14:59, Conrad Meyer wrote:

On Sat, Jan 13, 2018 at 11:54 AM, Pedro Giffuni  wrote:

On 01/13/18 14:24, Conrad Meyer wrote:

This is not in contrib code --
https://lists.freebsd.org/pipermail/svn-src-all/2018-January/156505.html
.
Thanks, I read it late...

Shouldn't the local code be in usr.bin/zstd ?

No — this code ports zstd to the kernel.  It would not make sense in usr.bin.


Bah, yes, it should be somewhere else under sys but then if you use it 
for ZFS and somewhere else, it's not clear where it should go .. 
nevermind. I was just backtracing.


Please add yourself to the MAINTAINERS file if you want pre-commit reviews.

Pedro.

___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r327940 - head/sys/contrib/zstd/lib/freebsd

2018-01-13 Thread Conrad Meyer
On Sat, Jan 13, 2018 at 11:54 AM, Pedro Giffuni  wrote:
> On 01/13/18 14:24, Conrad Meyer wrote:
>
> This is not in contrib code --
> https://lists.freebsd.org/pipermail/svn-src-all/2018-January/156505.html
> .
> Thanks, I read it late...
>
> Shouldn't the local code be in usr.bin/zstd ?

No — this code ports zstd to the kernel.  It would not make sense in usr.bin.

Conrad
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r327940 - head/sys/contrib/zstd/lib/freebsd

2018-01-13 Thread Allan Jude
On 2018-01-13 14:54, Pedro Giffuni wrote:
> Hmm ...
> 
> 
> On 01/13/18 14:24, Conrad Meyer wrote:
>> This is not in contrib code --
>> https://lists.freebsd.org/pipermail/svn-src-all/2018-January/156505.html
>> .
> 
> Thanks, I read it late...
> 
> Shouldn't the local code be in usr.bin/zstd ?
> 
> Pedro.
> 

This .h file is only used for the kernel version of zstd, not the
userland version.

-- 
Allan Jude
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r327934 - head/sys/contrib/zstd/lib/freebsd

2018-01-13 Thread Allan Jude
On 2018-01-13 14:23, Conrad Meyer wrote:
> On Sat, Jan 13, 2018 at 10:09 AM, Pedro F. Giffuni  wrote:
>> Author: pfg
>> Date: Sat Jan 13 18:09:09 2018
>> New Revision: 327934
>> URL: https://svnweb.freebsd.org/changeset/base/327934
>>
>> Log:
>>   zstd: Use memalloc(9) for calloc macro.
>>
>>   This is in contrib code but since we only have memalloc(9) in current we
>>   will not upstream this.
> 
> Fortunately, zstd_kfreebsd.h is not contrib code but local code.  We
> don't have to worry about upstreaming this change.  Please consider
> including review from Allan Jude, Warner, or myself on future zstd
> changes.  We've tried to be very careful not to modify contrib code.
> 
> For the record, though, I approve this change.
> 
> Best,
> Conrad
> 
>> Modified:
>>   head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h
> 

Looks good to me too

-- 
Allan Jude
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r327940 - head/sys/contrib/zstd/lib/freebsd

2018-01-13 Thread Pedro Giffuni

Hmm ...


On 01/13/18 14:24, Conrad Meyer wrote:

This is not in contrib code --
https://lists.freebsd.org/pipermail/svn-src-all/2018-January/156505.html
.


Thanks, I read it late...

Shouldn't the local code be in usr.bin/zstd ?

Pedro.




On Sat, Jan 13, 2018 at 11:02 AM, Pedro F. Giffuni  wrote:

Author: pfg
Date: Sat Jan 13 19:02:51 2018
New Revision: 327940
URL: https://svnweb.freebsd.org/changeset/base/327940

Log:
   zstd: Use mallocarray(9) for calloc macro.

   This is in contrib code but since we only have mallocarray(9) in current
   we will not upstream this.

   This effectively brings back r327934, which was reverted to correct the
   log message.

Modified:
   head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h

Modified: head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h
==
--- head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h   Sat Jan 13 19:02:08 
2018(r327939)
+++ head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h   Sat Jan 13 19:02:51 
2018(r327940)
@@ -46,7 +46,7 @@ MALLOC_DECLARE(M_ZSTD);
  #define malloc(x)  (malloc)((x), M_ZSTD, M_WAITOK)
  #define free(x)(free)((x), M_ZSTD)
  /* in zstd's use of calloc, a is always 1 */
-#define calloc(a,b)(malloc)((a)*(b), M_ZSTD, M_WAITOK | M_ZERO)
+#define calloc(a,b)(mallocarray)((a), (b), M_ZSTD, M_WAITOK | M_ZERO)
  #endif

  #ifdef __cplusplus



___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r327940 - head/sys/contrib/zstd/lib/freebsd

2018-01-13 Thread Conrad Meyer
This is not in contrib code --
https://lists.freebsd.org/pipermail/svn-src-all/2018-January/156505.html
.

On Sat, Jan 13, 2018 at 11:02 AM, Pedro F. Giffuni  wrote:
> Author: pfg
> Date: Sat Jan 13 19:02:51 2018
> New Revision: 327940
> URL: https://svnweb.freebsd.org/changeset/base/327940
>
> Log:
>   zstd: Use mallocarray(9) for calloc macro.
>
>   This is in contrib code but since we only have mallocarray(9) in current
>   we will not upstream this.
>
>   This effectively brings back r327934, which was reverted to correct the
>   log message.
>
> Modified:
>   head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h
>
> Modified: head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h
> ==
> --- head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h   Sat Jan 13 19:02:08 
> 2018(r327939)
> +++ head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h   Sat Jan 13 19:02:51 
> 2018(r327940)
> @@ -46,7 +46,7 @@ MALLOC_DECLARE(M_ZSTD);
>  #define malloc(x)  (malloc)((x), M_ZSTD, M_WAITOK)
>  #define free(x)(free)((x), M_ZSTD)
>  /* in zstd's use of calloc, a is always 1 */
> -#define calloc(a,b)(malloc)((a)*(b), M_ZSTD, M_WAITOK | M_ZERO)
> +#define calloc(a,b)(mallocarray)((a), (b), M_ZSTD, M_WAITOK | M_ZERO)
>  #endif
>
>  #ifdef __cplusplus
>
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r327934 - head/sys/contrib/zstd/lib/freebsd

2018-01-13 Thread Conrad Meyer
On Sat, Jan 13, 2018 at 10:09 AM, Pedro F. Giffuni  wrote:
> Author: pfg
> Date: Sat Jan 13 18:09:09 2018
> New Revision: 327934
> URL: https://svnweb.freebsd.org/changeset/base/327934
>
> Log:
>   zstd: Use memalloc(9) for calloc macro.
>
>   This is in contrib code but since we only have memalloc(9) in current we
>   will not upstream this.

Fortunately, zstd_kfreebsd.h is not contrib code but local code.  We
don't have to worry about upstreaming this change.  Please consider
including review from Allan Jude, Warner, or myself on future zstd
changes.  We've tried to be very careful not to modify contrib code.

For the record, though, I approve this change.

Best,
Conrad

> Modified:
>   head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r327928 - head/sys/powerpc/mpc85xx

2018-01-13 Thread Kyle Evans
On Sat, Jan 13, 2018 at 12:55 PM, Pedro Giffuni  wrote:
> Hello;
>
>
>
> On 01/13/18 13:26, Kyle Evans wrote:
>>
>> On Sat, Jan 13, 2018 at 11:25 AM, Justin Hibbits 
>> wrote:
>>>
>>> Author: jhibbits
>>> Date: Sat Jan 13 17:25:48 2018
>>> New Revision: 327928
>>> URL: https://svnweb.freebsd.org/changeset/base/327928
>>>
>>> Log:
>>>Add SPDX identifier to header
>>>
>>>Reported by:  pfg
>>>
>>> Modified:
>>>head/sys/powerpc/mpc85xx/mpc85xx_cache.c
>>>
>>> Modified: head/sys/powerpc/mpc85xx/mpc85xx_cache.c
>>>
>>> ==
>>> --- head/sys/powerpc/mpc85xx/mpc85xx_cache.cSat Jan 13 17:21:45 2018
>>> (r327927)
>>> +++ head/sys/powerpc/mpc85xx/mpc85xx_cache.cSat Jan 13 17:25:48 2018
>>> (r327928)
>>> @@ -1,4 +1,6 @@
>>>   /*-
>>> + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
>>> + *
>>>* Copyright (c) 2018 Justin Hibbits
>>>* All rights reserved.
>>>*
>>
>> Doesn't BSD-2-Clause-FreeBSD imply that the license includes the
>> following disclaimer?
>>
>> "The views and conclusions contained in the software and documentation
>> are those of the authors and should not be interpreted as representing
>> official policies, either expressed or implied, of the FreeBSD
>> Project."
>>
>> That's what the SPDX license list seems to imply. I have some stuff
>> I've recently added that I need to go back and tag.
>
> No, the SPDX guys pointed to our website:
>
> https://www.freebsd.org/copyright/freebsd-license.html
>
> And by mistake they added the documentation project disclaimer, but that
> last paragraph is not part of the license. At some point I reported the
> issue but they haven't fixed it.

Thanks for the clarification!
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r327940 - head/sys/contrib/zstd/lib/freebsd

2018-01-13 Thread Pedro F. Giffuni
Author: pfg
Date: Sat Jan 13 19:02:51 2018
New Revision: 327940
URL: https://svnweb.freebsd.org/changeset/base/327940

Log:
  zstd: Use mallocarray(9) for calloc macro.
  
  This is in contrib code but since we only have mallocarray(9) in current
  we will not upstream this.
  
  This effectively brings back r327934, which was reverted to correct the
  log message.

Modified:
  head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h

Modified: head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h
==
--- head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h   Sat Jan 13 19:02:08 
2018(r327939)
+++ head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h   Sat Jan 13 19:02:51 
2018(r327940)
@@ -46,7 +46,7 @@ MALLOC_DECLARE(M_ZSTD);
 #define malloc(x)  (malloc)((x), M_ZSTD, M_WAITOK)
 #define free(x)(free)((x), M_ZSTD)
 /* in zstd's use of calloc, a is always 1 */
-#define calloc(a,b)(malloc)((a)*(b), M_ZSTD, M_WAITOK | M_ZERO)
+#define calloc(a,b)(mallocarray)((a), (b), M_ZSTD, M_WAITOK | M_ZERO)
 #endif
 
 #ifdef __cplusplus
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r327939 - head/sys/arm/allwinner

2018-01-13 Thread Kyle Evans
Author: kevans
Date: Sat Jan 13 19:02:08 2018
New Revision: 327939
URL: https://svnweb.freebsd.org/changeset/base/327939

Log:
  Add SPDX tag to aw_syscon(4)

Modified:
  head/sys/arm/allwinner/aw_syscon.c

Modified: head/sys/arm/allwinner/aw_syscon.c
==
--- head/sys/arm/allwinner/aw_syscon.c  Sat Jan 13 19:00:41 2018
(r327938)
+++ head/sys/arm/allwinner/aw_syscon.c  Sat Jan 13 19:02:08 2018
(r327939)
@@ -1,4 +1,6 @@
 /*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
  * Copyright (c) 2018 Kyle Evans 
  * All rights reserved.
  *
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r327938 - head/sys/dev/extres/syscon

2018-01-13 Thread Kyle Evans
Author: kevans
Date: Sat Jan 13 19:00:41 2018
New Revision: 327938
URL: https://svnweb.freebsd.org/changeset/base/327938

Log:
  Add SPDX tags to syscon bits, correct inconsistency in Copyright line.

Modified:
  head/sys/dev/extres/syscon/syscon.c
  head/sys/dev/extres/syscon/syscon.h
  head/sys/dev/extres/syscon/syscon_generic.c
  head/sys/dev/extres/syscon/syscon_generic.h

Modified: head/sys/dev/extres/syscon/syscon.c
==
--- head/sys/dev/extres/syscon/syscon.c Sat Jan 13 18:56:42 2018
(r327937)
+++ head/sys/dev/extres/syscon/syscon.c Sat Jan 13 19:00:41 2018
(r327938)
@@ -1,4 +1,6 @@
 /*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
  * Copyright (c) 2017 Kyle Evans 
  * All rights reserved.
  *

Modified: head/sys/dev/extres/syscon/syscon.h
==
--- head/sys/dev/extres/syscon/syscon.h Sat Jan 13 18:56:42 2018
(r327937)
+++ head/sys/dev/extres/syscon/syscon.h Sat Jan 13 19:00:41 2018
(r327938)
@@ -1,5 +1,7 @@
 /*-
- * Copyright 2017 Kyle Evans 
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2017 Kyle Evans 
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without

Modified: head/sys/dev/extres/syscon/syscon_generic.c
==
--- head/sys/dev/extres/syscon/syscon_generic.c Sat Jan 13 18:56:42 2018
(r327937)
+++ head/sys/dev/extres/syscon/syscon_generic.c Sat Jan 13 19:00:41 2018
(r327938)
@@ -1,4 +1,6 @@
 /*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
  * Copyright (c) 2015 Michal Meloun
  * All rights reserved.
  *

Modified: head/sys/dev/extres/syscon/syscon_generic.h
==
--- head/sys/dev/extres/syscon/syscon_generic.h Sat Jan 13 18:56:42 2018
(r327937)
+++ head/sys/dev/extres/syscon/syscon_generic.h Sat Jan 13 19:00:41 2018
(r327938)
@@ -1,5 +1,7 @@
 /*-
- * Copyright 2018 Kyle Evans 
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2018 Kyle Evans 
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r327928 - head/sys/powerpc/mpc85xx

2018-01-13 Thread Pedro Giffuni

Hello;


On 01/13/18 13:26, Kyle Evans wrote:

On Sat, Jan 13, 2018 at 11:25 AM, Justin Hibbits  wrote:

Author: jhibbits
Date: Sat Jan 13 17:25:48 2018
New Revision: 327928
URL: https://svnweb.freebsd.org/changeset/base/327928

Log:
   Add SPDX identifier to header

   Reported by:  pfg

Modified:
   head/sys/powerpc/mpc85xx/mpc85xx_cache.c

Modified: head/sys/powerpc/mpc85xx/mpc85xx_cache.c
==
--- head/sys/powerpc/mpc85xx/mpc85xx_cache.cSat Jan 13 17:21:45 2018
(r327927)
+++ head/sys/powerpc/mpc85xx/mpc85xx_cache.cSat Jan 13 17:25:48 2018
(r327928)
@@ -1,4 +1,6 @@
  /*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
   * Copyright (c) 2018 Justin Hibbits
   * All rights reserved.
   *

Doesn't BSD-2-Clause-FreeBSD imply that the license includes the
following disclaimer?

"The views and conclusions contained in the software and documentation
are those of the authors and should not be interpreted as representing
official policies, either expressed or implied, of the FreeBSD
Project."

That's what the SPDX license list seems to imply. I have some stuff
I've recently added that I need to go back and tag.

No, the SPDX guys pointed to our website:

https://www.freebsd.org/copyright/freebsd-license.html

And by mistake they added the documentation project disclaimer, but that 
last paragraph is not part of the license. At some point I reported the 
issue but they haven't fixed it.


Pedro.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r327937 - head/sys/contrib/zstd/lib/freebsd

2018-01-13 Thread Pedro F. Giffuni
Author: pfg
Date: Sat Jan 13 18:56:42 2018
New Revision: 327937
URL: https://svnweb.freebsd.org/changeset/base/327937

Log:
  Revert r327934 to fix the log message.

Modified:
  head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h

Modified: head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h
==
--- head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h   Sat Jan 13 18:46:31 
2018(r327936)
+++ head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h   Sat Jan 13 18:56:42 
2018(r327937)
@@ -46,7 +46,7 @@ MALLOC_DECLARE(M_ZSTD);
 #define malloc(x)  (malloc)((x), M_ZSTD, M_WAITOK)
 #define free(x)(free)((x), M_ZSTD)
 /* in zstd's use of calloc, a is always 1 */
-#define calloc(a,b)(mallocarray)((a), (b), M_ZSTD, M_WAITOK | M_ZERO)
+#define calloc(a,b)(malloc)((a)*(b), M_ZSTD, M_WAITOK | M_ZERO)
 #endif
 
 #ifdef __cplusplus
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r327936 - in head: share/man/man4 sys/arm/allwinner sys/dev/extres/syscon

2018-01-13 Thread Kyle Evans
Author: kevans
Date: Sat Jan 13 18:46:31 2018
New Revision: 327936
URL: https://svnweb.freebsd.org/changeset/base/327936

Log:
  Introduce aw_syscon(4) for earlier attachment
  
  Attaching syscon_generic earlier than BUS_PASS_DEFAULT makes it more
  difficult for specific syscon drivers to attach to the syscon node and to
  get ordering right. Further discussion yielded the following set of
  decisions:
  
  - Move syscon_generic to BUS_PASS_DEFAULT
  - If a platform needs a syscon with different attach order or probe
  behavior, it should subclass syscon_generic and match on the SoC specific
  compat string
  - When we come across a need for a syscon that attaches earlier but only
  specifies compatible = "syscon", we should create a syscon_exclusive driver
  that provides generic access but probes earlier and only matches if "syscon"
  is the only compatible. Such fdt nodes do exist in the wild right now, but
  we don't really use them at the moment.
  
  Additionally:
  
  - Any syscon provider that has needs any more complex than a spinlock solely
  for syscon access and a single memory resource should subclass syscon
  directly rather than attempting to subclass syscon_generic or add complexity
  to it. syscon_generic's attach/detach methods may be made public should the
  need arise to subclass it with additional attach/detach behavior.
  
  We introduce aw_syscon(4) that just subclasses syscon_generic but probes
  earlier to meet our requirements for if_awg and implements #2 above for this
  specific situation. It currently only matches a64/a83t/h3 since these are
  the only platforms that really need it at the time being.
  
  Discussed with:   ian
  Reviewed by:  manu, andrew, bcr (manpages, content unchanged since review)
  Differential Revision:https://reviews.freebsd.org/D13793

Added:
  head/share/man/man4/aw_syscon.4   (contents, props changed)
  head/sys/arm/allwinner/aw_syscon.c   (contents, props changed)
  head/sys/dev/extres/syscon/syscon_generic.h   (contents, props changed)
Modified:
  head/share/man/man4/Makefile
  head/sys/arm/allwinner/files.allwinner
  head/sys/dev/extres/syscon/syscon_generic.c

Modified: head/share/man/man4/Makefile
==
--- head/share/man/man4/MakefileSat Jan 13 18:28:30 2018
(r327935)
+++ head/share/man/man4/MakefileSat Jan 13 18:46:31 2018
(r327936)
@@ -74,6 +74,7 @@ MAN=  aac.4 \
${_aw_mmc.4} \
${_aw_rtc.4} \
${_aw_sid.4} \
+   ${_aw_syscon.4} \
axe.4 \
axge.4 \
bce.4 \
@@ -765,6 +766,7 @@ _aw_gpio.4= aw_gpio.4
 _aw_mmc.4= aw_mmc.4
 _aw_rtc.4= aw_rtc.4
 _aw_sid.4= aw_sid.4
+_aw_syscon.4=  aw_syscon.4
 .endif
 
 .if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"

Added: head/share/man/man4/aw_syscon.4
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/share/man/man4/aw_syscon.4 Sat Jan 13 18:46:31 2018
(r327936)
@@ -0,0 +1,60 @@
+.\"-
+.\" Copyright (c) 2018 Kyle Evans 
+.\" All rights reserved.
+.\"
+.\" 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.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 7, 2018
+.Dt AW_SYSCON 4
+.Os
+.Sh NAME
+.Nm aw_syscon
+.Nd driver for the system controller in Allwinner SoC
+.Sh DESCRIPTION
+The
+.Nm
+device driver provides support for the Allwinner system controller.
+This controller provides registers for tying together related functionality in 
a
+common space.
+.Nm
+is required for ethernet functionality on supported devices.
+.Sh HARDWARE
+The
+.Nm

Re: svn commit: r327934 - head/sys/contrib/zstd/lib/freebsd

2018-01-13 Thread Pedro Giffuni



On 01/13/18 13:44, Dimitry Andric wrote:

On 13 Jan 2018, at 19:09, Pedro F. Giffuni  wrote:

Author: pfg
Date: Sat Jan 13 18:09:09 2018
New Revision: 327934
URL: https://svnweb.freebsd.org/changeset/base/327934

Log:
  zstd: Use memalloc(9) for calloc macro.

  This is in contrib code but since we only have memalloc(9) in current we
  will not upstream this.

Modified:
  head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h

Modified: head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h
==
--- head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h   Sat Jan 13 17:56:46 
2018(r327933)
+++ head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h   Sat Jan 13 18:09:09 
2018(r327934)
@@ -46,7 +46,7 @@ MALLOC_DECLARE(M_ZSTD);
#define malloc(x)   (malloc)((x), M_ZSTD, M_WAITOK)
#define free(x) (free)((x), M_ZSTD)
/* in zstd's use of calloc, a is always 1 */
-#define calloc(a,b)(malloc)((a)*(b), M_ZSTD, M_WAITOK | M_ZERO)
+#define calloc(a,b)(mallocarray)((a), (b), M_ZSTD, M_WAITOK | M_ZERO)
#endif

#ifdef __cplusplus

s/memalloc/mallocarray/g, in the commit message?

Oops ..yeah.. mind glitch.

Should I revert/fix it?

Pedro.

___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r327934 - head/sys/contrib/zstd/lib/freebsd

2018-01-13 Thread Dimitry Andric
On 13 Jan 2018, at 19:09, Pedro F. Giffuni  wrote:
> 
> Author: pfg
> Date: Sat Jan 13 18:09:09 2018
> New Revision: 327934
> URL: https://svnweb.freebsd.org/changeset/base/327934
> 
> Log:
>  zstd: Use memalloc(9) for calloc macro.
> 
>  This is in contrib code but since we only have memalloc(9) in current we
>  will not upstream this.
> 
> Modified:
>  head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h
> 
> Modified: head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h
> ==
> --- head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h Sat Jan 13 17:56:46 
> 2018(r327933)
> +++ head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h Sat Jan 13 18:09:09 
> 2018(r327934)
> @@ -46,7 +46,7 @@ MALLOC_DECLARE(M_ZSTD);
> #define malloc(x) (malloc)((x), M_ZSTD, M_WAITOK)
> #define free(x)   (free)((x), M_ZSTD)
> /* in zstd's use of calloc, a is always 1 */
> -#define calloc(a,b)  (malloc)((a)*(b), M_ZSTD, M_WAITOK | M_ZERO)
> +#define calloc(a,b)  (mallocarray)((a), (b), M_ZSTD, M_WAITOK | M_ZERO)
> #endif
> 
> #ifdef __cplusplus

s/memalloc/mallocarray/g, in the commit message?

-Dimitry



signature.asc
Description: Message signed with OpenPGP


Re: svn commit: r327934 - head/sys/contrib/zstd/lib/freebsd

2018-01-13 Thread O. Hartmann
Am Sat, 13 Jan 2018 18:09:10 + (UTC)
"Pedro F. Giffuni"  schrieb:

> Author: pfg
> Date: Sat Jan 13 18:09:09 2018
> New Revision: 327934
> URL: https://svnweb.freebsd.org/changeset/base/327934
> 
> Log:
>   zstd: Use memalloc(9) for calloc macro.
>   
>   This is in contrib code but since we only have memalloc(9) in current we
>   will not upstream this.
> 
> Modified:
>   head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h
> 
> Modified: head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h
> ==
> --- head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h Sat Jan 13 17:56:46
> 2018  (r327933) +++ head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h Sat
> Jan 13 18:09:09 2018  (r327934) @@ -46,7 +46,7 @@ MALLOC_DECLARE(M_ZSTD);
>  #define malloc(x)(malloc)((x), M_ZSTD, M_WAITOK)
>  #define free(x)  (free)((x), M_ZSTD)
>  /* in zstd's use of calloc, a is always 1 */
> -#define calloc(a,b)  (malloc)((a)*(b), M_ZSTD, M_WAITOK | M_ZERO)
> +#define calloc(a,b)  (mallocarray)((a), (b), M_ZSTD, M_WAITOK | M_ZERO)
>  #endif
>  
>  #ifdef __cplusplus
> ___
> 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"

You reference "memalloc(9)" - but on recent CURRENT, there is no such manpage 
available.

regards,

oh

-- 
O. Hartmann

Ich widerspreche der Nutzung oder Übermittlung meiner Daten für
Werbezwecke oder für die Markt- oder Meinungsforschung (§ 28 Abs. 4 BDSG).


pgpoymG7BKFcF.pgp
Description: OpenPGP digital signature


Re: svn commit: r327906 - in head/sys: conf powerpc/mpc85xx

2018-01-13 Thread Pedro Giffuni



On 01/13/18 13:02, Kevin Lo wrote:

On Sat, Jan 13, 2018 at 10:38:43AM -0500, Pedro Giffuni wrote:

...


On 13/01/2018 10:33, Justin Hibbits wrote:

...


 Can we please add SPDX ID tags, specially on new code?
 I had them added to the guidelines:

 
https://www.freebsd.org/doc/en_US.ISO8859-1/articles/committers-guide/pref-license.html
 


 It is just not fun for me anymore to go hunting for untagged files
 and they keep appearing ;).

 Pedro.


D'oh, sorry. I had used an existing boilerplate template I have lying
around that didn't have the SPDX tags. I'll update and fix this.


It's OK, no hurry.

The diff below adds SPDX tag to the example copyright.

Index: share/examples/etc/bsd-style-copyright
===
--- share/examples/etc/bsd-style-copyright  (revision 327932)
+++ share/examples/etc/bsd-style-copyright  (working copy)
@@ -1,4 +1,6 @@
  /*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
   * Copyright (c) [year] [your name]
   * All rights reserved.
   *
Hmm ... and now I am in doubt if we should include the FreeBSD suffix in 
the identifier: the example could be used for non FreeBSD projects.


I'll certainly update it though,

Thanks!
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r327935 - head/share/examples/etc

2018-01-13 Thread Pedro F. Giffuni
Author: pfg
Date: Sat Jan 13 18:28:30 2018
New Revision: 327935
URL: https://svnweb.freebsd.org/changeset/base/327935

Log:
  Add SPDX identifier for the example license.
  
  For project files we should use the -FreeBSD prefix but for this example
  assume it is going to be used for some general purpose.
  
  Submitted by: kevlo

Modified:
  head/share/examples/etc/bsd-style-copyright

Modified: head/share/examples/etc/bsd-style-copyright
==
--- head/share/examples/etc/bsd-style-copyright Sat Jan 13 18:09:09 2018
(r327934)
+++ head/share/examples/etc/bsd-style-copyright Sat Jan 13 18:28:30 2018
(r327935)
@@ -1,4 +1,6 @@
 /*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
  * Copyright (c) [year] [your name]
  * All rights reserved.
  *
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r327928 - head/sys/powerpc/mpc85xx

2018-01-13 Thread Kyle Evans
On Sat, Jan 13, 2018 at 11:25 AM, Justin Hibbits  wrote:
> Author: jhibbits
> Date: Sat Jan 13 17:25:48 2018
> New Revision: 327928
> URL: https://svnweb.freebsd.org/changeset/base/327928
>
> Log:
>   Add SPDX identifier to header
>
>   Reported by:  pfg
>
> Modified:
>   head/sys/powerpc/mpc85xx/mpc85xx_cache.c
>
> Modified: head/sys/powerpc/mpc85xx/mpc85xx_cache.c
> ==
> --- head/sys/powerpc/mpc85xx/mpc85xx_cache.cSat Jan 13 17:21:45 2018  
>   (r327927)
> +++ head/sys/powerpc/mpc85xx/mpc85xx_cache.cSat Jan 13 17:25:48 2018  
>   (r327928)
> @@ -1,4 +1,6 @@
>  /*-
> + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
> + *
>   * Copyright (c) 2018 Justin Hibbits
>   * All rights reserved.
>   *

Doesn't BSD-2-Clause-FreeBSD imply that the license includes the
following disclaimer?

"The views and conclusions contained in the software and documentation
are those of the authors and should not be interpreted as representing
official policies, either expressed or implied, of the FreeBSD
Project."

That's what the SPDX license list seems to imply. I have some stuff
I've recently added that I need to go back and tag.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r327934 - head/sys/contrib/zstd/lib/freebsd

2018-01-13 Thread Pedro F. Giffuni
Author: pfg
Date: Sat Jan 13 18:09:09 2018
New Revision: 327934
URL: https://svnweb.freebsd.org/changeset/base/327934

Log:
  zstd: Use memalloc(9) for calloc macro.
  
  This is in contrib code but since we only have memalloc(9) in current we
  will not upstream this.

Modified:
  head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h

Modified: head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h
==
--- head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h   Sat Jan 13 17:56:46 
2018(r327933)
+++ head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h   Sat Jan 13 18:09:09 
2018(r327934)
@@ -46,7 +46,7 @@ MALLOC_DECLARE(M_ZSTD);
 #define malloc(x)  (malloc)((x), M_ZSTD, M_WAITOK)
 #define free(x)(free)((x), M_ZSTD)
 /* in zstd's use of calloc, a is always 1 */
-#define calloc(a,b)(malloc)((a)*(b), M_ZSTD, M_WAITOK | M_ZERO)
+#define calloc(a,b)(mallocarray)((a), (b), M_ZSTD, M_WAITOK | M_ZERO)
 #endif
 
 #ifdef __cplusplus
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r327906 - in head/sys: conf powerpc/mpc85xx

2018-01-13 Thread Kevin Lo
On Sat, Jan 13, 2018 at 10:38:43AM -0500, Pedro Giffuni wrote:
> 
> ...
> 
> 
> On 13/01/2018 10:33, Justin Hibbits wrote:
> >
> >
> > On Jan 13, 2018 09:04, "Pedro Giffuni"  > > wrote:
> >
> >
> >
> > On 12/01/2018 20:36, Justin Hibbits wrote:
> >
> > Author: jhibbits
> > Date: Sat Jan 13 01:36:37 2018
> > New Revision: 327906
> > URL: https://svnweb.freebsd.org/changeset/base/327906
> > 
> > ...
> >
> >
> > Added: head/sys/powerpc/mpc85xx/mpc85xx_cache.c
> > 
> > ==
> > --- /dev/null   00:00:00 1970   (empty, because file is newly
> > added)
> > +++ head/sys/powerpc/mpc85xx/mpc85xx_cache.c Sat Jan 13
> > 01:36:37 2018        (r327906)
> > @@ -0,0 +1,129 @@
> > +/*-
> > + * Copyright (c) 2018 Justin Hibbits
> > + * All rights reserved.
> > + *
> > + * 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.
> > + *
> > + * $FreeBSD$
> > + */
> > +
> >
> >
> > Can we please add SPDX ID tags, specially on new code?
> > I had them added to the guidelines:
> >
> > 
> > https://www.freebsd.org/doc/en_US.ISO8859-1/articles/committers-guide/pref-license.html
> > 
> > 
> >
> > It is just not fun for me anymore to go hunting for untagged files
> > and they keep appearing ;).
> >
> > Pedro.
> >
> >
> > D'oh, sorry. I had used an existing boilerplate template I have lying 
> > around that didn't have the SPDX tags. I'll update and fix this.
> >
> It's OK, no hurry.

The diff below adds SPDX tag to the example copyright.

Index: share/examples/etc/bsd-style-copyright
===
--- share/examples/etc/bsd-style-copyright  (revision 327932)
+++ share/examples/etc/bsd-style-copyright  (working copy)
@@ -1,4 +1,6 @@
 /*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
  * Copyright (c) [year] [your name]
  * All rights reserved.
  *
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r327932 - head/sys/x86/include

2018-01-13 Thread Conrad Meyer
Author: cem
Date: Sat Jan 13 17:55:22 2018
New Revision: 327932
URL: https://svnweb.freebsd.org/changeset/base/327932

Log:
  amd64: Add a 48-bit MAXADDR constant
  
  Some devices (e.g., ccp(4) -- to be committed) can only access the low 48
  bits of physical memory.
  
  Reviewed by:  markj
  Sponsored by: Dell EMC Isilon

Modified:
  head/sys/x86/include/bus.h

Modified: head/sys/x86/include/bus.h
==
--- head/sys/x86/include/bus.h  Sat Jan 13 17:52:55 2018(r327931)
+++ head/sys/x86/include/bus.h  Sat Jan 13 17:55:22 2018(r327932)
@@ -118,6 +118,7 @@
 #define BUS_SPACE_MAXADDR_24BIT0xFF
 #define BUS_SPACE_MAXADDR_32BIT 0x
 #if defined(__amd64__) || defined(PAE)
+#define BUS_SPACE_MAXADDR_48BIT0xULL
 #define BUS_SPACE_MAXADDR  0xULL
 #else
 #define BUS_SPACE_MAXADDR  0x
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r327930 - in head/contrib/llvm/tools/clang: include/clang/AST lib/AST lib/Sema

2018-01-13 Thread Dimitry Andric
Author: dim
Date: Sat Jan 13 17:47:34 2018
New Revision: 327930
URL: https://svnweb.freebsd.org/changeset/base/327930

Log:
  Pull in r314499 from upstream clang trunk (by Daniel Marjamäki):
  
[Sema] Suppress warnings for C's zero initializer
  
Patch by S. Gilles!
  
Differential Revision: https://reviews.llvm.org/D28148
  
  Pull in r314838 from upstream clang trunk (by Richard Smith):
  
Suppress -Wmissing-braces warning when aggregate-initializing a
struct with a single field that is itself an aggregate.
  
In C++, such initialization of std::array types is guaranteed
to work by the standard, is completely idiomatic, and the "suggested"
alternative from Clang was technically invalid.
  
  Together, these suppress unneeded "suggest braces around initialization
  of subobject" warnings for C++11 initializer lists.
  
  MFC after:3 days

Modified:
  head/contrib/llvm/tools/clang/include/clang/AST/Expr.h
  head/contrib/llvm/tools/clang/lib/AST/Expr.cpp
  head/contrib/llvm/tools/clang/lib/Sema/SemaInit.cpp

Modified: head/contrib/llvm/tools/clang/include/clang/AST/Expr.h
==
--- head/contrib/llvm/tools/clang/include/clang/AST/Expr.h  Sat Jan 13 
17:36:11 2018(r327929)
+++ head/contrib/llvm/tools/clang/include/clang/AST/Expr.h  Sat Jan 13 
17:47:34 2018(r327930)
@@ -3986,6 +3986,10 @@ class InitListExpr : public Expr { (public)
   /// initializer)?
   bool isTransparent() const;
 
+  /// Is this the zero initializer {0} in a language which considers it
+  /// idiomatic?
+  bool isIdiomaticZeroInitializer(const LangOptions ) const;
+
   SourceLocation getLBraceLoc() const { return LBraceLoc; }
   void setLBraceLoc(SourceLocation Loc) { LBraceLoc = Loc; }
   SourceLocation getRBraceLoc() const { return RBraceLoc; }
@@ -3994,6 +3998,9 @@ class InitListExpr : public Expr { (public)
   bool isSemanticForm() const { return AltForm.getInt(); }
   InitListExpr *getSemanticForm() const {
 return isSemanticForm() ? nullptr : AltForm.getPointer();
+  }
+  bool isSyntacticForm() const {
+return !AltForm.getInt() || !AltForm.getPointer();
   }
   InitListExpr *getSyntacticForm() const {
 return isSemanticForm() ? AltForm.getPointer() : nullptr;

Modified: head/contrib/llvm/tools/clang/lib/AST/Expr.cpp
==
--- head/contrib/llvm/tools/clang/lib/AST/Expr.cpp  Sat Jan 13 17:36:11 
2018(r327929)
+++ head/contrib/llvm/tools/clang/lib/AST/Expr.cpp  Sat Jan 13 17:47:34 
2018(r327930)
@@ -1899,6 +1899,17 @@ bool InitListExpr::isTransparent() const {
  getInit(0)->getType().getCanonicalType();
 }
 
+bool InitListExpr::isIdiomaticZeroInitializer(const LangOptions ) 
const {
+  assert(isSyntacticForm() && "only test syntactic form as zero initializer");
+
+  if (LangOpts.CPlusPlus || getNumInits() != 1) {
+return false;
+  }
+
+  const IntegerLiteral *Lit = dyn_cast(getInit(0));
+  return Lit && Lit->getValue() == 0;
+}
+
 SourceLocation InitListExpr::getLocStart() const {
   if (InitListExpr *SyntacticForm = getSyntacticForm())
 return SyntacticForm->getLocStart();

Modified: head/contrib/llvm/tools/clang/lib/Sema/SemaInit.cpp
==
--- head/contrib/llvm/tools/clang/lib/Sema/SemaInit.cpp Sat Jan 13 17:36:11 
2018(r327929)
+++ head/contrib/llvm/tools/clang/lib/Sema/SemaInit.cpp Sat Jan 13 17:47:34 
2018(r327930)
@@ -826,6 +826,34 @@ int InitListChecker::numStructUnionElements(QualType D
   return InitializableMembers - structDecl->hasFlexibleArrayMember();
 }
 
+/// Determine whether Entity is an entity for which it is idiomatic to elide
+/// the braces in aggregate initialization.
+static bool isIdiomaticBraceElisionEntity(const InitializedEntity ) {
+  // Recursive initialization of the one and only field within an aggregate
+  // class is considered idiomatic. This case arises in particular for
+  // initialization of std::array, where the C++ standard suggests the idiom of
+  //
+  //   std::array arr = {1, 2, 3};
+  //
+  // (where std::array is an aggregate struct containing a single array field.
+
+  // FIXME: Should aggregate initialization of a struct with a single
+  // base class and no members also suppress the warning?
+  if (Entity.getKind() != InitializedEntity::EK_Member || !Entity.getParent())
+return false;
+
+  auto *ParentRD =
+  Entity.getParent()->getType()->castAs()->getDecl();
+  if (CXXRecordDecl *CXXRD = dyn_cast(ParentRD))
+if (CXXRD->getNumBases())
+  return false;
+
+  auto FieldIt = ParentRD->field_begin();
+  assert(FieldIt != ParentRD->field_end() &&
+ "no fields but have initializer for member?");
+  return ++FieldIt == ParentRD->field_end();
+}
+
 /// Check whether the range of the initializer \p ParentIList from 

svn commit: r327929 - head/sys/dev/mmc

2018-01-13 Thread Marius Strobl
Author: marius
Date: Sat Jan 13 17:36:11 2018
New Revision: 327929
URL: https://svnweb.freebsd.org/changeset/base/327929

Log:
  Use the correct revision specifier (EXT_CSD revision rather than
  system specification version) for deciding whether the EXT_CSD
  register includes the EXT_CSD_GEN_CMD6_TIME field.
  
  Submitted by: Masanobu SAITOH

Modified:
  head/sys/dev/mmc/mmc.c

Modified: head/sys/dev/mmc/mmc.c
==
--- head/sys/dev/mmc/mmc.c  Sat Jan 13 17:25:48 2018(r327928)
+++ head/sys/dev/mmc/mmc.c  Sat Jan 13 17:36:11 2018(r327929)
@@ -1868,7 +1868,7 @@ mmc_discover_cards(struct mmc_softc *sc)
 * units of 10 ms), defaulting to 500 ms.
 */
ivar->cmd6_time = 500 * 1000;
-   if (ivar->csd.spec_vers >= 6)
+   if (ivar->raw_ext_csd[EXT_CSD_REV] >= 6)
ivar->cmd6_time = 10 *
ivar->raw_ext_csd[EXT_CSD_GEN_CMD6_TIME];
/* Handle HC erase sector size. */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r327928 - head/sys/powerpc/mpc85xx

2018-01-13 Thread Justin Hibbits
Author: jhibbits
Date: Sat Jan 13 17:25:48 2018
New Revision: 327928
URL: https://svnweb.freebsd.org/changeset/base/327928

Log:
  Add SPDX identifier to header
  
  Reported by:  pfg

Modified:
  head/sys/powerpc/mpc85xx/mpc85xx_cache.c

Modified: head/sys/powerpc/mpc85xx/mpc85xx_cache.c
==
--- head/sys/powerpc/mpc85xx/mpc85xx_cache.cSat Jan 13 17:21:45 2018
(r327927)
+++ head/sys/powerpc/mpc85xx/mpc85xx_cache.cSat Jan 13 17:25:48 2018
(r327928)
@@ -1,4 +1,6 @@
 /*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
  * Copyright (c) 2018 Justin Hibbits
  * All rights reserved.
  *
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r319971 - in head: contrib/jemalloc contrib/jemalloc/doc contrib/jemalloc/include/jemalloc contrib/jemalloc/include/jemalloc/internal contrib/jemalloc/src include lib/libc/stdlib/jemal

2018-01-13 Thread Alexey Dokuchaev
On Thu, Jun 15, 2017 at 07:15:06AM +, Jason Evans wrote:
> New Revision: 319971
> URL: https://svnweb.freebsd.org/changeset/base/319971
> 
> Log:
>   Update jemalloc to 5.0.0.

I've finally bisected the problem of `games/quake2lnx' failing to start
(hanging) in GLX mode down to this commit.  Reverting it and making "all
install" under `/usr/src/lib/libc' restores correct operation.

If I run it as ``env LD_PRELOAD=/lib/libthr.so.3 quake2 ...'' it starts
normally.  Do you have any ideas what might have broken it?  Is this a
problem with how the Quake2 binary is linked, or with jemalloc?

To reproduce:

  $ cd /usr/ports/games/quake2lnx && make all install
  $ quake2 +set vid_ref glx

(I'd appreciate if you could build/install `games/quake2lnx', it is
straightforward and fast, and does not require any commercial data
files.  Thanks.)

./danfe
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r327926 - head/sys/dev/mmc

2018-01-13 Thread Marius Strobl
Author: marius
Date: Sat Jan 13 16:32:09 2018
New Revision: 327926
URL: https://svnweb.freebsd.org/changeset/base/327926

Log:
  Fix a bug introduced in r327355; in mmcsd_ioctl_cmd() when ensuring
  that userland doesn't switch partitions on its own, compare against
  the partition mmcsd_ioctl_cmd() is going to switch to (based on the
  device node used) rather than the currently selected partition.

Modified:
  head/sys/dev/mmc/mmcsd.c

Modified: head/sys/dev/mmc/mmcsd.c
==
--- head/sys/dev/mmc/mmcsd.cSat Jan 13 16:31:07 2018(r327925)
+++ head/sys/dev/mmc/mmcsd.cSat Jan 13 16:32:09 2018(r327926)
@@ -920,7 +920,7 @@ mmcsd_ioctl_cmd(struct mmcsd_part *part, struct mmc_io
 */
if (cmd.opcode == MMC_SWITCH_FUNC && dp != NULL &&
(((uint8_t *)dp)[EXT_CSD_PART_CONFIG] &
-   EXT_CSD_PART_CONFIG_ACC_MASK) != sc->part_curr) {
+   EXT_CSD_PART_CONFIG_ACC_MASK) != part->type) {
err = EINVAL;
goto out;
}
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r327925 - head/sys/dev/wbwd

2018-01-13 Thread Alexander Motin
Author: mav
Date: Sat Jan 13 16:31:07 2018
New Revision: 327925
URL: https://svnweb.freebsd.org/changeset/base/327925

Log:
  Add IDs for Nuvoton NCT6793/NCT6795.
  
  MFC after:2 weeks

Modified:
  head/sys/dev/wbwd/wbwd.c

Modified: head/sys/dev/wbwd/wbwd.c
==
--- head/sys/dev/wbwd/wbwd.cSat Jan 13 16:21:13 2018(r327924)
+++ head/sys/dev/wbwd/wbwd.cSat Jan 13 16:31:07 2018(r327925)
@@ -97,7 +97,7 @@ __FBSDID("$FreeBSD$");
 enum chips { w83627hf, w83627s, w83697hf, w83697ug, w83637hf, w83627thf,
 w83687thf, w83627ehf, w83627dhg, w83627uhg, w83667hg,
 w83627dhg_p, w83667hg_b, nct6775, nct6776, nct6779, nct6791,
-nct6792, nct6102 };
+nct6792, nct6793, nct6795, nct6102 };
 
 struct wb_softc {
device_tdev;
@@ -252,6 +252,16 @@ struct winbond_vendor_device_id {
.chip   = nct6792,
.descr  = "Nuvoton NCT6792",
},
+   {
+   .device_id  = 0xd1,
+   .chip   = nct6793,
+   .descr  = "Nuvoton NCT6793",
+   },
+   {
+   .device_id  = 0xd3,
+   .chip   = nct6795,
+   .descr  = "Nuvoton NCT6795",
+   },
 };
 
 static void
@@ -810,6 +820,8 @@ wb_attach(device_t dev)
case nct6779:
case nct6791:
case nct6792:
+   case nct6793:
+   case nct6795:
case nct6102:
/*
 * These chips have a fixed WDTO# output pin (W83627UHG),
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r327924 - head/sys/dev/sdhci

2018-01-13 Thread Marius Strobl
Author: marius
Date: Sat Jan 13 16:21:13 2018
New Revision: 327924
URL: https://svnweb.freebsd.org/changeset/base/327924

Log:
  Fix a bug introduced in r327339; at the point in time re-tuning is
  executed, the interrupt aggregation code might have disabled the
  SDHCI_INT_DMA_END and/or SDHCI_INT_RESPONSE bits in slot->intmask
  and the SDHCI_SIGNAL_ENABLE register respectively. So when restoring
  the interrupt masks based on the previous contents of slot->intmask
  in sdhci_exec_tuning(), ensure that the SDHCI_INT_ENABLE register
  doesn't lose these two bits.
  While at it and in the spirit of r327339, let sdhci_tuning_intmask()
  set the tuning error and re-tuning interrupt bits based on the
  SDHCI_TUNING_ENABLED rather than the SDHCI_TUNING_SUPPORTED flag
  being set, i. e. only when (re-)tuning is actually used. Currently,
  this changes makes no net difference, though.

Modified:
  head/sys/dev/sdhci/sdhci.c

Modified: head/sys/dev/sdhci/sdhci.c
==
--- head/sys/dev/sdhci/sdhci.c  Sat Jan 13 14:14:50 2018(r327923)
+++ head/sys/dev/sdhci/sdhci.c  Sat Jan 13 16:21:13 2018(r327924)
@@ -273,7 +273,7 @@ sdhci_tuning_intmask(struct sdhci_slot *slot)
uint32_t intmask;
 
intmask = 0;
-   if (slot->opt & SDHCI_TUNING_SUPPORTED) {
+   if (slot->opt & SDHCI_TUNING_ENABLED) {
intmask |= SDHCI_INT_TUNEERR;
if (slot->retune_mode == SDHCI_RETUNE_MODE_2 ||
slot->retune_mode == SDHCI_RETUNE_MODE_3)
@@ -1439,9 +1439,17 @@ sdhci_exec_tuning(struct sdhci_slot *slot, bool reset)
DELAY(1000);
}
 
+   /*
+* Restore DMA usage and interrupts.
+* Note that the interrupt aggregation code might have cleared
+* SDHCI_INT_DMA_END and/or SDHCI_INT_RESPONSE in slot->intmask
+* and SDHCI_SIGNAL_ENABLE respectively so ensure SDHCI_INT_ENABLE
+* doesn't lose these.
+*/
slot->opt = opt;
slot->intmask = intmask;
-   WR4(slot, SDHCI_INT_ENABLE, intmask);
+   WR4(slot, SDHCI_INT_ENABLE, intmask | SDHCI_INT_DMA_END |
+   SDHCI_INT_RESPONSE);
WR4(slot, SDHCI_SIGNAL_ENABLE, intmask);
 
if ((hostctrl2 & (SDHCI_CTRL2_EXEC_TUNING |
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r327906 - in head/sys: conf powerpc/mpc85xx

2018-01-13 Thread Pedro Giffuni

...


On 13/01/2018 10:33, Justin Hibbits wrote:



On Jan 13, 2018 09:04, "Pedro Giffuni" > wrote:




On 12/01/2018 20:36, Justin Hibbits wrote:

Author: jhibbits
Date: Sat Jan 13 01:36:37 2018
New Revision: 327906
URL: https://svnweb.freebsd.org/changeset/base/327906

...


Added: head/sys/powerpc/mpc85xx/mpc85xx_cache.c

==
--- /dev/null   00:00:00 1970   (empty, because file is newly
added)
+++ head/sys/powerpc/mpc85xx/mpc85xx_cache.c Sat Jan 13
01:36:37 2018        (r327906)
@@ -0,0 +1,129 @@
+/*-
+ * Copyright (c) 2018 Justin Hibbits
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * $FreeBSD$
+ */
+


Can we please add SPDX ID tags, specially on new code?
I had them added to the guidelines:


https://www.freebsd.org/doc/en_US.ISO8859-1/articles/committers-guide/pref-license.html



It is just not fun for me anymore to go hunting for untagged files
and they keep appearing ;).

Pedro.


D'oh, sorry. I had used an existing boilerplate template I have lying 
around that didn't have the SPDX tags. I'll update and fix this.



It's OK, no hurry.

Pedro.

___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r327906 - in head/sys: conf powerpc/mpc85xx

2018-01-13 Thread Justin Hibbits
On Jan 13, 2018 09:04, "Pedro Giffuni"  wrote:



On 12/01/2018 20:36, Justin Hibbits wrote:

> Author: jhibbits
> Date: Sat Jan 13 01:36:37 2018
> New Revision: 327906
> URL: https://svnweb.freebsd.org/changeset/base/327906
> ...
>
>
> Added: head/sys/powerpc/mpc85xx/mpc85xx_cache.c
> 
> ==
> --- /dev/null   00:00:00 1970   (empty, because file is newly added)
> +++ head/sys/powerpc/mpc85xx/mpc85xx_cache.cSat Jan 13 01:36:37 2018
>   (r327906)
> @@ -0,0 +1,129 @@
> +/*-
> + * Copyright (c) 2018 Justin Hibbits
> + * All rights reserved.
> + *
> + * 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.
> + *
> + * $FreeBSD$
> + */
> +
>

Can we please add SPDX ID tags, specially on new code?
I had them added to the guidelines:

https://www.freebsd.org/doc/en_US.ISO8859-1/articles/committ
ers-guide/pref-license.html

It is just not fun for me anymore to go hunting for untagged files and they
keep appearing ;).

Pedro.


D'oh, sorry. I had used an existing boilerplate template I have lying
around that didn't have the SPDX tags. I'll update and fix this.

- Justin
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r327906 - in head/sys: conf powerpc/mpc85xx

2018-01-13 Thread Pedro Giffuni



On 12/01/2018 20:36, Justin Hibbits wrote:

Author: jhibbits
Date: Sat Jan 13 01:36:37 2018
New Revision: 327906
URL: https://svnweb.freebsd.org/changeset/base/327906
...

Added: head/sys/powerpc/mpc85xx/mpc85xx_cache.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/powerpc/mpc85xx/mpc85xx_cache.cSat Jan 13 01:36:37 2018
(r327906)
@@ -0,0 +1,129 @@
+/*-
+ * Copyright (c) 2018 Justin Hibbits
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * $FreeBSD$
+ */
+


Can we please add SPDX ID tags, specially on new code?
I had them added to the guidelines:

https://www.freebsd.org/doc/en_US.ISO8859-1/articles/committers-guide/pref-license.html

It is just not fun for me anymore to go hunting for untagged files and 
they keep appearing ;).


Pedro.







+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+/*
+ * From the P1022 manual, sequence for writing to L2CTL is:
+ * - mbar
+ * - isync
+ * - write
+ * - read
+ * - mbar
+ */
+#defineL2_CTL  0x0
+#define  L2CTL_L2E   0x8000
+#define  L2CTL_L2I   0x4000
+struct mpc85xx_cache_softc {
+   struct resource *sc_mem;
+};
+
+static int
+mpc85xx_cache_probe(device_t dev)
+{
+
+   if (!ofw_bus_is_compatible(dev, "cache"))
+   return (ENXIO);
+
+   device_set_desc(dev, "MPC85xx L2 cache");
+   return (0);
+}
+
+static int
+mpc85xx_cache_attach(device_t dev)
+{
+   struct mpc85xx_cache_softc *sc = device_get_softc(dev);
+   int rid;
+   int cache_line_size, cache_size;
+
+   /* Map registers. */
+   rid = 0;
+   sc->sc_mem = bus_alloc_resource_any(dev,
+SYS_RES_MEMORY, , RF_ACTIVE);
+   if (sc->sc_mem == NULL)
+   return (ENOMEM);
+
+   /* Enable cache and flash invalidate. */
+   __asm __volatile ("mbar; isync" ::: "memory");
+   bus_write_4(sc->sc_mem, L2_CTL, L2CTL_L2E | L2CTL_L2I);
+   bus_read_4(sc->sc_mem, L2_CTL);
+   __asm __volatile ("mbar" ::: "memory");
+
+   cache_line_size = 0;
+   cache_size = 0;
+   OF_getencprop(ofw_bus_get_node(dev), "cache-size", _size,
+   sizeof(cache_size));
+   OF_getencprop(ofw_bus_get_node(dev), "cache-line-size",
+   _line_size, sizeof(cache_line_size));
+
+   if (cache_line_size != 0 && cache_size != 0)
+   device_printf(dev,
+   "L2 cache size: %dKB, cache line size: %d bytes\n",
+   cache_size / 1024, cache_line_size);
+
+   return (0);
+}
+
+static device_method_t mpc85xx_cache_methods[] = {
+   /* device methods */
+   DEVMETHOD(device_probe, mpc85xx_cache_probe),
+   DEVMETHOD(device_attach,mpc85xx_cache_attach),
+
+   DEVMETHOD_END
+};
+
+static driver_t mpc85xx_cache_driver = {
+   "cache",
+   mpc85xx_cache_methods,
+   sizeof(struct mpc85xx_cache_softc),
+};
+static devclass_t mpc85xx_cache_devclass;
+
+EARLY_DRIVER_MODULE(mpc85xx_cache, simplebus, mpc85xx_cache_driver,
+mpc85xx_cache_devclass, NULL, NULL,
+BUS_PASS_RESOURCE + BUS_PASS_ORDER_MIDDLE);



___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r327922 - head/sys/dev/mmc/host

2018-01-13 Thread Emmanuel Vadot
Author: manu
Date: Sat Jan 13 14:10:45 2018
New Revision: 327922
URL: https://svnweb.freebsd.org/changeset/base/327922

Log:
  dwmmc_hisi: Fix build when option MMCCAM is defined

Modified:
  head/sys/dev/mmc/host/dwmmc_hisi.c

Modified: head/sys/dev/mmc/host/dwmmc_hisi.c
==
--- head/sys/dev/mmc/host/dwmmc_hisi.c  Sat Jan 13 14:10:45 2018
(r327921)
+++ head/sys/dev/mmc/host/dwmmc_hisi.c  Sat Jan 13 14:10:45 2018
(r327922)
@@ -41,6 +41,8 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
+#include "opt_mmccam.h"
+
 static device_probe_t hisi_dwmmc_probe;
 static device_attach_t hisi_dwmmc_attach;
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r327921 - head/usr.bin/truss

2018-01-13 Thread Michael Tuexen
Author: tuexen
Date: Sat Jan 13 14:10:45 2018
New Revision: 327921
URL: https://svnweb.freebsd.org/changeset/base/327921

Log:
  Fix a typo introduced in r327919.

Modified:
  head/usr.bin/truss/syscalls.c

Modified: head/usr.bin/truss/syscalls.c
==
--- head/usr.bin/truss/syscalls.c   Sat Jan 13 14:10:05 2018
(r327920)
+++ head/usr.bin/truss/syscalls.c   Sat Jan 13 14:10:45 2018
(r327921)
@@ -2143,7 +2143,7 @@ print_arg(struct syscall_args *sc, unsigned long *args
fprintf(fp, "0x%lx", args[sc->offset]);
break;
}
-#define IOV_LIMIT 26
+#define IOV_LIMIT 16
case Iovec: {
/*
 * Print argument as an array of struct iovec, where the next
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r327919 - head/usr.bin/truss

2018-01-13 Thread Michael Tuexen
Author: tuexen
Date: Sat Jan 13 13:59:35 2018
New Revision: 327919
URL: https://svnweb.freebsd.org/changeset/base/327919

Log:
  Add support for readv() and writev() to truss.
  
  Sponsored by: Netflix, Inc.

Modified:
  head/usr.bin/truss/syscall.h
  head/usr.bin/truss/syscalls.c

Modified: head/usr.bin/truss/syscall.h
==
--- head/usr.bin/truss/syscall.hSat Jan 13 13:53:05 2018
(r327918)
+++ head/usr.bin/truss/syscall.hSat Jan 13 13:59:35 2018
(r327919)
@@ -82,7 +82,7 @@ enum Argtype { None = 1, Hex, Octal, Int, UInt, LongHe
Sockoptname, Msgflags, CapRights, PUInt, PQuadHex, Acltype,
Extattrnamespace, Minherit, Mlockall, Mountflags, Msync, Priowhich,
Ptraceop, Quotactlcmd, Reboothowto, Rtpriofunc, Schedpolicy, Schedparam,
-   PSig, Siginfo, Kevent11,
+   PSig, Siginfo, Kevent11, Iovec,
 
CloudABIAdvice, CloudABIClockID, ClouduABIFDSFlags,
CloudABIFDStat, CloudABIFileStat, CloudABIFileType,

Modified: head/usr.bin/truss/syscalls.c
==
--- head/usr.bin/truss/syscalls.c   Sat Jan 13 13:53:05 2018
(r327918)
+++ head/usr.bin/truss/syscalls.c   Sat Jan 13 13:59:35 2018
(r327919)
@@ -386,6 +386,8 @@ static struct syscall decoded_syscalls[] = {
  .args = { { Name, 0 }, { Quotactlcmd, 1 }, { Int, 2 }, { Ptr, 3 } } },
{ .name = "read", .ret_type = 1, .nargs = 3,
  .args = { { Int, 0 }, { BinString | OUT, 1 }, { Sizet, 2 } } },
+   { .name = "readv", .ret_type = 1, .nargs = 3,
+ .args = { { Int, 0 }, { Iovec, 1 }, { Int, 2 } } },
{ .name = "readlink", .ret_type = 1, .nargs = 3,
  .args = { { Name, 0 }, { Readlinkres | OUT, 1 }, { Sizet, 2 } } },
{ .name = "readlinkat", .ret_type = 1, .nargs = 4,
@@ -520,6 +522,8 @@ static struct syscall decoded_syscalls[] = {
{ Siginfo | OUT, 5 } } },
{ .name = "write", .ret_type = 1, .nargs = 3,
  .args = { { Int, 0 }, { BinString | IN, 1 }, { Sizet, 2 } } },
+   { .name = "writev", .ret_type = 1, .nargs = 3,
+ .args = { { Int, 0 }, { Iovec, 1 }, { Int, 2 } } },
 
/* Linux ABI */
{ .name = "linux_access", .ret_type = 1, .nargs = 2,
@@ -2137,6 +2141,68 @@ print_arg(struct syscall_args *sc, unsigned long *args
fprintf(fp, " }");
} else
fprintf(fp, "0x%lx", args[sc->offset]);
+   break;
+   }
+#define IOV_LIMIT 26
+   case Iovec: {
+   /*
+* Print argument as an array of struct iovec, where the next
+* syscall argument is the number of elements of the array.
+*/
+   struct iovec iov[IOV_LIMIT];
+   size_t max_string = trussinfo->strsize;
+   char tmp2[max_string + 1], *tmp3;
+   size_t len;
+   int i, iovcnt;
+   bool buf_truncated, iov_truncated;
+
+   iovcnt = args[sc->offset + 1];
+   if (iovcnt <= 0) {
+   fprintf(fp, "0x%lx", args[sc->offset]);
+   break;
+   }
+   if (iovcnt > IOV_LIMIT) {
+   iovcnt = IOV_LIMIT;
+   iov_truncated = true;
+   } else {
+   iov_truncated = false;
+   }
+   if (get_struct(pid, (void *)args[sc->offset],
+   , iovcnt * sizeof(struct iovec)) == -1) {
+   fprintf(fp, "0x%lx", args[sc->offset]);
+   break;
+   }
+
+   fprintf(fp, "%s", "[");
+   for (i = 0; i < iovcnt; i++) {
+   len = iov[i].iov_len;
+   if (len > max_string) {
+   len = max_string;
+   buf_truncated = true;
+   } else {
+   buf_truncated = false;
+   }
+   fprintf(fp, "%s{", (i > 0) ? "," : "");
+   if (len && get_struct(pid, iov[i].iov_base, , len)
+   != -1) {
+   tmp3 = malloc(len * 4 + 1);
+   while (len) {
+   if (strvisx(tmp3, tmp2, len,
+   VIS_CSTYLE|VIS_TAB|VIS_NL) <=
+   (int)max_string)
+   break;
+   len--;
+   buf_truncated = true;
+   }
+   fprintf(fp, "\"%s\"%s", tmp3,
+   buf_truncated ? "..." : "");
+

Re: svn commit: r327774 - in head: . sys/i386/bios

2018-01-13 Thread Bruce Evans

On Wed, 10 Jan 2018, Warner Losh wrote:


Log:
 inittodr(0) actually sets the time, so there's no need to call
 tc_setclock(). It's redundant. Tweak UPDATING based on code review of
 past releases.


No, tc_setclock() is not redundant (except for bugs).  initodr(0) sets
a raw RTC time (plus a racy timezone offset).  tc_setclock() is supposed to
fix this up to a less raw time using calculations done at suspend time.
The calculations are still done, so are even more bogus then when the
fixup was null under FIXME (then the FIXME a least indicated what
needed to be done).


Modified: head/UPDATING
==
--- head/UPDATING   Wed Jan 10 16:56:02 2018(r327773)
+++ head/UPDATING   Wed Jan 10 17:25:08 2018(r327774)
@@ -53,8 +53,9 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW:

20180110:
On i386, pmtimer has been removed. It's functionality has been folded
-   into apm. It was a nop on ACPI. Users may need to remove it from kernel
-   config files.
+   into apm. It was a nop on ACPI in current for a while now (but was still
+   needed on i386 in FreeBSD 11 and earlier). Users may need to remove it
+   from kernel config files.


It is indeed still needed in FreeBSD-11.  acpci resume is still broken there
on all arches except amd64, by bogusly ifdefing acpi_resync_clock() to do
nothing except on amd64 (and even on amd64, there is a sysctl to give the
same brokenness).

pmtimer was made a no-op if acpi is configured in the same commit that fixed
acpi resume.


Modified: head/sys/i386/bios/apm.c
==
--- head/sys/i386/bios/apm.cWed Jan 10 16:56:02 2018(r327773)
+++ head/sys/i386/bios/apm.cWed Jan 10 17:25:08 2018(r327774)
@@ -1086,7 +1086,6 @@ apm_rtc_resume(void *arg __unused)
{
u_int second, minute, hour;
struct timeval resume_time, tmp_time;
-   struct timespec ts;

/* modified for adjkerntz */
timer_restore();/* restore the all timers */
@@ -1097,14 +1096,11 @@ apm_rtc_resume(void *arg __unused)
/* Calculate the delta time suspended */
timevalsub(_time, _time);

-   second = ts.tv_sec = resume_time.tv_sec;
-   ts.tv_nsec = 0;
-   tc_setclock();
-


The carefully calculated tmp_time is no longer used.  It wasn't used before
either, since ts was initialized to a wrong value.  tmp_time was last used
under FIXME, but that shouldn't have compiled either since FIXME was
undefineable -- tmp_time as a write-only auto variable in all cases.
The non-use of some of the other timestamp variables is harder to detect
since they are static.

tc_setclock() takes a delta-time as an arg.  resume_time is already a
delta-time, but I think it is complete garbage.  resume_time was initially
actually the resume time, but is abused to hole the suspension interval
(delta-time).  inittodr(0) already advanced the timecounter by approximately
the suspension interval, and inittodr() gives a garbage time by advancing
by this again.

I think the correct second advance is simply diff_time which was calculated
earlier.  The dead tmp_time is  + diff_time.  This was
only used in the unreachable FIXME code because the "API" for that needed an
absolute time.

Untested fixes:

X Index: apm.c
X ===
X --- apm.c (revision 327911)
X +++ apm.c (working copy)
X @@ -1067,17 +1067,17 @@
X   } while (apm_event != PMEV_NOEVENT);
X  }
X 
X -static struct timeval suspend_time;

X -static struct timeval diff_time;
X +static struct timespec diff_time;
X +static struct timespec suspend_time;
X 
X  static int

X  apm_rtc_suspend(void *arg __unused)
X  {
X 
X -	microtime(_time);

X - inittodr(0);
X - microtime(_time);
X - timevalsub(_time, _time);
X + nanotime(_time);   /* not a difference yet */
X + inittodr(0);/* set tc to raw time seen by RTC */
X + nanotime(_time);/* record this raw time */
X + timespecsub(_time, _time); /* diff between tc and RTC */
X   return (0);
X  }
X 
X @@ -1084,23 +1084,22 @@

X  static int
X  apm_rtc_resume(void *arg __unused)
X  {
X + struct timespec resume_time, suspend_interval;
X   u_int second, minute, hour;

This already changes too much, so I didn't fix blind truncation of tv_sec
starting in 2038 or other type botches for second/minute/hour.

X - struct timeval resume_time, tmp_time;
X 
X -	/* modified for adjkerntz */

X - timer_restore();/* restore the all timers */
X - inittodr(0);/* adjust time to RTC */
X - microtime(_time);
X - getmicrotime(_time);
X - timevaladd(_time, _time);
X + timer_restore();
X + inittodr(0);/* set tc to new raw RTC time */
X + nanotime(_time); /* 

Re: svn commit: r327767 - in head/sys: conf i386/bios i386/conf i386/isa

2018-01-13 Thread Bruce Evans

On Wed, 10 Jan 2018, Warner Losh wrote:


Log:
 Retire pmtimer driver. Move time fixing into apm driver. Move
 Iwasaki-san's copyright over. Remove FIXME code that couldn't possibly
 work. Call tc_settime() with our estimate of the delta we've been
 alseep (the one we print) to adjust the time. Not sure what to do
 about callouts, so keep the small #ifdef in place there.


The FIXME code might have worked before timecounters, but never worked in
any committed version.  You seem to have updated it correctly for
timecounters in this commit, but then broke it by removing it in a later
commit (see another reply).

This commit obfuscates the fix by combining moving of the file with changing
it.  svn is also very broken -- it doesn't show history of the file under
its old name.  This is more broken than usual -- since the file was merged
into a different file, svn doesn't show history of the file under its new
name either.

The callout fixup code is more broken.  It never compiled in any committed
version, since it uses data structures and logic that went away before it
was committed.  The option for it (APM_FIXUP_CALLTODO) is so broken that it
is not a supported option or in LINT, so it is not normally noticed that
the code under it never compiled.

Long callouts are especially broken.  E.g., nanosleep(1 hour) at least
used to sleep for 2 hours if the system is suspended for 1 hour during
the sleep.  I haven't noticed any fixes for this.  Callouts mostly use
relative timeouts, and relative timeouts just don't work across suspensions.

Actually, I have noticed some fixes for nanosleep().  Another bug in it
was that it is specified to sleep in the time specified by the clock id
CLOCK_REALTIME, but used to sleep in the time specified by the clock id
CLOCK_MONOTONIC (the latter should be as close as possible to the former
except for leap seconds adjustments, but is quite broken -- it doesn't
count suspended time, and non-leap seconds settings of CLOCK_REALTIME
also make CLOCK_MONOTONIC useless for determining physical time differences.
nanosleep() now sleeps on the correct clock id, and clock_nanosleep() is
now implemented.  This is complicated, and I haven't checked if the fix
works.  It looks to simple to work.  To work, it needs to do things like
adjust timers whenever the timecounter jumps (mainly for resume and leap
seconds adjustments).  APM_FIXUP_CALLTODO only tries to handle the easier
case of resume.


Modified: head/sys/conf/files.i386
==
--- head/sys/conf/files.i386Wed Jan 10 14:58:58 2018(r327766)
+++ head/sys/conf/files.i386Wed Jan 10 14:59:19 2018(r327767)
@@ -520,7 +520,6 @@ i386/ibcs2/ibcs2_util.c optional ibcs2
i386/ibcs2/ibcs2_xenix.coptional ibcs2
i386/ibcs2/ibcs2_xenix_sysent.c optional ibcs2
i386/ibcs2/imgact_coff.coptional ibcs2
-i386/isa/pmtimer.c optional pmtimer
i386/isa/prof_machdep.c optional profiling-routine
i386/linux/imgact_linux.c   optional compat_linux
i386/linux/linux_dummy.coptional compat_linux


pmtimer used to be needed all systems with acpi except amd64, because the
acpi fixup of timecounters was bogusly ifdefed for amd64 only (or was not
done by acpi in very old versions?).

The pmtimer code for this fixup is still better tha the acpi code, except
the FIXME made it unused and the next commit dumbs it down to worse than
the acpi code (the acpi code is at least simpler).


Modified: head/sys/i386/bios/apm.c
==
--- head/sys/i386/bios/apm.cWed Jan 10 14:58:58 2018(r327766)
+++ head/sys/i386/bios/apm.cWed Jan 10 14:59:19 2018(r327767)
Modified: head/sys/i386/bios/apm.c
==
--- head/sys/i386/bios/apm.cWed Jan 10 14:58:58 2018(r327766)
+++ head/sys/i386/bios/apm.cWed Jan 10 14:59:19 2018(r327767)
@@ -205,7 +232,7 @@ static int
apm_driver_version(int version)
{
struct apm_softc *sc = _softc;
-
+
sc->bios.r.eax = (APM_BIOS << 8) | APM_DRVVERSION;
sc->bios.r.ebx  = 0x0;
sc->bios.r.ecx  = version;


Unrelated style fixes make the important changes harder to see.  This
patch was to remove trailing whitespace, but some mail program broke it
by removing the whitespace in the source lines.

[... further mangled patches for whitespace not shown]


@@ -331,12 +358,10 @@ apm_battery_low(void)
static struct apmhook *
apm_add_hook(struct apmhook **list, struct apmhook *ah)
{
-   int s;
struct apmhook *p, *prev;

APM_DPRINT("Add hook \"%s\"\n", ah->ah_name);

-   s = splhigh();
if (ah == NULL)
panic("illegal apm_hook!");
prev = NULL;
@@ -351,30 +376,25 @@ apm_add_hook(struct apmhook **list, struct apmhook *ah
ah->ah_next = prev->ah_next;
  

svn commit: r327917 - head/sys/kern

2018-01-13 Thread Konstantin Belousov
Author: kib
Date: Sat Jan 13 11:59:49 2018
New Revision: 327917
URL: https://svnweb.freebsd.org/changeset/base/327917

Log:
  Add sysctl debug.kdb.stack_overflow to conveniently test kernel
  handling of the kstack overflow.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/kern/subr_kdb.c

Modified: head/sys/kern/subr_kdb.c
==
--- head/sys/kern/subr_kdb.cSat Jan 13 09:30:34 2018(r327916)
+++ head/sys/kern/subr_kdb.cSat Jan 13 11:59:49 2018(r327917)
@@ -85,6 +85,7 @@ static int kdb_sysctl_enter(SYSCTL_HANDLER_ARGS);
 static int kdb_sysctl_panic(SYSCTL_HANDLER_ARGS);
 static int kdb_sysctl_trap(SYSCTL_HANDLER_ARGS);
 static int kdb_sysctl_trap_code(SYSCTL_HANDLER_ARGS);
+static int kdb_sysctl_stack_overflow(SYSCTL_HANDLER_ARGS);
 
 static SYSCTL_NODE(_debug, OID_AUTO, kdb, CTLFLAG_RW, NULL, "KDB nodes");
 
@@ -110,6 +111,10 @@ SYSCTL_PROC(_debug_kdb, OID_AUTO, trap_code,
 CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_SECURE, NULL, 0,
 kdb_sysctl_trap_code, "I", "set to cause a page fault via code access");
 
+SYSCTL_PROC(_debug_kdb, OID_AUTO, stack_overflow,
+CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_SECURE, NULL, 0,
+kdb_sysctl_stack_overflow, "I", "set to cause a stack overflow");
+
 SYSCTL_INT(_debug_kdb, OID_AUTO, break_to_debugger,
 CTLFLAG_RWTUN | CTLFLAG_SECURE,
 _break_to_debugger, 0, "Enable break to debugger");
@@ -224,6 +229,36 @@ kdb_sysctl_trap_code(SYSCTL_HANDLER_ARGS)
(*fp)(0x, 0x, 0x);
return (0);
 }
+
+static void kdb_stack_overflow(volatile int *x)  __noinline;
+static void
+kdb_stack_overflow(volatile int *x)
+{
+
+   if (*x > 1000)
+   return;
+   kdb_stack_overflow(x);
+   *x += PCPU_GET(cpuid) / 100;
+}
+
+static int
+kdb_sysctl_stack_overflow(SYSCTL_HANDLER_ARGS)
+{
+   int error, i;
+   volatile int x;
+
+   error = sysctl_wire_old_buffer(req, sizeof(int));
+   if (error == 0) {
+   i = 0;
+   error = sysctl_handle_int(oidp, , 0, req);
+   }
+   if (error != 0 || req->newptr == NULL)
+   return (error);
+   x = 0;
+   kdb_stack_overflow();
+   return (0);
+}
+
 
 void
 kdb_panic(const char *msg)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r327914 - head/sys/kern

2018-01-13 Thread Mateusz Guzik
Author: mjg
Date: Sat Jan 13 09:26:24 2018
New Revision: 327914
URL: https://svnweb.freebsd.org/changeset/base/327914

Log:
  sx: retry hard shared unlock just like in r327905 for rwlocks

Modified:
  head/sys/kern/kern_sx.c

Modified: head/sys/kern/kern_sx.c
==
--- head/sys/kern/kern_sx.c Sat Jan 13 08:28:46 2018(r327913)
+++ head/sys/kern/kern_sx.c Sat Jan 13 09:26:24 2018(r327914)
@@ -1193,7 +1193,7 @@ _sx_sunlock_try(struct sx *sx, uintptr_t *xp)
 static void __noinline
 _sx_sunlock_hard(struct sx *sx, uintptr_t x LOCK_FILE_LINE_ARG_DEF)
 {
-   int wakeup_swapper;
+   int wakeup_swapper = 0;
uintptr_t setx;
 
if (SCHEDULER_STOPPED())
@@ -1213,6 +1213,9 @@ _sx_sunlock_hard(struct sx *sx, uintptr_t x LOCK_FILE_
for (;;) {
MPASS(x & SX_LOCK_EXCLUSIVE_WAITERS);
MPASS(!(x & SX_LOCK_SHARED_WAITERS));
+   if (_sx_sunlock_try(sx, ))
+   break;
+
/*
 * Wake up semantic here is quite simple:
 * Just wake up all the exclusive waiters.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r327913 - head/sys/contrib/ipfilter/netinet

2018-01-13 Thread Cy Schubert
Author: cy
Date: Sat Jan 13 08:28:46 2018
New Revision: 327913
URL: https://svnweb.freebsd.org/changeset/base/327913

Log:
  Remove redundant variable.
  
  MFC after:1 week

Modified:
  head/sys/contrib/ipfilter/netinet/radix_ipf.c

Modified: head/sys/contrib/ipfilter/netinet/radix_ipf.c
==
--- head/sys/contrib/ipfilter/netinet/radix_ipf.c   Sat Jan 13 08:16:10 
2018(r327912)
+++ head/sys/contrib/ipfilter/netinet/radix_ipf.c   Sat Jan 13 08:28:46 
2018(r327913)
@@ -103,7 +103,6 @@ buildnodes(addr, mask, nodes)
ipf_rdx_node_t nodes[2];
 {
u_32_t maskbits;
-   u_32_t lastbits;
u_32_t lastmask;
u_32_t *last;
int masklen;
@@ -117,7 +116,6 @@ buildnodes(addr, mask, nodes)
masklen = last - (u_32_t *)mask;
lastmask = *last;
}
-   lastbits = maskbits & 0x1f;
 
bzero([0], sizeof(ipf_rdx_node_t) * 2);
nodes[0].maskbitcount = maskbits;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r327912 - head/sys/contrib/ipfilter/netinet

2018-01-13 Thread Cy Schubert
In message <201801130816.w0d8gafg024...@repo.freebsd.org>, Cy Schubert 
writes:
> Author: cy
> Date: Sat Jan 13 08:16:10 2018
> New Revision: 327912
> URL: https://svnweb.freebsd.org/changeset/base/327912
>
> Log:
>   Though this block of code is not used by FreeBSD, correct a call to
>   sprintf() with a macro call to SNPRINTF similar to other calls to
>   SNPRINTF within this same block.
>   
>   MFC after:  1 week
>
> Modified:
>   head/sys/contrib/ipfilter/netinet/ip_ftp_pxy.c
>
> Modified: head/sys/contrib/ipfilter/netinet/ip_ftp_pxy.c
> =
> =
> --- head/sys/contrib/ipfilter/netinet/ip_ftp_pxy.cSat Jan 13 04:53:04 201
> 8 (r327911)
> +++ head/sys/contrib/ipfilter/netinet/ip_ftp_pxy.cSat Jan 13 08:16:10 201
> 8 (r327912)
> @@ -2136,7 +2136,7 @@ ipf_p_ftp_eprt6(softf, fin, ip, nat, ftp, dlen)
>   SNPRINTF(s, left, "%x:%x", a >> 16, a & 0x);
>   left -= strlen(s);
>   s += strlen(s);
> - sprintf(s, "|%d|\r\n", port);
> + SNPRINTF(s, left, "|%d|\r\n", port);
>  #else
>   (void) sprintf(s, "EPRT %c2%c", delim, delim);
>   s += strlen(s);

Lest anyone fret, sprintf --> snprintf for ipfilter is being worked on and 
is currently stashed in one of my working directories.


-- 
Cheers,
Cy Schubert 
FreeBSD UNIX:     Web:  http://www.FreeBSD.org

The need of the many outweighs the greed of the few.


___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r327912 - head/sys/contrib/ipfilter/netinet

2018-01-13 Thread Cy Schubert
Author: cy
Date: Sat Jan 13 08:16:10 2018
New Revision: 327912
URL: https://svnweb.freebsd.org/changeset/base/327912

Log:
  Though this block of code is not used by FreeBSD, correct a call to
  sprintf() with a macro call to SNPRINTF similar to other calls to
  SNPRINTF within this same block.
  
  MFC after:1 week

Modified:
  head/sys/contrib/ipfilter/netinet/ip_ftp_pxy.c

Modified: head/sys/contrib/ipfilter/netinet/ip_ftp_pxy.c
==
--- head/sys/contrib/ipfilter/netinet/ip_ftp_pxy.c  Sat Jan 13 04:53:04 
2018(r327911)
+++ head/sys/contrib/ipfilter/netinet/ip_ftp_pxy.c  Sat Jan 13 08:16:10 
2018(r327912)
@@ -2136,7 +2136,7 @@ ipf_p_ftp_eprt6(softf, fin, ip, nat, ftp, dlen)
SNPRINTF(s, left, "%x:%x", a >> 16, a & 0x);
left -= strlen(s);
s += strlen(s);
-   sprintf(s, "|%d|\r\n", port);
+   SNPRINTF(s, left, "|%d|\r\n", port);
 #else
(void) sprintf(s, "EPRT %c2%c", delim, delim);
s += strlen(s);
___
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"