Re: svn commit: r347484 - head/sys/kern

2019-05-11 Thread Doug Moore
On 5/11/19 5:52 AM, Bruce Evans wrote:
> On Sat, 11 May 2019, Doug Moore wrote:
>> +#ifdef HAVE_INLINE_FFS
>> +    case sizeof(int):
>> +    return (ffs(mask) - 1);
>> +#endif
>
> This is unreachable, since sizeof(int) is 4 on all supported arches, and
> sizeof(mask) is 8 on all arches.
>
Another FreeBSD developer has expressed to me that sizeof(mask) ought to
become 4 on some 32-bit arches before too long, and I added this case in
anticipation of that.  I see now that I should have waited.

Doug Moore


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


svn commit: r347498 - head/usr.sbin/mountd

2019-05-11 Thread Rick Macklem
Author: rmacklem
Date: Sat May 11 22:41:58 2019
New Revision: 347498
URL: https://svnweb.freebsd.org/changeset/base/347498

Log:
  Factor code into two new functions in preparation for a future commit.
  
  Factor code into two functions.
  read_exportfile() a functon  which reads the exports file(s) and calls
  get_exportlist_one() to process each of them.
  delete_export() a function which deletes the exports in the kernel for a file
  system.
  The contents of these functions is just the same code as was used to do the
  operations, moved into separate functions. As such, there is no semantic 
change.
  This is being done in preparation for a future commit that will add an
  option to do incremental changes of kernel exports upon receiving SIGHUP.
  
  MFC after:1 month

Modified:
  head/usr.sbin/mountd/mountd.c

Modified: head/usr.sbin/mountd/mountd.c
==
--- head/usr.sbin/mountd/mountd.c   Sat May 11 19:31:54 2019
(r347497)
+++ head/usr.sbin/mountd/mountd.c   Sat May 11 22:41:58 2019
(r347498)
@@ -200,6 +200,8 @@ static void free_host(struct hostlist *);
 static voidget_exportlist(void);
 static voidinsert_exports(struct exportlist *, struct exportlisthead *);
 static voidfree_exports(struct exportlisthead *);
+static voidread_exportfile(void);
+static voiddelete_export(struct iovec *, int, struct statfs *, char *);
 static int get_host(char *, struct grouplist *, struct grouplist *);
 static struct hostlist *get_ht(void);
 static int get_line(void);
@@ -1721,12 +1723,10 @@ get_exportlist(void)
struct grouplist *grp, *tgrp;
struct export_args export;
struct iovec *iov;
-   struct statfs *fsp, *mntbufp;
-   struct xvfsconf vfc;
+   struct statfs *mntbufp;
char errmsg[255];
int num, i;
int iovlen;
-   int done;
struct nfsex_args eargs;
 
if (suspend_nfsd != 0)
@@ -1781,48 +1781,9 @@ get_exportlist(void)
build_iovec(, , "errmsg", errmsg, sizeof(errmsg));
}
 
-   for (i = 0; i < num; i++) {
-   fsp = [i];
-   if (getvfsbyname(fsp->f_fstypename, ) != 0) {
-   syslog(LOG_ERR, "getvfsbyname() failed for %s",
-   fsp->f_fstypename);
-   continue;
-   }
+   for (i = 0; i < num; i++)
+   delete_export(iov, iovlen, [i], errmsg);
 
-   /*
-* We do not need to delete "export" flag from
-* filesystems that do not have it set.
-*/
-   if (!(fsp->f_flags & MNT_EXPORTED))
-   continue;
-   /*
-* Do not delete export for network filesystem by
-* passing "export" arg to nmount().
-* It only makes sense to do this for local filesystems.
-*/
-   if (vfc.vfc_flags & VFCF_NETWORK)
-   continue;
-
-   iov[1].iov_base = fsp->f_fstypename;
-   iov[1].iov_len = strlen(fsp->f_fstypename) + 1;
-   iov[3].iov_base = fsp->f_mntonname;
-   iov[3].iov_len = strlen(fsp->f_mntonname) + 1;
-   iov[5].iov_base = fsp->f_mntfromname;
-   iov[5].iov_len = strlen(fsp->f_mntfromname) + 1;
-   errmsg[0] = '\0';
-
-   /*
-* EXDEV is returned when path exists but is not a
-* mount point.  May happens if raced with unmount.
-*/
-   if (nmount(iov, iovlen, fsp->f_flags) < 0 &&
-   errno != ENOENT && errno != ENOTSUP && errno != EXDEV) {
-   syslog(LOG_ERR,
-   "can't delete exports for %s: %m %s",
-   fsp->f_mntonname, errmsg);
-   }
-   }
-
if (iov != NULL) {
/* Free strings allocated by strdup() in getmntopts.c */
free(iov[0].iov_base); /* fstype */
@@ -1837,26 +1798,7 @@ get_exportlist(void)
iovlen = 0;
}
 
-   /*
-* Read in the exports file and build the list, calling
-* nmount() as we go along to push the export rules into the kernel.
-*/
-   done = 0;
-   for (i = 0; exnames[i] != NULL; i++) {
-   if (debug)
-   warnx("reading exports from %s", exnames[i]);
-   if ((exp_file = fopen(exnames[i], "r")) == NULL) {
-   syslog(LOG_WARNING, "can't open %s", exnames[i]);
-   continue;
-   }
-   get_exportlist_one();
-   fclose(exp_file);
-   done++;
-   }
-   if (done == 0) {
-   syslog(LOG_ERR, "can't open any exports file");
-   exit(2);
-   }
+   read_exportfile();
 
/*
 

svn commit: r347497 - head

2019-05-11 Thread Jens Schweikhardt
Author: schweikh
Date: Sat May 11 19:31:54 2019
New Revision: 347497
URL: https://svnweb.freebsd.org/changeset/base/347497

Log:
  Correct a handful of typos.

Modified:
  head/UPDATING

Modified: head/UPDATING
==
--- head/UPDATING   Sat May 11 18:31:05 2019(r347496)
+++ head/UPDATING   Sat May 11 19:31:54 2019(r347497)
@@ -92,7 +92,7 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW:
The fuse(4) module has been renamed to fusefs(4) for consistency with
other filesystems.  You should update any kld_load="fuse" entries in
/etc/rc.conf, fuse_load="YES" entries in /boot/loader.conf, and
-   "options FUSE" enties in kernel config files.
+   "options FUSE" entries in kernel config files.
 
 20190304:
Clang, llvm, lld, lldb, compiler-rt and libc++ have been upgraded to
@@ -156,7 +156,7 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW:
 
 20181211:
Remove the timed and netdate programs from the base tree.  Setting
-   the time with these deamons has been obsolete for over a decade.
+   the time with these daemons has been obsolete for over a decade.
 
 20181126:
On amd64, arm64 and armv7 (architectures that install LLVM's ld.lld
@@ -219,7 +219,7 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW:
 
 20181009:
OpenSSL has been updated to version 1.1.1.  This update included
-   additional various API changes througout the base system.  It is
+   additional various API changes throughout the base system.  It is
important to rebuild third-party software after upgrading.  The value
of __FreeBSD_version has been bumped accordingly.
 
@@ -316,13 +316,13 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW:
 20180719:
ARM64 now have efifb support, if you want to have serial console
on your arm64 board when an screen is connected and the bootloader
-   setup a framebuffer for us to use, just add :
+   setup a frame buffer for us to use, just add :
boot_serial=YES
boot_multicons=YES
in /boot/loader.conf
For Raspberry Pi 3 (RPI) users, this is needed even if you don't have
-   an screen connected as the firmware will setup a framebuffer are that
-   u-boot will expose as an EFI framebuffer.
+   an screen connected as the firmware will setup a frame buffer are that
+   u-boot will expose as an EFI frame buffer.
 
 20180719:
New uid:gid added, ntpd:ntpd (123:123).  Be sure to run mergemaster
@@ -421,7 +421,7 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW:
 
 20180508:
The nxge(4) driver has been removed.  This driver was for PCI-X 10g
-   cards made by s2io/Neterion.  The company was aquired by Exar and
+   cards made by s2io/Neterion.  The company was acquired by Exar and
no longer sells or supports Ethernet products.  If you have device
nxge in your kernel config file it must be removed.
 
@@ -512,7 +512,7 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW:
 20180212:
FreeBSD boot loader enhanced with Lua scripting. It's purely opt-in for
now by building WITH_LOADER_LUA and WITHOUT_FORTH in /etc/src.conf.
-   Co-existance for the transition period will come shortly. Booting is a
+   Co-existence for the transition period will come shortly. Booting is a
complex environment and test coverage for Lua-enabled loaders has been
thin, so it would be prudent to assume it might not work and make
provisions for backup boot methods.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r347477 - head/sys/kern

2019-05-11 Thread Cy Schubert
In message <82d76aafd3c93bc2ad2d0e04a761e2628ff1e257.ca...@freebsd.org>
, Ian Le
pore writes:
> On Fri, 2019-05-10 at 23:57 -0500, Doug Moore wrote:
> > With mentor approval, I commit r347469.  I start getting email about
> > jenkins failure to build for several architectures on account of the
> > _Generic() construct I introduced in that change.
> > 
> > I whip up a patch to undo that part of r347469, and ask for mentor
> > approval.  Meanwhile, mentor authorizes me in email to revert
> > r347469.
> > 
> > I try apply applying the fix-patch, and get email that it was
> > rejected
> > for lack of reviewer.  In retrospect, it seems to have been committed
> > anyway as r347472.
> > 
> > Thinking that things are still broken, I do what my mentor pre-
> > approved
> > earlier and revert back to before r347469.  A patch to redo r347469,
> > without _Generic(), awaits mentor approval.
> > 
> > I realize that breaking the build and then committing without mentor
> > approval in my first week as committer isn't a good beginning.  
> > Sorry
> > about that.
> > 
> > At least I have no social media presence, so there's that.
> > 
> > Doug Moore
> > 
> > 
>
> The important point is that the commit message should have said why. 
> It doesn't have to be a whole novel, just something like "because
> _Generic() isn't supported on all platforms" would've been good.
>
> In general, for every commit, I ask myself "If someone 3 years from now
> is debugging a problem and they're looking at the changes that have
> happened to this code over time, will my commit message be helpful to
> that process?"  Very often in that situation, what the person needs to
> know isn't "what changed" so much as "why did this change happen?"

I totally agree. I am that guy reviewing commits, not just FreeBSD 
commits but those of other open source projects and at $JOB as well. 
Sure, reading the code provides the complete story however when pressed 
for time one must prioritize what to look at first.

Touching on another log message issue, some of the most time consuming 
are other open source project commits which say "pull request from ..." 
which make more than one alteration in the same commit.


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

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


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


svn commit: r347496 - in stable/12/sys/powerpc: fpu include powerpc

2019-05-11 Thread Justin Hibbits
Author: jhibbits
Date: Sat May 11 18:31:05 2019
New Revision: 347496
URL: https://svnweb.freebsd.org/changeset/base/347496

Log:
  MFC r345829, r345831
  
  r345829:
  powerpc: Apply r178139 from sparc64 to powerpc's fpu_sqrt
  
  This fix was committed less than 2 months after the code was forked into the
  powerpc kernel.  Though powerpc doesn't use quad-precision floating point,
  or need it for emulation, the changes do look like correctness fixes
  overall.
  
  This was found while trying to get fsqrt emulation working on e5500, which
  does have a real FPU, but lacks the fsqrt instruction.  This is not the
  complete fix, the rest is to be committed separately.
  
  r345831:
  powerpc: Allow emulating optional FPU instructions on CPUs with an FPU
  
  The e5500 has an FPU, but lacks the optional fsqrt instruction.  This
  instruction gets emulated in the kernel, but the emulation uses stale data,
  from the last switch out, and does not return the result of the operation
  immediately.  Fix both of these conditions by saving and restoring the FPRs
  around the emulation point.

Modified:
  stable/12/sys/powerpc/fpu/fpu_sqrt.c
  stable/12/sys/powerpc/include/trap.h
  stable/12/sys/powerpc/powerpc/exec_machdep.c
  stable/12/sys/powerpc/powerpc/trap.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/powerpc/fpu/fpu_sqrt.c
==
--- stable/12/sys/powerpc/fpu/fpu_sqrt.cSat May 11 18:25:15 2019
(r347495)
+++ stable/12/sys/powerpc/fpu/fpu_sqrt.cSat May 11 18:31:05 2019
(r347496)
@@ -353,7 +353,7 @@ fpu_sqrt(struct fpemu *fe)
FPU_SUBC(d0, x0, t0);
if ((int)d0 >= 0) {
x0 = d0, x1 = d1, x2 = d2;
-   q |= bit;
+   q = bit;
y1 |= 1;/* now t1, y1 are set in concrete */
}
ODD_DOUBLE;
@@ -385,12 +385,12 @@ fpu_sqrt(struct fpemu *fe)
FPU_SUBCS(d2, x2, t2);
FPU_SUBCS(d1, x1, t1);
FPU_SUBC(d0, x0, t0);
-   ODD_DOUBLE;
if ((int)d0 >= 0) {
-   x0 = d0, x1 = d1, x2 = d2;
-   q |= bit;
+   x0 = d0, x1 = d1, x2 = d2; x3 = d3;
+   q = bit;
y2 |= 1;
}
+   ODD_DOUBLE;
while ((bit >>= 1) != 0) {
EVEN_DOUBLE;
t3 = y3 | bit;
@@ -399,7 +399,7 @@ fpu_sqrt(struct fpemu *fe)
FPU_SUBCS(d1, x1, t1);
FPU_SUBC(d0, x0, t0);
if ((int)d0 >= 0) {
-   x0 = d0, x1 = d1, x2 = d2;
+   x0 = d0, x1 = d1, x2 = d2; x3 = d3;
q |= bit;
y3 |= bit << 1;
}

Modified: stable/12/sys/powerpc/include/trap.h
==
--- stable/12/sys/powerpc/include/trap.hSat May 11 18:25:15 2019
(r347495)
+++ stable/12/sys/powerpc/include/trap.hSat May 11 18:31:05 2019
(r347496)
@@ -149,10 +149,10 @@
 
 #ifndef LOCORE
 struct trapframe;
-struct pcb;
+struct thread;
 extern int (*hmi_handler)(struct trapframe *);
 voidtrap(struct trapframe *);
-intppc_instr_emulate(struct trapframe *, struct pcb *);
+intppc_instr_emulate(struct trapframe *, struct thread *);
 #endif
 
 #endif /* _POWERPC_TRAP_H_ */

Modified: stable/12/sys/powerpc/powerpc/exec_machdep.c
==
--- stable/12/sys/powerpc/powerpc/exec_machdep.cSat May 11 18:25:15 
2019(r347495)
+++ stable/12/sys/powerpc/powerpc/exec_machdep.cSat May 11 18:31:05 
2019(r347496)
@@ -1066,8 +1066,9 @@ emulate_mtspr(int spr, int reg, struct trapframe *fram
 
 #define XFX 0xFC0007FF
 int
-ppc_instr_emulate(struct trapframe *frame, struct pcb *pcb)
+ppc_instr_emulate(struct trapframe *frame, struct thread *td)
 {
+   struct pcb *pcb;
uint32_t instr;
int reg, sig;
int rs, spr;
@@ -1094,12 +1095,16 @@ ppc_instr_emulate(struct trapframe *frame, struct pcb 
return (0);
}
 
+   pcb = td->td_pcb;
 #ifdef FPU_EMU
if (!(pcb->pcb_flags & PCB_FPREGS)) {
bzero(>pcb_fpu, sizeof(pcb->pcb_fpu));
pcb->pcb_flags |= PCB_FPREGS;
-   }
+   } else if (pcb->pcb_flags & PCB_FPU)
+   save_fpu(td);
sig = fpu_emulate(frame, >pcb_fpu);
+   if ((sig == 0 || sig == SIGFPE) && pcb->pcb_flags & PCB_FPU)
+   enable_fpu(td);
 #endif
 
return (sig);

Modified: stable/12/sys/powerpc/powerpc/trap.c
==
--- stable/12/sys/powerpc/powerpc/trap.cSat May 11 18:25:15 2019
(r347495)
+++ stable/12/sys/powerpc/powerpc/trap.cSat May 11 18:31:05 2019
(r347496)
@@ -361,7 +361,7 

svn commit: r347495 - in stable/12/sys: conf powerpc/include powerpc/powernv powerpc/powerpc

2019-05-11 Thread Justin Hibbits
Author: jhibbits
Date: Sat May 11 18:25:15 2019
New Revision: 347495
URL: https://svnweb.freebsd.org/changeset/base/347495

Log:
  MFC r345435:
  
  powernv: Add Hypervisor Maintenance Interrupt handler
  
  Attempting to build www/firefox on POWER9 resulted in a HMI exception being
  thrown, a fatal trap currently.  This is typically caused by timer facility
  errors, but examination of the Hypervisor Maintenance Exception Register
  (HMER) yielded only that an exception had recovered, with no information of
  the actual exception cause.
  
  When an HMI occurs, OPAL_HANDLE_HMI or OPAL_HANDLE_HMI2 must be called to
  handle the exception at the firmware level.  If the exception is handled, we
  can continue.
  
  This adds only the preliminary handler, enough to prevent package building
  from panicking.  An enhancement in the future is to use the flags returned
  by OPAL_HANDLE_HMI2 to print more useful error messages, and log maintenance
  events.

Added:
  stable/12/sys/powerpc/powernv/opal_hmi.c
 - copied unchanged from r345435, head/sys/powerpc/powernv/opal_hmi.c
Modified:
  stable/12/sys/conf/files.powerpc
  stable/12/sys/powerpc/include/spr.h
  stable/12/sys/powerpc/include/trap.h
  stable/12/sys/powerpc/powernv/opal.h
  stable/12/sys/powerpc/powerpc/interrupt.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/conf/files.powerpc
==
--- stable/12/sys/conf/files.powerpcSat May 11 17:59:13 2019
(r347494)
+++ stable/12/sys/conf/files.powerpcSat May 11 18:25:15 2019
(r347495)
@@ -193,6 +193,7 @@ powerpc/powermac/vcoregpio.coptional
powermac 
 powerpc/powernv/opal.c optionalpowernv
 powerpc/powernv/opal_console.c optionalpowernv
 powerpc/powernv/opal_dev.c optionalpowernv
+powerpc/powernv/opal_hmi.c optionalpowernv
 powerpc/powernv/opal_i2c.c optionaliicbus fdt powernv
 powerpc/powernv/opal_i2cm.coptionaliicbus fdt powernv
 powerpc/powernv/opal_pci.c optionalpowernv pci

Modified: stable/12/sys/powerpc/include/spr.h
==
--- stable/12/sys/powerpc/include/spr.h Sat May 11 17:59:13 2019
(r347494)
+++ stable/12/sys/powerpc/include/spr.h Sat May 11 18:25:15 2019
(r347495)
@@ -242,6 +242,8 @@
 #define  LPCR_PECE_ME(1ULL << 12) /* Machine Check and 
Hypervisor */
/* Maintenance exceptions */
 #defineSPR_LPID0x13f   /* Logical Partitioning Control 
*/
+#defineSPR_HMER0x150   /* Hypervisor Maintenance 
Exception Register */
+#defineSPR_HMEER   0x151   /* Hypervisor Maintenance 
Exception Enable Register */
 
 #defineSPR_PTCR0x1d0   /* Partition Table Control 
Register */
 #defineSPR_SPEFSCR 0x200   /* ..8 Signal Processing Engine 
FSCR. */

Modified: stable/12/sys/powerpc/include/trap.h
==
--- stable/12/sys/powerpc/include/trap.hSat May 11 17:59:13 2019
(r347494)
+++ stable/12/sys/powerpc/include/trap.hSat May 11 18:25:15 2019
(r347495)
@@ -150,6 +150,7 @@
 #ifndef LOCORE
 struct trapframe;
 struct pcb;
+extern int (*hmi_handler)(struct trapframe *);
 voidtrap(struct trapframe *);
 intppc_instr_emulate(struct trapframe *, struct pcb *);
 #endif

Modified: stable/12/sys/powerpc/powernv/opal.h
==
--- stable/12/sys/powerpc/powernv/opal.hSat May 11 17:59:13 2019
(r347494)
+++ stable/12/sys/powerpc/powernv/opal.hSat May 11 18:25:15 2019
(r347495)
@@ -71,8 +71,10 @@ int opal_call(uint64_t token, ...);
 #defineOPAL_PCI_MAP_PE_DMA_WINDOW_REAL 45
 #defineOPAL_RETURN_CPU 69
 #defineOPAL_REINIT_CPUS70
+#defineOPAL_CHECK_TOKEN80
 #defineOPAL_CHECK_ASYNC_COMPLETION 86
 #defineOPAL_SENSOR_READ88
+#defineOPAL_HANDLE_HMI 98
 #defineOPAL_IPMI_SEND  107
 #defineOPAL_IPMI_RECV  108
 #defineOPAL_I2C_REQUEST109
@@ -85,6 +87,7 @@ int opal_call(uint64_t token, ...);
 #defineOPAL_SENSOR_GROUP_CLEAR 156
 #defineOPAL_SENSOR_READ_U64162
 #defineOPAL_SENSOR_GROUP_ENABLE163
+#defineOPAL_HANDLE_HMI2166
 
 /* For OPAL_PCI_SET_PE */
 #defineOPAL_UNMAP_PE   0
@@ -114,6 +117,15 @@ int opal_call(uint64_t token, ...);
 #defineOPAL_BUSY_EVENT -12
 #defineOPAL_ASYNC_COMPLETION   -15
 

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

2019-05-11 Thread Cy Schubert
Author: cy
Date: Sat May 11 17:59:13 2019
New Revision: 347494
URL: https://svnweb.freebsd.org/changeset/base/347494

Log:
  Support the use of the ipsec kld.
  
  X-MFC with:   r347410

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

Modified: head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c
==
--- head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c  Sat May 11 16:15:13 
2019(r347493)
+++ head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c  Sat May 11 17:59:13 
2019(r347494)
@@ -481,7 +481,7 @@ ipf_send_ip(fin, m)
default :
return EINVAL;
}
-#ifdef IPSEC
+#ifdef IPSEC_SUPPORT
m->m_pkthdr.rcvif = NULL;
 #endif
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r347410 - in head: . sys/amd64/conf sys/arm/conf sys/arm64/conf sys/i386/conf sys/powerpc/conf sys/riscv/conf sys/sparc64/conf

2019-05-11 Thread Cy Schubert
In message <0c6911b6-6fa0-74cd-8999-c628bc3b2...@cs.duke.edu>, Andrew 
Gallatin
writes:
> On 2019-05-10 11:50, Kristof Provost wrote:
> > On 10 May 2019, at 8:31, Andrew Gallatin wrote:
> > 
> > On 2019-05-10 08:44, Slawa Olhovchenkov wrote:
> > 
> > pf have ifdef for IPSEC, but don't have support IPSEC_SUPPORT
> > (netpfil/pf/if_pfsync.c).
> > 
> > Thanks for pointing this out. It seems like IPSEC_SUPPORT would work
> > for this. I've made a patch, and it compiles and the pf module loads.
> > However, I have no knowledge of how to test it. Is this something
> > that you use, and which you can test?
> > 
> > I suspect this code has not actually been enabled for a long time.
> > gettdb() doesn’t actually appear to be defined anywhere, so I wouldn’t 
> > expect it to ever compile.
> > 
> > gettdb() does exist in OpenBSD, so my current guess is that this is just 
> > an import artefact, and we should |#ifdef OPENBSD| it or something, or 
> > just remove it completely.
> > 
> > For completeness, and because I never shut up about this: to test pf 
> > |kldload pfsync|, |cd /usr/tests/sys/netpfil/pf| and |sudo kyua test|
> > 
> > There’s more information in the current edition of the FreeBSD journal.
> > 
> > Regards,
> > Kristof
> > 
>
> Thanks, you are correct.  Including options_ipsec.h reveals that the 
> code does not even compile (cannot find gettdb(), which does not appear 
> to be defined anywhere in our tree).
>
> Given that it is dead code, I'd rather just not touch it.

IP Filter zeros out the pointer to rcvif when IPSEC is compiled in. 
Looking at the upstream code, Darren checks for IPSEC only for BSD 
based kernels. Zeroing out the pointer only when IPSEC is compiled in, 
regardless whether the mbuf in question was touched by IPSEC or not 
seems a little sketchy to me. However I'm inclined to use IPSEC_SUPPORT 
for now until it can be established whether to keep or remove it.


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

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


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


Re: svn commit: r347488 - head/usr.sbin/ntp/ntpd

2019-05-11 Thread Cy Schubert
In message <201905111637.x4bgbawj032...@gndrsh.dnsmgr.net>, "Rodney W. 
Grimes"
writes:
> > On Sat, 2019-05-11 at 14:22 +, Xin LI wrote:
> > > Author: delphij
> > > Date: Sat May 11 14:22:21 2019
> > > New Revision: 347488
> > > URL: https://svnweb.freebsd.org/changeset/base/347488
> > > 
> > > Log:
> > >   Update leap-seconds to leap-seconds.3757622400.
> > >   
> > 
> > For future reference:  it's a bit better to get this file from NIST [*]
> > than from USNO.  The USNO boilerplate is full of typos, and USNO
> > incorrectly adjusts the "last update date" metadata every time they
> > change the expiration date of the file.  That's not correct... as the
> > boilerplate itself states, that field is only supposed to be updated
> > when new leap seconds are added to the file.
>
> I would be very happy if that information would end up in the
> top of, or next to the leap-seconds file so that it was followed
> in the future, rather than being folk lore.
>
> Thanks,
> Rod

Leap seconds hasn't been updated upstream since 2017. USNO updates the 
file when they last paid attention to the file by not updating it. NIST 
only updates the file when there is indeed an update, that being Ian's 
point.


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

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


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


Re: svn commit: r347488 - head/usr.sbin/ntp/ntpd

2019-05-11 Thread Rodney W. Grimes
> On Sat, 2019-05-11 at 14:22 +, Xin LI wrote:
> > Author: delphij
> > Date: Sat May 11 14:22:21 2019
> > New Revision: 347488
> > URL: https://svnweb.freebsd.org/changeset/base/347488
> > 
> > Log:
> >   Update leap-seconds to leap-seconds.3757622400.
> >   
> 
> For future reference:  it's a bit better to get this file from NIST [*]
> than from USNO.  The USNO boilerplate is full of typos, and USNO
> incorrectly adjusts the "last update date" metadata every time they
> change the expiration date of the file.  That's not correct... as the
> boilerplate itself states, that field is only supposed to be updated
> when new leap seconds are added to the file.

I would be very happy if that information would end up in the
top of, or next to the leap-seconds file so that it was followed
in the future, rather than being folk lore.

Thanks,
Rod

> [*] ftp://ftp.nist.gov/pub/time/leap-seconds.list
> 
> -- Ian
> 
> >   As per 
> > https://datacenter.iers.org/data/latestVersion/16_BULLETIN_C16.txt:
> >   
> >INTERNATIONAL EARTH ROTATION AND REFERENCE SYSTEMS SERVICE
> > (IERS)
> >   
> >   SERVICE INTERNATIONAL DE LA ROTATION TERRESTRE ET DES SYSTEMES DE
> > REFERENCE
> >   
> >   SERVICE DE LA ROTATION TERRESTRE DE L'IERS
> >   OBSERVATOIRE DE PARIS
> >   61, Av. de l'Observatoire 75014 PARIS (France)
> >   Tel.  : +33 1 40 51 23 35
> >   e-mail: services.i...@obspm.fr
> >   http://hpiers.obspm.fr/eop-pc
> >   
> > Paris, 07 January
> > 2019
> >   
> > Bulletin C 57
> >   
> > To authorities
> > responsible
> > for the measurement
> > and
> > distribution of time
> >   
> > INFORMATION ON UTC - TAI
> >   
> >NO leap second will be introduced at the end of June 2019.
> >The difference between Coordinated Universal Time UTC and the
> >International Atomic Time TAI is :
> >   
> >from 2017 January 1, 0h UTC, until further notice : UTC-TAI =
> > -37 s
> >   
> >Leap seconds can be introduced in UTC at the end of the months of
> > December
> > +#  a comment, which continues from that symbol until 
> >six months, either to announce a time step in UTC, or to confirm
> > that there
> >will be no time step at the next possible date.
> >   
> >   Christian BIZOUARD
> >   Director
> >   Earth Orientation
> > Center of IERS
> > Observatoire de Paris,
> > France
> >   
> >   Requested by: rgrimes
> >   Obtained from:
> > ftp://tycho.usno.navy.mil/pub/ntp/leap-seconds.3757622400
> >   MFC after:3 days
> > 
> > Modified:
> >   head/usr.sbin/ntp/ntpd/leap-seconds
> > 
> > Modified: head/usr.sbin/ntp/ntpd/leap-seconds
> > =
> > =
> > --- head/usr.sbin/ntp/ntpd/leap-seconds Sat May 11 10:16:43
> > 2019(r347487)
> > +++ head/usr.sbin/ntp/ntpd/leap-seconds Sat May 11 14:22:21
> > 2019(r347488)
> > @@ -1,10 +1,10 @@
> >  #
> >  #  In the following text, the symbol '#' introduces
> > -#  a comment, which continues from that symbol until
> > +#  a comment, which continues from that symbol until 
> >  #  the end of the line. A plain comment line has a
> >  #  whitespace character following the comment indicator.
> > -#  There are also special comment lines defined below.
> > -#  A special comment will always have a non-whitespace
> > +#  There are also special comment lines defined below. 
> > +#  A special comment will always have a non-whitespace 
> >  #  character in column 2.
> >  #
> >  #  A blank line should be ignored.
> > @@ -15,22 +15,17 @@
> >  #  are transmitted by almost all time services.
> >  #
> >  #  The first column shows an epoch as a number of seconds
> > -#  since 1 January 1900, 00:00:00 (1900.0 is also used to
> > -#  indicate the same epoch.) Both of these time stamp formats
> > -#  ignore the complexities of the time scales that were
> > -#  used before the current definition of UTC at the start
> > -#  of 1972. (See note 3 below.)
> > -#  The second column shows the number of seconds that
> > -#  must be added to UTC to compute TAI for any timestamp
> > -#  at or after that epoch. The value on each line is
> > -#  valid from the indicated initial instant until the
> > -#  epoch given on the next one or indefinitely into the
> > -#  future if there is no next line.
> > +#  since 1900.0 and the second column shows the number of
> > +#  seconds that must be added to UTC to compute TAI for
> > +#  any timestamp at or after that epoch. The value on 
> > +#  each line is valid from the indicated initial instant
> > +#  

Re: svn commit: r347477 - head/sys/kern

2019-05-11 Thread Rodney W. Grimes
> Hi;
> 
> On 10/05/2019 23:57, Doug Moore wrote:
> > With mentor approval, I commit r347469.? I start getting email about
> > jenkins failure to build for several architectures on account of the
> > _Generic() construct I introduced in that change.
> >
> > I whip up a patch to undo that part of r347469, and ask for mentor
> > approval.? Meanwhile, mentor authorizes me in email to revert r347469.
> >
> > I try apply applying the fix-patch, and get email that it was rejected
> > for lack of reviewer.? In retrospect, it seems to have been committed
> > anyway as r347472.
> >
> > Thinking that things are still broken, I do what my mentor pre-approved
> > earlier and revert back to before r347469.? A patch to redo r347469,
> > without _Generic(), awaits mentor approval.
> 
> Ugh...? a rather elegant interaction ;)
> 
> > I realize that breaking the build and then committing without mentor
> > approval in my first week as committer isn't a good beginning.?? Sorry
> > about that.
> 
> It's probably not official policy but I would think you don't need 
> mentor approval to revert a change, assuming things return to the 
> pre-commit state, especially if it broke the build.

Perhaps this also should be added to the committers guide of
explaining what and when you need mentor approval, ie I would
consider a revert of a commit that was approved to have
mentor (implicit) type status.

It should also document that mentors can grant mentee's implicit
commit rights, like phk/bde have for all my MFC's, we (I asked,
they granted) agreed that if I had approval to commit it to head
I did not need to ask them for each merge to be approved.  This
one should probably be best a per mentor/mentee type agreement.

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


svn commit: r347493 - in head/sys: kern sys vm

2019-05-11 Thread Doug Moore
Author: dougm
Date: Sat May 11 16:15:13 2019
New Revision: 347493
URL: https://svnweb.freebsd.org/changeset/base/347493

Log:
  A new parameter to blist_alloc specifies an upper bound on the size of
  the allocation request, so that the blocks allocated are from the next
  set of free blocks big enough to satisfy the minimum requirements of
  the request, and the number of blocks allocated are as many as
  possible, up to the specified maximum. The implementation of
  swp_pager_getswapspace uses this parameter to ask for a number of
  blocks between the new halved request size and the previous failed
  request size. Thus a request for 32 blocks may fail, but instead of
  getting only 16 blocks instead, the caller asks for 16 to 31 next, and
  might get 19 or 27, which is closer to what they originally wanted.
  
  I expect this to lead to bigger block allocations and less block
  fragmentation, at least in some cases.
  
  Approved by: kib (mentor)
  Differential Revision: https://reviews.freebsd.org/D20001

Modified:
  head/sys/kern/subr_blist.c
  head/sys/sys/blist.h
  head/sys/vm/swap_pager.c

Modified: head/sys/kern/subr_blist.c
==
--- head/sys/kern/subr_blist.c  Sat May 11 15:17:42 2019(r347492)
+++ head/sys/kern/subr_blist.c  Sat May 11 16:15:13 2019(r347493)
@@ -130,9 +130,10 @@ __FBSDID("$FreeBSD$");
 /*
  * static support functions
  */
-static daddr_t blst_leaf_alloc(blmeta_t *scan, daddr_t blk, int count);
-static daddr_t blst_meta_alloc(blmeta_t *scan, daddr_t cursor, daddr_t count,
-   u_daddr_t radix);
+static daddr_t blst_leaf_alloc(blmeta_t *scan, daddr_t blk,
+int *count, int maxcount);
+static daddr_t blst_meta_alloc(blmeta_t *scan, daddr_t cursor, int *count,
+int maxcount, u_daddr_t radix);
 static void blst_leaf_free(blmeta_t *scan, daddr_t relblk, int count);
 static void blst_meta_free(blmeta_t *scan, daddr_t freeBlk, daddr_t count,
u_daddr_t radix);
@@ -293,12 +294,14 @@ blist_destroy(blist_t bl)
  *  not be allocated.
  */
 daddr_t
-blist_alloc(blist_t bl, daddr_t count)
+blist_alloc(blist_t bl, int *count, int maxcount)
 {
daddr_t blk, cursor;
 
-   KASSERT(count <= BLIST_MAX_ALLOC,
-   ("allocation too large: %d", (int)count));
+   KASSERT(*count <= maxcount,
+   ("invalid parameters %d > %d", *count, maxcount));
+   KASSERT(maxcount <= BLIST_MAX_ALLOC,
+   ("allocation too large: %d", maxcount));
 
/*
 * This loop iterates at most twice.  An allocation failure in the
@@ -306,19 +309,18 @@ blist_alloc(blist_t bl, daddr_t count)
 * non-zero.  When the cursor is zero, an allocation failure will
 * stop further iterations.
 */
-   cursor = bl->bl_cursor;
-   for (;;) {
-   blk = blst_meta_alloc(bl->bl_root, cursor, count,
+   for (cursor = bl->bl_cursor;; cursor = 0) {
+   blk = blst_meta_alloc(bl->bl_root, cursor, count, maxcount,
bl->bl_radix);
if (blk != SWAPBLK_NONE) {
-   bl->bl_avail -= count;
-   bl->bl_cursor = blk + count;
+   bl->bl_avail -= *count;
+   bl->bl_cursor = blk + *count;
if (bl->bl_cursor == bl->bl_blocks)
bl->bl_cursor = 0;
return (blk);
-   } else if (cursor == 0)
+   }
+   if (cursor == 0)
return (SWAPBLK_NONE);
-   cursor = 0;
}
 }
 
@@ -615,29 +617,34 @@ blist_stats(blist_t bl, struct sbuf *s)
  * common ancestor to mark any subtrees made completely empty.
  */
 static int
-blst_next_leaf_alloc(blmeta_t *scan, daddr_t blk, int count)
+blst_next_leaf_alloc(blmeta_t *scan, daddr_t blk, int count, int maxcount)
 {
blmeta_t *next;
u_daddr_t radix;
-   int digit;
+   int avail, digit;
 
next = scan + 1;
blk += BLIST_BMAP_RADIX;
radix = BLIST_BMAP_RADIX;
-   while ((digit = ((blk / radix) & BLIST_META_MASK)) == 0 &&
-   (next->bm_bitmap & 1) == 1) {
+   while ((next->bm_bitmap & 1) == 1 &&
+   (digit = ((blk / radix) & BLIST_META_MASK)) == 0) {
next++;
radix *= BLIST_META_RADIX;
}
-   if (((next->bm_bitmap + 1) & ~((u_daddr_t)-1 << count)) != 0) {
-   /*
-* The next leaf doesn't have enough free blocks at the
-* beginning to complete the spanning allocation.
-*/
-   return (ENOMEM);
+   if ((next->bm_bitmap & 1) != 1)
+   return (0);
+   avail = (~next->bm_bitmap != 0) ?
+   bitpos(~next->bm_bitmap) : BLIST_BMAP_RADIX;
+   if (avail < count) {
+   /*
+* The next leaf doesn't 

Re: svn commit: r347477 - head/sys/kern

2019-05-11 Thread Pedro Giffuni

Hi;

On 10/05/2019 23:57, Doug Moore wrote:

With mentor approval, I commit r347469.  I start getting email about
jenkins failure to build for several architectures on account of the
_Generic() construct I introduced in that change.

I whip up a patch to undo that part of r347469, and ask for mentor
approval.  Meanwhile, mentor authorizes me in email to revert r347469.

I try apply applying the fix-patch, and get email that it was rejected
for lack of reviewer.  In retrospect, it seems to have been committed
anyway as r347472.

Thinking that things are still broken, I do what my mentor pre-approved
earlier and revert back to before r347469.  A patch to redo r347469,
without _Generic(), awaits mentor approval.


Ugh...  a rather elegant interaction ;)


I realize that breaking the build and then committing without mentor
approval in my first week as committer isn't a good beginning.   Sorry
about that.


It's probably not official policy but I would think you don't need 
mentor approval to revert a change, assuming things return to the 
pre-commit state, especially if it broke the build.


Pedro.

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


Re: svn commit: r347488 - head/usr.sbin/ntp/ntpd

2019-05-11 Thread Ian Lepore
On Sat, 2019-05-11 at 14:22 +, Xin LI wrote:
> Author: delphij
> Date: Sat May 11 14:22:21 2019
> New Revision: 347488
> URL: https://svnweb.freebsd.org/changeset/base/347488
> 
> Log:
>   Update leap-seconds to leap-seconds.3757622400.
>   

For future reference:  it's a bit better to get this file from NIST [*]
than from USNO.  The USNO boilerplate is full of typos, and USNO
incorrectly adjusts the "last update date" metadata every time they
change the expiration date of the file.  That's not correct... as the
boilerplate itself states, that field is only supposed to be updated
when new leap seconds are added to the file.

[*] ftp://ftp.nist.gov/pub/time/leap-seconds.list

-- Ian

>   As per 
> https://datacenter.iers.org/data/latestVersion/16_BULLETIN_C16.txt:
>   
>INTERNATIONAL EARTH ROTATION AND REFERENCE SYSTEMS SERVICE
> (IERS)
>   
>   SERVICE INTERNATIONAL DE LA ROTATION TERRESTRE ET DES SYSTEMES DE
> REFERENCE
>   
>   SERVICE DE LA ROTATION TERRESTRE DE L'IERS
>   OBSERVATOIRE DE PARIS
>   61, Av. de l'Observatoire 75014 PARIS (France)
>   Tel.  : +33 1 40 51 23 35
>   e-mail: services.i...@obspm.fr
>   http://hpiers.obspm.fr/eop-pc
>   
> Paris, 07 January
> 2019
>   
> Bulletin C 57
>   
> To authorities
> responsible
> for the measurement
> and
> distribution of time
>   
> INFORMATION ON UTC - TAI
>   
>NO leap second will be introduced at the end of June 2019.
>The difference between Coordinated Universal Time UTC and the
>International Atomic Time TAI is :
>   
>from 2017 January 1, 0h UTC, until further notice : UTC-TAI =
> -37 s
>   
>Leap seconds can be introduced in UTC at the end of the months of
> December
> +#  a comment, which continues from that symbol until 
>six months, either to announce a time step in UTC, or to confirm
> that there
>will be no time step at the next possible date.
>   
>   Christian BIZOUARD
>   Director
>   Earth Orientation
> Center of IERS
>   Observatoire de Paris,
> France
>   
>   Requested by:   rgrimes
>   Obtained from:  
> ftp://tycho.usno.navy.mil/pub/ntp/leap-seconds.3757622400
>   MFC after:  3 days
> 
> Modified:
>   head/usr.sbin/ntp/ntpd/leap-seconds
> 
> Modified: head/usr.sbin/ntp/ntpd/leap-seconds
> =
> =
> --- head/usr.sbin/ntp/ntpd/leap-seconds   Sat May 11 10:16:43
> 2019  (r347487)
> +++ head/usr.sbin/ntp/ntpd/leap-seconds   Sat May 11 14:22:21
> 2019  (r347488)
> @@ -1,10 +1,10 @@
>  #
>  #In the following text, the symbol '#' introduces
> -#a comment, which continues from that symbol until
> +#a comment, which continues from that symbol until 
>  #the end of the line. A plain comment line has a
>  #whitespace character following the comment indicator.
> -#There are also special comment lines defined below.
> -#A special comment will always have a non-whitespace
> +#There are also special comment lines defined below. 
> +#A special comment will always have a non-whitespace 
>  #character in column 2.
>  #
>  #A blank line should be ignored.
> @@ -15,22 +15,17 @@
>  #are transmitted by almost all time services.
>  #
>  #The first column shows an epoch as a number of seconds
> -#since 1 January 1900, 00:00:00 (1900.0 is also used to
> -#indicate the same epoch.) Both of these time stamp formats
> -#ignore the complexities of the time scales that were
> -#used before the current definition of UTC at the start
> -#of 1972. (See note 3 below.)
> -#The second column shows the number of seconds that
> -#must be added to UTC to compute TAI for any timestamp
> -#at or after that epoch. The value on each line is
> -#valid from the indicated initial instant until the
> -#epoch given on the next one or indefinitely into the
> -#future if there is no next line.
> +#since 1900.0 and the second column shows the number of
> +#seconds that must be added to UTC to compute TAI for
> +#any timestamp at or after that epoch. The value on 
> +#each line is valid from the indicated initial instant
> +#until the epoch given on the next one or indefinitely 
> +#into the future if there is no next line.
>  #(The comment on each line shows the representation of
> -#the corresponding initial epoch in the usual
> +#the corresponding initial epoch in the usual 
>  #day-month-year format. The epoch always begins at
>  #00:00:00 UTC on the indicated 

svn commit: r347492 - head/lib/libc/powerpc64/string

2019-05-11 Thread Justin Hibbits
Author: jhibbits
Date: Sat May 11 15:17:42 2019
New Revision: 347492
URL: https://svnweb.freebsd.org/changeset/base/347492

Log:
  revert r346588 for now
  
  The rewrite of strcmp in assembly uses an instruction added in PowerISA
  2.05, making it SIGILL on CPUs older than the POWER6, such as the PPC970 in
  the PowerMac G5.  Revert this until we get clang+lld, or retire the in-tree
  binutils in favor of newer binutils with IFUNC support, whichever comes
  first.

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


svn commit: r347489 - head/sys/arm/allwinner/clkng

2019-05-11 Thread Emmanuel Vadot
Author: manu
Date: Sat May 11 15:02:20 2019
New Revision: 347489
URL: https://svnweb.freebsd.org/changeset/base/347489

Log:
  allwinner: clk: prediv_mux: Init the current parent
  
  Do not init the first parent but read the clock register to find
  it's current parent and init this one.

Modified:
  head/sys/arm/allwinner/clkng/aw_clk_prediv_mux.c

Modified: head/sys/arm/allwinner/clkng/aw_clk_prediv_mux.c
==
--- head/sys/arm/allwinner/clkng/aw_clk_prediv_mux.cSat May 11 14:22:21 
2019(r347488)
+++ head/sys/arm/allwinner/clkng/aw_clk_prediv_mux.cSat May 11 15:02:20 
2019(r347489)
@@ -75,7 +75,19 @@ struct aw_clk_prediv_mux_sc {
 static int
 aw_clk_prediv_mux_init(struct clknode *clk, device_t dev)
 {
-   clknode_init_parent_idx(clk, 0);
+   struct aw_clk_prediv_mux_sc *sc;
+   uint32_t val;
+
+   sc = clknode_get_softc(clk);
+
+   DEVICE_LOCK(clk);
+   READ4(clk, sc->offset, );
+   DEVICE_UNLOCK(clk);
+
+   /* Init the current parent */
+   val = (val & sc->mux_mask) >> sc->mux_shift;
+   clknode_init_parent_idx(clk, val);
+
return (0);
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r347491 - head/sys/dev/iicbus/twsi

2019-05-11 Thread Emmanuel Vadot
Author: manu
Date: Sat May 11 15:03:51 2019
New Revision: 347491
URL: https://svnweb.freebsd.org/changeset/base/347491

Log:
  twsi: Calculate the clock param based on the bus frequency
  
  Instead of precalculating the different speed, respect the bus frequency
  and calculate the clock register parameter based on it.
  If the platform didn't register the core clk, fallback on the precomputed
  values (This is likely do be the case on Marvell boards).

Modified:
  head/sys/dev/iicbus/twsi/a10_twsi.c
  head/sys/dev/iicbus/twsi/twsi.c

Modified: head/sys/dev/iicbus/twsi/a10_twsi.c
==
--- head/sys/dev/iicbus/twsi/a10_twsi.c Sat May 11 15:02:55 2019
(r347490)
+++ head/sys/dev/iicbus/twsi/a10_twsi.c Sat May 11 15:03:51 2019
(r347491)
@@ -87,9 +87,7 @@ static int
 a10_twsi_attach(device_t dev)
 {
struct twsi_softc *sc;
-   clk_t clk;
hwreset_t rst;
-   uint64_t freq;
int error;
 
sc = device_get_softc(dev);
@@ -104,12 +102,12 @@ a10_twsi_attach(device_t dev)
}
 
/* Activate clock */
-   error = clk_get_by_ofw_index(dev, 0, 0, );
+   error = clk_get_by_ofw_index(dev, 0, 0, >clk_core);
if (error != 0) {
device_printf(dev, "could not find clock\n");
return (error);
}
-   error = clk_enable(clk);
+   error = clk_enable(sc->clk_core);
if (error != 0) {
device_printf(dev, "could not enable clock\n");
return (error);
@@ -122,31 +120,6 @@ a10_twsi_attach(device_t dev)
sc->reg_status = TWI_STAT;
sc->reg_baud_rate = TWI_CCR;
sc->reg_soft_reset = TWI_SRST;
-
-   /* Setup baud rate params */
-   clk_get_freq(clk, );
-   switch (freq) {
-   /* 
-* Formula is
-* F0 = FINT / 2 ^ CLK_N
-* F1 = F0 / (CLK_M + 1)
-* 
-* Doc says that the output freq is F1/10 but my logic analyzer 
says otherwise
-*/
-   case 4800:
-   sc->baud_rate[IIC_SLOW].param = TWSI_BAUD_RATE_PARAM(11, 1);
-   sc->baud_rate[IIC_FAST].param = TWSI_BAUD_RATE_PARAM(11, 1);
-   sc->baud_rate[IIC_FASTEST].param = TWSI_BAUD_RATE_PARAM(2, 1);
-   break;
-   case 2400:
-   sc->baud_rate[IIC_SLOW].param = TWSI_BAUD_RATE_PARAM(5, 2);
-   sc->baud_rate[IIC_FAST].param = TWSI_BAUD_RATE_PARAM(5, 2);
-   sc->baud_rate[IIC_FASTEST].param = TWSI_BAUD_RATE_PARAM(2, 2);
-   break;
-   default:
-   device_printf(dev, "Non supported frequency\n");
-   return (ENXIO);
-   }
 
sc->need_ack = true;
return (twsi_attach(dev));

Modified: head/sys/dev/iicbus/twsi/twsi.c
==
--- head/sys/dev/iicbus/twsi/twsi.c Sat May 11 15:02:55 2019
(r347490)
+++ head/sys/dev/iicbus/twsi/twsi.c Sat May 11 15:03:51 2019
(r347491)
@@ -243,6 +243,43 @@ twsi_locked_start(device_t dev, struct twsi_softc *sc,
return (IIC_NOERR);
 }
 
+#ifdef EXT_RESOURCES
+#defineTWSI_BAUD_RATE_RAW(C,M,N)   ((C)/((10*(M+1))<<(N)))
+#defineABSSUB(a,b) (((a) > (b)) ? (a) - (b) : (b) - (a))
+
+static int
+twsi_calc_baud_rate(struct twsi_softc *sc, const u_int target,
+  int *param)
+{
+   uint64_t clk;
+   uint32_t cur, diff, diff0;
+   int m, n, m0, n0;
+
+   /* Calculate baud rate. */
+   diff0 = 0x;
+
+   if (clk_get_freq(sc->clk_core, ) < 0)
+   return (-1);
+
+   debugf(sc->dev, "Bus clock is at %lu\n", clk);
+
+   for (n = 0; n < 8; n++) {
+   for (m = 0; m < 16; m++) {
+   cur = TWSI_BAUD_RATE_RAW(clk,m,n);
+   diff = ABSSUB(target, cur);
+   if (diff < diff0) {
+   m0 = m;
+   n0 = n;
+   diff0 = diff;
+   }
+   }
+   }
+   *param = TWSI_BAUD_RATE_PARAM(m0, n0);
+
+   return (0);
+}
+#endif /* EXT_RESOURCES */
+
 /*
  * Only slave mode supported, disregard [old]addr
  */
@@ -251,24 +288,36 @@ twsi_reset(device_t dev, u_char speed, u_char addr, u_
 {
struct twsi_softc *sc;
uint32_t param;
-   /* uint32_t val; */
+#ifdef EXT_RESOURCES
+   u_int busfreq;
+#endif
 
sc = device_get_softc(dev);
 
-   switch (speed) {
-   case IIC_SLOW:
-   case IIC_FAST:
-   param = sc->baud_rate[speed].param;
-   debugf(dev, "Using IIC_FAST mode with speed param=%x\n", param);
-   break;
-   case IIC_FASTEST:
-   case IIC_UNKNOWN:
-   default:
-   param = sc->baud_rate[IIC_FAST].param;
-   debugf(dev, 

svn commit: r347490 - head/sys/arm/allwinner/clkng

2019-05-11 Thread Emmanuel Vadot
Author: manu
Date: Sat May 11 15:02:55 2019
New Revision: 347490
URL: https://svnweb.freebsd.org/changeset/base/347490

Log:
  allwinner: clk: sun8i_r: Correct resets
  
  The i2c reset wasn't defined and some bits where wrong, correct them.

Modified:
  head/sys/arm/allwinner/clkng/ccu_sun8i_r.c

Modified: head/sys/arm/allwinner/clkng/ccu_sun8i_r.c
==
--- head/sys/arm/allwinner/clkng/ccu_sun8i_r.c  Sat May 11 15:02:20 2019
(r347489)
+++ head/sys/arm/allwinner/clkng/ccu_sun8i_r.c  Sat May 11 15:02:55 2019
(r347490)
@@ -63,8 +63,9 @@ __FBSDID("$FreeBSD$");
 static struct aw_ccung_reset ccu_sun8i_r_resets[] = {
CCU_RESET(RST_APB0_IR, 0xb0, 1)
CCU_RESET(RST_APB0_TIMER, 0xb0, 2)
-   CCU_RESET(RST_APB0_RSB, 0xb0, 4)
-   CCU_RESET(RST_APB0_UART, 0xb0, 6)
+   CCU_RESET(RST_APB0_RSB, 0xb0, 3)
+   CCU_RESET(RST_APB0_UART, 0xb0, 4)
+   CCU_RESET(RST_APB0_I2C, 0xb0, 6)
 };
 
 static struct aw_ccung_gate ccu_sun8i_r_gates[] = {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r347477 - head/sys/kern

2019-05-11 Thread Ian Lepore
On Fri, 2019-05-10 at 23:57 -0500, Doug Moore wrote:
> With mentor approval, I commit r347469.  I start getting email about
> jenkins failure to build for several architectures on account of the
> _Generic() construct I introduced in that change.
> 
> I whip up a patch to undo that part of r347469, and ask for mentor
> approval.  Meanwhile, mentor authorizes me in email to revert
> r347469.
> 
> I try apply applying the fix-patch, and get email that it was
> rejected
> for lack of reviewer.  In retrospect, it seems to have been committed
> anyway as r347472.
> 
> Thinking that things are still broken, I do what my mentor pre-
> approved
> earlier and revert back to before r347469.  A patch to redo r347469,
> without _Generic(), awaits mentor approval.
> 
> I realize that breaking the build and then committing without mentor
> approval in my first week as committer isn't a good beginning.  
> Sorry
> about that.
> 
> At least I have no social media presence, so there's that.
> 
> Doug Moore
> 
> 

The important point is that the commit message should have said why. 
It doesn't have to be a whole novel, just something like "because
_Generic() isn't supported on all platforms" would've been good.

In general, for every commit, I ask myself "If someone 3 years from now
is debugging a problem and they're looking at the changes that have
happened to this code over time, will my commit message be helpful to
that process?"  Very often in that situation, what the person needs to
know isn't "what changed" so much as "why did this change happen?"

-- Ian


> On 5/10/19 11:47 PM, Cy Schubert wrote:
> > In message <201905110213.x4b2dq9u088...@repo.freebsd.org>, Doug
> > Moore 
> > writes:
> > > Author: dougm
> > > Date: Sat May 11 02:13:52 2019
> > > New Revision: 347477
> > > URL: https://svnweb.freebsd.org/changeset/base/347477
> > > 
> > > Log:
> > >   Revert r347469.
> > 
> > Why?
> > 
> > >   
> > >   Approved by: kib (mentor)
> > > 
> > > Modified:
> > >   head/sys/kern/subr_blist.c
> > > 
> 
> 
> 

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


svn commit: r347488 - head/usr.sbin/ntp/ntpd

2019-05-11 Thread Xin LI
Author: delphij
Date: Sat May 11 14:22:21 2019
New Revision: 347488
URL: https://svnweb.freebsd.org/changeset/base/347488

Log:
  Update leap-seconds to leap-seconds.3757622400.
  
  As per https://datacenter.iers.org/data/latestVersion/16_BULLETIN_C16.txt:
  
   INTERNATIONAL EARTH ROTATION AND REFERENCE SYSTEMS SERVICE (IERS)
  
  SERVICE INTERNATIONAL DE LA ROTATION TERRESTRE ET DES SYSTEMES DE REFERENCE
  
  SERVICE DE LA ROTATION TERRESTRE DE L'IERS
  OBSERVATOIRE DE PARIS
  61, Av. de l'Observatoire 75014 PARIS (France)
  Tel.  : +33 1 40 51 23 35
  e-mail: services.i...@obspm.fr
  http://hpiers.obspm.fr/eop-pc
  
Paris, 07 January 2019
  
Bulletin C 57
  
To authorities responsible
for the measurement and
distribution of time
  
INFORMATION ON UTC - TAI
  
   NO leap second will be introduced at the end of June 2019.
   The difference between Coordinated Universal Time UTC and the
   International Atomic Time TAI is :
  
   from 2017 January 1, 0h UTC, until further notice : UTC-TAI = -37 s
  
   Leap seconds can be introduced in UTC at the end of the months of December
   or June,  depending on the evolution of UT1-TAI. Bulletin C is mailed every
   six months, either to announce a time step in UTC, or to confirm that there
   will be no time step at the next possible date.
  
  Christian BIZOUARD
  Director
  Earth Orientation Center of IERS
Observatoire de Paris, France
  
  Requested by: rgrimes
  Obtained from:
ftp://tycho.usno.navy.mil/pub/ntp/leap-seconds.3757622400
  MFC after:3 days

Modified:
  head/usr.sbin/ntp/ntpd/leap-seconds

Modified: head/usr.sbin/ntp/ntpd/leap-seconds
==
--- head/usr.sbin/ntp/ntpd/leap-seconds Sat May 11 10:16:43 2019
(r347487)
+++ head/usr.sbin/ntp/ntpd/leap-seconds Sat May 11 14:22:21 2019
(r347488)
@@ -1,10 +1,10 @@
 #
 #  In the following text, the symbol '#' introduces
-#  a comment, which continues from that symbol until
+#  a comment, which continues from that symbol until 
 #  the end of the line. A plain comment line has a
 #  whitespace character following the comment indicator.
-#  There are also special comment lines defined below.
-#  A special comment will always have a non-whitespace
+#  There are also special comment lines defined below. 
+#  A special comment will always have a non-whitespace 
 #  character in column 2.
 #
 #  A blank line should be ignored.
@@ -15,22 +15,17 @@
 #  are transmitted by almost all time services.
 #
 #  The first column shows an epoch as a number of seconds
-#  since 1 January 1900, 00:00:00 (1900.0 is also used to
-#  indicate the same epoch.) Both of these time stamp formats
-#  ignore the complexities of the time scales that were
-#  used before the current definition of UTC at the start
-#  of 1972. (See note 3 below.)
-#  The second column shows the number of seconds that
-#  must be added to UTC to compute TAI for any timestamp
-#  at or after that epoch. The value on each line is
-#  valid from the indicated initial instant until the
-#  epoch given on the next one or indefinitely into the
-#  future if there is no next line.
+#  since 1900.0 and the second column shows the number of
+#  seconds that must be added to UTC to compute TAI for
+#  any timestamp at or after that epoch. The value on 
+#  each line is valid from the indicated initial instant
+#  until the epoch given on the next one or indefinitely 
+#  into the future if there is no next line.
 #  (The comment on each line shows the representation of
-#  the corresponding initial epoch in the usual
+#  the corresponding initial epoch in the usual 
 #  day-month-year format. The epoch always begins at
 #  00:00:00 UTC on the indicated day. See Note 5 below.)
-#
+#  
 #  Important notes:
 #
 #  1. Coordinated Universal Time (UTC) is often referred to
@@ -38,7 +33,7 @@
 #  longer used, and the use of GMT to designate UTC is
 #  discouraged.
 #
-#  2. The UTC time scale is realized by many national
+#  2. The UTC time scale is realized by many national 
 #  laboratories and timing centers. Each laboratory
 #  identifies its realization with its name: Thus
 #  UTC(NIST), UTC(USNO), etc. The differences among
@@ -47,12 +42,12 @@
 #  and can be ignored for many purposes. These differences
 #  are tabulated in Circular 

Re: svn commit: r347410 - in head: . sys/amd64/conf sys/arm/conf sys/arm64/conf sys/i386/conf sys/powerpc/conf sys/riscv/conf sys/sparc64/conf

2019-05-11 Thread Andrew Gallatin

On 2019-05-10 11:50, Kristof Provost wrote:

On 10 May 2019, at 8:31, Andrew Gallatin wrote:

On 2019-05-10 08:44, Slawa Olhovchenkov wrote:

pf have ifdef for IPSEC, but don't have support IPSEC_SUPPORT
(netpfil/pf/if_pfsync.c).

Thanks for pointing this out. It seems like IPSEC_SUPPORT would work
for this. I've made a patch, and it compiles and the pf module loads.
However, I have no knowledge of how to test it. Is this something
that you use, and which you can test?

I suspect this code has not actually been enabled for a long time.
gettdb() doesn’t actually appear to be defined anywhere, so I wouldn’t 
expect it to ever compile.


gettdb() does exist in OpenBSD, so my current guess is that this is just 
an import artefact, and we should |#ifdef OPENBSD| it or something, or 
just remove it completely.


For completeness, and because I never shut up about this: to test pf 
|kldload pfsync|, |cd /usr/tests/sys/netpfil/pf| and |sudo kyua test|


There’s more information in the current edition of the FreeBSD journal.

Regards,
Kristof



Thanks, you are correct.  Including options_ipsec.h reveals that the 
code does not even compile (cannot find gettdb(), which does not appear 
to be defined anywhere in our tree).


Given that it is dead code, I'd rather just not touch it.

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


Re: svn commit: r347484 - head/sys/kern

2019-05-11 Thread Bruce Evans

On Sat, 11 May 2019, Doug Moore wrote:


Log:
 When bitpos can't be implemented with an inline ffs* instruction,
 change the binary search so that it does not depend on a single bit
 only being set in the bitmask. Use bitpos more generally, and avoid
 some clearing of bits to accommodate its current behavior.


Inline ffs*() is badly implemented in general (it is mostly not implemented
in the kernel).  This makes it almost useless here, and (non-inline) ffs*()
(not used here) often slower than direct methods.


Modified: head/sys/kern/subr_blist.c
==
--- head/sys/kern/subr_blist.c  Sat May 11 04:18:06 2019(r347483)
+++ head/sys/kern/subr_blist.c  Sat May 11 09:09:10 2019(r347484)
...
+static inline int
+bitpos(u_daddr_t mask)
+{
+
switch (sizeof(mask)) {
#ifdef HAVE_INLINE_FFSLL
case sizeof(long long):
return (ffsll(mask) - 1);
#endif


This uses the long long abomination.  Only amd64 has inline ffsll().


+#ifdef HAVE_INLINE_FFS
+   case sizeof(int):
+   return (ffs(mask) - 1);
+#endif


This is unreachable, since sizeof(int) is 4 on all supported arches, and
sizeof(mask) is 8 on all arches.


default:
-   lo = 0;
-   hi = BLIST_BMAP_RADIX;
-   while (lo + 1 < hi) {
-   mid = (lo + hi) >> 1;
-   if ((mask >> mid) != 0)
-   lo = mid;
-   else
-   hi = mid;
-   }
-   return (lo);
+   return (generic_bitpos(mask));
}
}


So the default cause is used except on amd64.  I think the direct code
for it is not as slow as the generic (libkern) ffs*(), except the generic
ffs*() is simpler so the compiler might inline it internals to
__builtin_ffs*().  Not that -ffreestanding prevents inlining extern ffs*().

Since 64/8 is 2 times 4 and sizeof(int) >= 4 in POSIX, it is trivial to
implement ffs64() using 2 inline ffs()'s, and that is exactly what clang
does on i386 to implement __builtin_ffsl().  Unfortunately, most arches
also don't implement inline ffs().  Only amd64, i386 and sparc64 implement
it.

subr_blist.c is also complilable outside of the kernel.  I don't like that.
The kernel macros HAVE_INLINE_* don't exist outside of the kernel, but
ffs*() would work better outside of the kernel if it is used blindly since
inlining of it isn't prevented by -ffreestanding.

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


svn commit: r347487 - head/sys/vm

2019-05-11 Thread Doug Moore
Author: dougm
Date: Sat May 11 10:16:43 2019
New Revision: 347487
URL: https://svnweb.freebsd.org/changeset/base/347487

Log:
  Callers of swp_pager_getswapspace get either as many blocks as they
  requested, or none, and in the latter case it is up to them to pick a
  smaller request to make - which they always do by halving the failed
  request. This change to swp_pager_getswapspace leaves the task of
  downsizing the request to the function and not its caller. It still
  does so by halving the original request.
  
  Approved by: kib (mentor)
  Differential Revision: https://reviews.freebsd.org/D20228

Modified:
  head/sys/vm/swap_pager.c

Modified: head/sys/vm/swap_pager.c
==
--- head/sys/vm/swap_pager.cSat May 11 09:56:59 2019(r347486)
+++ head/sys/vm/swap_pager.cSat May 11 10:16:43 2019(r347487)
@@ -407,7 +407,7 @@ static int  swapoff_one(struct swdevt *sp, struct ucred
  * Swap bitmap functions
  */
 static voidswp_pager_freeswapspace(daddr_t blk, daddr_t npages);
-static daddr_t swp_pager_getswapspace(int npages);
+static daddr_t swp_pager_getswapspace(int *npages, int limit);
 
 /*
  * Metadata functions
@@ -708,9 +708,10 @@ swap_pager_dealloc(vm_object_t object)
 /*
  * SWP_PAGER_GETSWAPSPACE() -  allocate raw swap space
  *
- * Allocate swap for the requested number of pages.  The starting
- * swap block number (a page index) is returned or SWAPBLK_NONE
- * if the allocation failed.
+ * Allocate swap for up to the requested number of pages, and at
+ * least a minimum number of pages.  The starting swap block number
+ * (a page index) is returned or SWAPBLK_NONE if the allocation
+ * failed.
  *
  * Also has the side effect of advising that somebody made a mistake
  * when they configured swap and didn't configure enough.
@@ -720,38 +721,46 @@ swap_pager_dealloc(vm_object_t object)
  * We allocate in round-robin fashion from the configured devices.
  */
 static daddr_t
-swp_pager_getswapspace(int npages)
+swp_pager_getswapspace(int *io_npages, int limit)
 {
daddr_t blk;
struct swdevt *sp;
-   int i;
+   int npages;
 
blk = SWAPBLK_NONE;
+   npages = *io_npages;
mtx_lock(_dev_mtx);
sp = swdevhd;
-   for (i = 0; i < nswapdev; i++) {
+   while (!TAILQ_EMPTY()) {
if (sp == NULL)
sp = TAILQ_FIRST();
-   if (!(sp->sw_flags & SW_CLOSING)) {
+   if ((sp->sw_flags & SW_CLOSING) == 0)
blk = blist_alloc(sp->sw_blist, npages);
-   if (blk != SWAPBLK_NONE) {
-   blk += sp->sw_first;
-   sp->sw_used += npages;
-   swap_pager_avail -= npages;
-   swp_sizecheck();
-   swdevhd = TAILQ_NEXT(sp, sw_list);
-   goto done;
-   }
-   }
+   if (blk != SWAPBLK_NONE)
+   break;
sp = TAILQ_NEXT(sp, sw_list);
+   if (swdevhd == sp) {
+   if (npages <= limit)
+   break;
+   npages >>= 1;
+   }
}
-   if (swap_pager_full != 2) {
-   printf("swap_pager_getswapspace(%d): failed\n", npages);
-   swap_pager_full = 2;
-   swap_pager_almost_full = 1;
+   if (blk != SWAPBLK_NONE) {
+   *io_npages = npages;
+   blk += sp->sw_first;
+   sp->sw_used += npages;
+   swap_pager_avail -= npages;
+   swp_sizecheck();
+   swdevhd = TAILQ_NEXT(sp, sw_list);
+   } else {
+   if (swap_pager_full != 2) {
+   printf("swp_pager_getswapspace(%d): failed\n",
+   *io_npages);
+   swap_pager_full = 2;
+   swap_pager_almost_full = 1;
+   }
+   swdevhd = NULL;
}
-   swdevhd = NULL;
-done:
mtx_unlock(_dev_mtx);
return (blk);
 }
@@ -886,35 +895,28 @@ swap_pager_freespace(vm_object_t object, vm_pindex_t s
 int
 swap_pager_reserve(vm_object_t object, vm_pindex_t start, vm_size_t size)
 {
-   int n = 0;
-   daddr_t blk = SWAPBLK_NONE;
-   vm_pindex_t beg = start;/* save start index */
-   daddr_t addr, n_free, s_free;
+   daddr_t addr, blk, n_free, s_free;
+   int i, j, n;
 
swp_pager_init_freerange(_free, _free);
VM_OBJECT_WLOCK(object);
-   while (size) {
-   if (n == 0) {
-   n = BLIST_MAX_ALLOC;
-   while ((blk = swp_pager_getswapspace(n)) == 
SWAPBLK_NONE) {
-   n >>= 1;
-   if (n == 0) 

svn commit: r347486 - in stable: 11/contrib/llvm/lib/Target/ARM 12/contrib/llvm/lib/Target/ARM

2019-05-11 Thread Dimitry Andric
Author: dim
Date: Sat May 11 09:56:59 2019
New Revision: 347486
URL: https://svnweb.freebsd.org/changeset/base/347486

Log:
  MFC r347243:
  
  Pull in r360099 from upstream llvm trunk (by Eli Friedman):
  
[ARM] Glue register copies to tail calls.
  
This generally follows what other targets do. I don't completely
understand why the special case for tail calls existed in the first
place; even when the code was committed in r105413, call lowering
didn't work in the way described in the comments.
  
Stack protector lowering breaks if the register copies are not glued
to a tail call: we have to insert the stack protector check before
the tail call, and we choose the location based on the assumption
that all physical register dependencies of a tail call are adjacent
to the tail call. (See FindSplitPointForStackProtector.) This is sort
of fragile, but I don't see any reason to break that assumption.
  
I'm guessing nobody has seen this before just because it's hard to
convince the scheduler to actually schedule the code in a way that
breaks; even without the glue, the only computation that could
actually be scheduled after the register copies is the computation of
the call address, and the scheduler usually prefers to schedule that
before the copies anyway.
  
Fixes https://bugs.llvm.org/show_bug.cgi?id=41417
  
Differential Revision: https://reviews.llvm.org/D60427
  
  This should fix several instances of "Bad machine code: Using an
  undefined physical register", when compiling ports such as
  multimedia/vlc, audio/alsa-lib and devel/avro-c for armv6, with
  -fstack-protector-strong.
  
  Reported by:  jbeich
  PR:   237074, 237783, 237784

Modified:
  stable/11/contrib/llvm/lib/Target/ARM/ARMISelLowering.cpp
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/12/contrib/llvm/lib/Target/ARM/ARMISelLowering.cpp
Directory Properties:
  stable/12/   (props changed)

Modified: stable/11/contrib/llvm/lib/Target/ARM/ARMISelLowering.cpp
==
--- stable/11/contrib/llvm/lib/Target/ARM/ARMISelLowering.cpp   Sat May 11 
09:12:13 2019(r347485)
+++ stable/11/contrib/llvm/lib/Target/ARM/ARMISelLowering.cpp   Sat May 11 
09:56:59 2019(r347486)
@@ -1984,32 +1984,10 @@ ARMTargetLowering::LowerCall(TargetLowering::CallLower
   // Build a sequence of copy-to-reg nodes chained together with token chain
   // and flag operands which copy the outgoing args into the appropriate regs.
   SDValue InFlag;
-  // Tail call byval lowering might overwrite argument registers so in case of
-  // tail call optimization the copies to registers are lowered later.
-  if (!isTailCall)
-for (unsigned i = 0, e = RegsToPass.size(); i != e; ++i) {
-  Chain = DAG.getCopyToReg(Chain, dl, RegsToPass[i].first,
-   RegsToPass[i].second, InFlag);
-  InFlag = Chain.getValue(1);
-}
-
-  // For tail calls lower the arguments to the 'real' stack slot.
-  if (isTailCall) {
-// Force all the incoming stack arguments to be loaded from the stack
-// before any new outgoing arguments are stored to the stack, because the
-// outgoing stack slots may alias the incoming argument stack slots, and
-// the alias isn't otherwise explicit. This is slightly more conservative
-// than necessary, because it means that each store effectively depends
-// on every argument instead of just those arguments it would clobber.
-
-// Do not flag preceding copytoreg stuff together with the following stuff.
-InFlag = SDValue();
-for (unsigned i = 0, e = RegsToPass.size(); i != e; ++i) {
-  Chain = DAG.getCopyToReg(Chain, dl, RegsToPass[i].first,
-   RegsToPass[i].second, InFlag);
-  InFlag = Chain.getValue(1);
-}
-InFlag = SDValue();
+  for (unsigned i = 0, e = RegsToPass.size(); i != e; ++i) {
+Chain = DAG.getCopyToReg(Chain, dl, RegsToPass[i].first,
+ RegsToPass[i].second, InFlag);
+InFlag = Chain.getValue(1);
   }
 
   // If the callee is a GlobalAddress/ExternalSymbol node (quite common, every
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r347486 - in stable: 11/contrib/llvm/lib/Target/ARM 12/contrib/llvm/lib/Target/ARM

2019-05-11 Thread Dimitry Andric
Author: dim
Date: Sat May 11 09:56:59 2019
New Revision: 347486
URL: https://svnweb.freebsd.org/changeset/base/347486

Log:
  MFC r347243:
  
  Pull in r360099 from upstream llvm trunk (by Eli Friedman):
  
[ARM] Glue register copies to tail calls.
  
This generally follows what other targets do. I don't completely
understand why the special case for tail calls existed in the first
place; even when the code was committed in r105413, call lowering
didn't work in the way described in the comments.
  
Stack protector lowering breaks if the register copies are not glued
to a tail call: we have to insert the stack protector check before
the tail call, and we choose the location based on the assumption
that all physical register dependencies of a tail call are adjacent
to the tail call. (See FindSplitPointForStackProtector.) This is sort
of fragile, but I don't see any reason to break that assumption.
  
I'm guessing nobody has seen this before just because it's hard to
convince the scheduler to actually schedule the code in a way that
breaks; even without the glue, the only computation that could
actually be scheduled after the register copies is the computation of
the call address, and the scheduler usually prefers to schedule that
before the copies anyway.
  
Fixes https://bugs.llvm.org/show_bug.cgi?id=41417
  
Differential Revision: https://reviews.llvm.org/D60427
  
  This should fix several instances of "Bad machine code: Using an
  undefined physical register", when compiling ports such as
  multimedia/vlc, audio/alsa-lib and devel/avro-c for armv6, with
  -fstack-protector-strong.
  
  Reported by:  jbeich
  PR:   237074, 237783, 237784

Modified:
  stable/12/contrib/llvm/lib/Target/ARM/ARMISelLowering.cpp
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/contrib/llvm/lib/Target/ARM/ARMISelLowering.cpp
Directory Properties:
  stable/11/   (props changed)

Modified: stable/12/contrib/llvm/lib/Target/ARM/ARMISelLowering.cpp
==
--- stable/12/contrib/llvm/lib/Target/ARM/ARMISelLowering.cpp   Sat May 11 
09:12:13 2019(r347485)
+++ stable/12/contrib/llvm/lib/Target/ARM/ARMISelLowering.cpp   Sat May 11 
09:56:59 2019(r347486)
@@ -1984,32 +1984,10 @@ ARMTargetLowering::LowerCall(TargetLowering::CallLower
   // Build a sequence of copy-to-reg nodes chained together with token chain
   // and flag operands which copy the outgoing args into the appropriate regs.
   SDValue InFlag;
-  // Tail call byval lowering might overwrite argument registers so in case of
-  // tail call optimization the copies to registers are lowered later.
-  if (!isTailCall)
-for (unsigned i = 0, e = RegsToPass.size(); i != e; ++i) {
-  Chain = DAG.getCopyToReg(Chain, dl, RegsToPass[i].first,
-   RegsToPass[i].second, InFlag);
-  InFlag = Chain.getValue(1);
-}
-
-  // For tail calls lower the arguments to the 'real' stack slot.
-  if (isTailCall) {
-// Force all the incoming stack arguments to be loaded from the stack
-// before any new outgoing arguments are stored to the stack, because the
-// outgoing stack slots may alias the incoming argument stack slots, and
-// the alias isn't otherwise explicit. This is slightly more conservative
-// than necessary, because it means that each store effectively depends
-// on every argument instead of just those arguments it would clobber.
-
-// Do not flag preceding copytoreg stuff together with the following stuff.
-InFlag = SDValue();
-for (unsigned i = 0, e = RegsToPass.size(); i != e; ++i) {
-  Chain = DAG.getCopyToReg(Chain, dl, RegsToPass[i].first,
-   RegsToPass[i].second, InFlag);
-  InFlag = Chain.getValue(1);
-}
-InFlag = SDValue();
+  for (unsigned i = 0, e = RegsToPass.size(); i != e; ++i) {
+Chain = DAG.getCopyToReg(Chain, dl, RegsToPass[i].first,
+ RegsToPass[i].second, InFlag);
+InFlag = Chain.getValue(1);
   }
 
   // If the callee is a GlobalAddress/ExternalSymbol node (quite common, every
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r347485 - stable/12/sys/arm64/arm64

2019-05-11 Thread Konstantin Belousov
Author: kib
Date: Sat May 11 09:12:13 2019
New Revision: 347485
URL: https://svnweb.freebsd.org/changeset/base/347485

Log:
  MFC r347133:
  arm64: Properly restore PAN when done with userspace access in casueword.

Modified:
  stable/12/sys/arm64/arm64/support.S
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/arm64/arm64/support.S
==
--- stable/12/sys/arm64/arm64/support.S Sat May 11 09:09:10 2019
(r347484)
+++ stable/12/sys/arm64/arm64/support.S Sat May 11 09:12:13 2019
(r347485)
@@ -64,8 +64,8 @@ ENTRY(casueword32)
b.ne2f  /* Not equal, exit */
stxrw5, w3, [x0]/* Store the new data */
cbnzw5, 1b  /* Retry on failure */
-   EXIT_USER_ACCESS(w6)
-2: SET_FAULT_HANDLER(xzr, x5)  /* Reset the fault handler */
+2: EXIT_USER_ACCESS(w6)
+   SET_FAULT_HANDLER(xzr, x5)  /* Reset the fault handler */
str w4, [x2]/* Store the read data */
mov x0, #0  /* Success */
ret /* Return */
@@ -86,8 +86,8 @@ ENTRY(casueword)
b.ne2f  /* Not equal, exit */
stxrw5, x3, [x0]/* Store the new data */
cbnzw5, 1b  /* Retry on failure */
-   EXIT_USER_ACCESS(w6)
-2: SET_FAULT_HANDLER(xzr, x5)  /* Reset the fault handler */
+2: EXIT_USER_ACCESS(w6)
+   SET_FAULT_HANDLER(xzr, x5)  /* Reset the fault handler */
str x4, [x2]/* Store the read data */
mov x0, #0  /* Success */
ret /* Return */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r347484 - head/sys/kern

2019-05-11 Thread Doug Moore
Author: dougm
Date: Sat May 11 09:09:10 2019
New Revision: 347484
URL: https://svnweb.freebsd.org/changeset/base/347484

Log:
  When bitpos can't be implemented with an inline ffs* instruction,
  change the binary search so that it does not depend on a single bit
  only being set in the bitmask. Use bitpos more generally, and avoid
  some clearing of bits to accommodate its current behavior.
  
  Approved by: kib (mentor)
  Differential Revision: https://reviews.freebsd.org/D20237

Modified:
  head/sys/kern/subr_blist.c

Modified: head/sys/kern/subr_blist.c
==
--- head/sys/kern/subr_blist.c  Sat May 11 04:18:06 2019(r347483)
+++ head/sys/kern/subr_blist.c  Sat May 11 09:09:10 2019(r347484)
@@ -192,30 +192,40 @@ bitrange(int n, int count)
 
 
 /*
- * Use binary search, or a faster method, to find the 1 bit in a u_daddr_t.
- * Assumes that the argument has only one bit set.
+ * Find the first bit set in a u_daddr_t.
  */
 static inline int
-bitpos(u_daddr_t mask)
+generic_bitpos(u_daddr_t mask)
 {
int hi, lo, mid;
 
+   lo = 0;
+   hi = BLIST_BMAP_RADIX;
+   while (lo + 1 < hi) {
+   mid = (lo + hi) >> 1;
+   if (mask & bitrange(0, mid))
+   hi = mid;
+   else
+   lo = mid;
+   }
+   return (lo);
+}
+
+static inline int
+bitpos(u_daddr_t mask)
+{
+
switch (sizeof(mask)) {
 #ifdef HAVE_INLINE_FFSLL
case sizeof(long long):
return (ffsll(mask) - 1);
 #endif
+#ifdef HAVE_INLINE_FFS
+   case sizeof(int):
+   return (ffs(mask) - 1);
+#endif
default:
-   lo = 0;
-   hi = BLIST_BMAP_RADIX;
-   while (lo + 1 < hi) {
-   mid = (lo + hi) >> 1;
-   if ((mask >> mid) != 0)
-   lo = mid;
-   else
-   hi = mid;
-   }
-   return (lo);
+   return (generic_bitpos(mask));
}
 }
 
@@ -532,7 +542,8 @@ blist_stats(blist_t bl, struct sbuf *s)
struct gap_stats gstats;
struct gap_stats *stats = 
daddr_t i, nodes, radix;
-   u_daddr_t bit, diff, mask;
+   u_daddr_t diff, mask;
+   int digit;
 
init_gap_stats(stats);
nodes = 0;
@@ -570,9 +581,9 @@ blist_stats(blist_t bl, struct sbuf *s)
if (gap_stats_counting(stats))
diff ^= 1;
while (diff != 0) {
-   bit = diff & -diff;
-   update_gap_stats(stats, i + bitpos(bit));
-   diff ^= bit;
+   digit = bitpos(diff);
+   update_gap_stats(stats, i + digit);
+   diff ^= bitrange(digit, 1);
}
}
nodes += radix_to_skip(radix);
@@ -776,7 +787,7 @@ static daddr_t
 blst_meta_alloc(blmeta_t *scan, daddr_t cursor, daddr_t count, u_daddr_t radix)
 {
daddr_t blk, i, r, skip;
-   u_daddr_t bit, mask;
+   u_daddr_t mask;
bool scan_from_start;
int digit;
 
@@ -808,8 +819,7 @@ blst_meta_alloc(blmeta_t *scan, daddr_t cursor, daddr_
 * Examine the nonempty subtree associated with each bit set in mask.
 */
do {
-   bit = mask & -mask;
-   digit = bitpos(bit);
+   digit = bitpos(mask);
i = 1 + digit * skip;
if (count <= scan[i].bm_bighint) {
/*
@@ -819,12 +829,12 @@ blst_meta_alloc(blmeta_t *scan, daddr_t cursor, daddr_
count, radix);
if (r != SWAPBLK_NONE) {
if (scan[i].bm_bitmap == 0)
-   scan->bm_bitmap ^= bit;
+   scan->bm_bitmap ^= bitrange(digit, 1);
return (r);
}
}
cursor = blk;
-   } while ((mask ^= bit) != 0);
+   } while ((mask ^= bitrange(digit, 1)) != 0);
 
/*
 * We couldn't allocate count in this subtree.  If the whole tree was
@@ -1019,7 +1029,7 @@ static void
 blst_radix_print(blmeta_t *scan, daddr_t blk, daddr_t radix, int tab)
 {
daddr_t skip;
-   u_daddr_t bit, mask;
+   u_daddr_t mask;
int digit;
 
if (radix == BLIST_BMAP_RADIX) {
@@ -1051,11 +1061,10 @@ blst_radix_print(blmeta_t *scan, daddr_t blk, daddr_t 
mask = scan->bm_bitmap;
/* Examine the nonempty subtree associated with each bit set in mask */
do {
-   bit = mask & -mask;
-   digit = bitpos(bit);
+   digit = bitpos(mask);