Re: svn commit: r324815 - in head: lib/libc/gen sys/sys

2018-09-02 Thread Jan Beich
Michal Meloun  writes:

> Author: mmel
> Date: Sat Oct 21 12:06:18 2017
> New Revision: 324815
> URL: https://svnweb.freebsd.org/changeset/base/324815
>
> Log:
>   Make elf_aux_info() as public libc function.
>   - Teach elf aux vector functions about newly added AT_HWCAP and AT_HWCAP2
> vectors.
>   - Export _elf_aux_info() as new public libc function elf_aux_info(3)
>   
>   The elf_aux_info(3) should be considered as FreeBSD counterpart of glibc
>   getauxval() with more robust interface.

Can you back it out? I've reported sys/auxv.h breaks existing consumers
and the function is yet to be documented. 12.0-RELEASE is approaching
but there's no fix in sight, and by the time it lands there maybe
not enough time to test.

http://docs.freebsd.org/cgi/mid.cgi?03a31eff-34e8-be4c-c008-528824fea261
___
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: r338428 - head/libexec/rtld-elf

2018-09-02 Thread Konstantin Belousov
Author: kib
Date: Sun Sep  2 15:42:37 2018
New Revision: 338428
URL: https://svnweb.freebsd.org/changeset/base/338428

Log:
  Style cleanup.  No functional changes.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:3 days
  Approved by:re (rgrimes)

Modified:
  head/libexec/rtld-elf/libmap.c

Modified: head/libexec/rtld-elf/libmap.c
==
--- head/libexec/rtld-elf/libmap.c  Sun Sep  2 10:51:31 2018
(r338427)
+++ head/libexec/rtld-elf/libmap.c  Sun Sep  2 15:42:37 2018
(r338428)
@@ -99,10 +99,10 @@ static void
 lmc_parse_file(char *path)
 {
struct lmc *p;
+   char *lm_map;
struct stat st;
ssize_t retval;
int fd;
-   char *lm_map;
 
TAILQ_FOREACH(p, &lmc_head, next) {
if (strcmp(p->path, path) == 0)
@@ -222,17 +222,20 @@ lmc_parse(char *lm_p, size_t lm_len)
t = f = c = NULL;
 
/* Skip over leading space */
-   while (rtld_isspace(*cp)) cp++;
+   while (rtld_isspace(*cp))
+   cp++;
 
/* Found a comment or EOL */
-   if (iseol(*cp)) continue;
+   if (iseol(*cp))
+   continue;
 
/* Found a constraint selector */
if (*cp == '[') {
cp++;
 
/* Skip leading space */
-   while (rtld_isspace(*cp)) cp++;
+   while (rtld_isspace(*cp))
+   cp++;
 
/* Found comment, EOL or end of selector */
if  (iseol(*cp) || *cp == ']')
@@ -244,10 +247,12 @@ lmc_parse(char *lm_p, size_t lm_len)
cp++;
 
/* Skip and zero out trailing space */
-   while (rtld_isspace(*cp)) *cp++ = '\0';
+   while (rtld_isspace(*cp))
+   *cp++ = '\0';
 
/* Check if there is a closing brace */
-   if (*cp != ']') continue;
+   if (*cp != ']')
+   continue;
 
/* Terminate string if there was no trailing space */
*cp++ = '\0';
@@ -256,8 +261,10 @@ lmc_parse(char *lm_p, size_t lm_len)
 * There should be nothing except whitespace or comment
  from this point to the end of the line.
 */
-   while(rtld_isspace(*cp)) cp++;
-   if (!iseol(*cp)) continue;
+   while (rtld_isspace(*cp))
+   cp++;
+   if (!iseol(*cp))
+   continue;
 
if (strlcpy(prog, c, sizeof prog) >= sizeof prog)
continue;
@@ -267,23 +274,29 @@ lmc_parse(char *lm_p, size_t lm_len)
 
/* Parse the 'from' candidate. */
f = cp++;
-   while (!rtld_isspace(*cp) && !iseol(*cp)) cp++;
+   while (!rtld_isspace(*cp) && !iseol(*cp))
+   cp++;
 
/* Skip and zero out the trailing whitespace */
-   while (rtld_isspace(*cp)) *cp++ = '\0';
+   while (rtld_isspace(*cp))
+   *cp++ = '\0';
 
/* Found a comment or EOL */
-   if (iseol(*cp)) continue;
+   if (iseol(*cp))
+   continue;
 
/* Parse 'to' mapping */
t = cp++;
-   while (!rtld_isspace(*cp) && !iseol(*cp)) cp++;
+   while (!rtld_isspace(*cp) && !iseol(*cp))
+   cp++;
 
/* Skip and zero out the trailing whitespace */
-   while (rtld_isspace(*cp)) *cp++ = '\0';
+   while (rtld_isspace(*cp))
+   *cp++ = '\0';
 
/* Should be no extra tokens at this point */
-   if (!iseol(*cp)) continue;
+   if (!iseol(*cp))
+   continue;
 
*cp = '\0';
if (strcmp(f, "includedir") == 0)
@@ -296,7 +309,7 @@ lmc_parse(char *lm_p, size_t lm_len)
 }
 
 static void
-lm_free (struct lm_list *lml)
+lm_free(struct lm_list *lml)
 {
struct lm *lm;
 
@@ -309,11 +322,10 @@ lm_free (struct lm_list *lml)
free(lm->t);
free(lm);
}
-   return;
 }
 
 void
-lm_fini (void)
+lm_fini(void)
 {
struct lmp *lmp;
struct lmc *p;
@@ -334,11 +346,10 @@ lm_fini (void)
lm_free(&lmp->lml);
free(lmp);
}
-   return;
 }
 
 static void
-lm_add (const char *p, const char *f, const char *t)
+lm_add(const char *p, const char *f, const char *t)
 {
struct lm_list *lml;
  

svn commit: r338429 - head/usr.sbin/periodic

2018-09-02 Thread Brad Davis
Author: brd
Date: Sun Sep  2 15:53:56 2018
New Revision: 338429
URL: https://svnweb.freebsd.org/changeset/base/338429

Log:
  Move defaults/periodic.conf back to a config file.
  
  Ths prevents etcupdate and mergemaster from deleting it for now.
  
  Approved by:  re (rgrimes), will (mentor)
  Differential Revision:https://reviews.freebsd.org/D16975

Modified:
  head/usr.sbin/periodic/Makefile

Modified: head/usr.sbin/periodic/Makefile
==
--- head/usr.sbin/periodic/Makefile Sun Sep  2 15:42:37 2018
(r338428)
+++ head/usr.sbin/periodic/Makefile Sun Sep  2 15:53:56 2018
(r338429)
@@ -1,7 +1,7 @@
 # $FreeBSD$
 
-FILES= periodic.conf
-FILESDIR=  /etc/defaults
+CONFS= periodic.conf
+CONFSDIR=  /etc/defaults
 SCRIPTS=periodic.sh
 MAN=   periodic.8
 
___
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: r324815 - in head: lib/libc/gen sys/sys

2018-09-02 Thread Ian Lepore
On Sun, 2018-09-02 at 16:16 +0200, Jan Beich wrote:
> Michal Meloun  writes:
> 
> > 
> > Author: mmel
> > Date: Sat Oct 21 12:06:18 2017
> > New Revision: 324815
> > URL: https://svnweb.freebsd.org/changeset/base/324815
> > 
> > Log:
> >   Make elf_aux_info() as public libc function.
> >   - Teach elf aux vector functions about newly added AT_HWCAP and
> > AT_HWCAP2
> > vectors.
> >   - Export _elf_aux_info() as new public libc function
> > elf_aux_info(3)
> >   
> >   The elf_aux_info(3) should be considered as FreeBSD counterpart
> > of glibc
> >   getauxval() with more robust interface.
> Can you back it out? I've reported sys/auxv.h breaks existing
> consumers
> and the function is yet to be documented. 12.0-RELEASE is approaching
> but there's no fix in sight, and by the time it lands there maybe
> not enough time to test.
> 
> http://docs.freebsd.org/cgi/mid.cgi?03a31eff-34e8-be4c-c008-528824fea
> 261
> 

Are you seriously suggesting that freebsd is forbidden to add a system
header file of any name it chooses, just because some port's autotools
stuff mistakenly assumes the presence of that name implies something
linux-specific? If the port is broken, fix it.

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


svn commit: r338430 - head/sys/cddl/dev/fbt

2018-09-02 Thread Mark Johnston
Author: markj
Date: Sun Sep  2 17:02:13 2018
New Revision: 338430
URL: https://svnweb.freebsd.org/changeset/base/338430

Log:
  Fix the hash table lookup in fbt_destroy().
  
  Reported and tested by:   pho
  Approved by:  re (kib)
  X-MFC with:   r338359

Modified:
  head/sys/cddl/dev/fbt/fbt.c

Modified: head/sys/cddl/dev/fbt/fbt.c
==
--- head/sys/cddl/dev/fbt/fbt.c Sun Sep  2 15:53:56 2018(r338429)
+++ head/sys/cddl/dev/fbt/fbt.c Sun Sep  2 17:02:13 2018(r338430)
@@ -212,7 +212,7 @@ fbt_destroy_one(fbt_probe_t *fbt)
 
ndx = FBT_ADDR2NDX(fbt->fbtp_patchpoint);
for (hash = fbt_probetab[ndx], hashprev = NULL; hash != NULL;
-   hash = hash->fbtp_hashnext, hashprev = hash) {
+   hashprev = hash, hash = hash->fbtp_hashnext) {
if (hash == fbt) {
if ((next = fbt->fbtp_tracenext) != NULL)
next->fbtp_hashnext = hash->fbtp_hashnext;
___
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: r338431 - head/sys/vm

2018-09-02 Thread Alan Cox
Author: alc
Date: Sun Sep  2 18:29:38 2018
New Revision: 338431
URL: https://svnweb.freebsd.org/changeset/base/338431

Log:
  Recent changes have created, for the first time, physical memory segments
  that can be coalesced.  To be clear, fragmentation of phys_avail[] is not
  the cause.  This fragmentation of vm_phys_segs[] arises from the "special"
  calls to vm_phys_add_seg(), in other words, not those that derive directly
  from phys_avail[], but those that we create for the initial kernel page
  table pages and now for the kernel and modules loaded at boot time.  Since
  we sometimes iterate over the physical memory segments, coalescing these
  segments at initialization time is a worthwhile change.
  
  Reviewed by:  kib, markj
  Approved by:  re (rgrimes)
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D16976

Modified:
  head/sys/vm/vm_phys.c

Modified: head/sys/vm/vm_phys.c
==
--- head/sys/vm/vm_phys.c   Sun Sep  2 17:02:13 2018(r338430)
+++ head/sys/vm/vm_phys.c   Sun Sep  2 18:29:38 2018(r338431)
@@ -460,7 +460,7 @@ void
 vm_phys_init(void)
 {
struct vm_freelist *fl;
-   struct vm_phys_seg *seg;
+   struct vm_phys_seg *end_seg, *prev_seg, *seg, *tmp_seg;
u_long npages;
int dom, flind, freelist, oind, pind, segind;
 
@@ -544,6 +544,29 @@ vm_phys_init(void)
("vm_phys_init: DEFAULT flind < 0"));
}
seg->free_queues = &vm_phys_free_queues[seg->domain][flind];
+   }
+
+   /*
+* Coalesce physical memory segments that are contiguous and share the
+* same per-domain free queues.
+*/
+   prev_seg = vm_phys_segs;
+   seg = &vm_phys_segs[1];
+   end_seg = &vm_phys_segs[vm_phys_nsegs];
+   while (seg < end_seg) {
+   if (prev_seg->end == seg->start &&
+   prev_seg->free_queues == seg->free_queues) {
+   prev_seg->end = seg->end;
+   KASSERT(prev_seg->domain == seg->domain,
+   ("vm_phys_init: free queues cannot span domains"));
+   vm_phys_nsegs--;
+   end_seg--;
+   for (tmp_seg = seg; tmp_seg < end_seg; tmp_seg++)
+   *tmp_seg = *(tmp_seg + 1);
+   } else {
+   prev_seg = seg;
+   seg++;
+   }
}
 
/*
___
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: r338432 - head/usr.sbin/efibootmgr

2018-09-02 Thread Warner Losh
Author: imp
Date: Sun Sep  2 18:40:18 2018
New Revision: 338432
URL: https://svnweb.freebsd.org/changeset/base/338432

Log:
  Make -a (to make the entry active) apply to creation of a new boot
  variable.
  
  Approved by: re@ (rgrimes)
  PR: 231013
  Differential Revision:  https://reviews.freebsd.org/D16977

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

Modified: head/usr.sbin/efibootmgr/efibootmgr.c
==
--- head/usr.sbin/efibootmgr/efibootmgr.c   Sun Sep  2 18:29:38 2018
(r338431)
+++ head/usr.sbin/efibootmgr/efibootmgr.c   Sun Sep  2 18:40:18 2018
(r338432)
@@ -622,7 +622,7 @@ create_loadopt(uint8_t *buf, size_t bufmax, uint32_t a
 
 static int
 make_boot_var(const char *label, const char *loader, const char *kernel, const 
char *env, bool dry_run,
-   int bootnum)
+int bootnum, bool activate)
 {
struct entry *new_ent;
uint32_t load_attrs = 0;
@@ -665,6 +665,8 @@ make_boot_var(const char *label, const char *loader, c
 
/* don't make the new bootvar active by default, use the -a option 
later */
load_attrs = LOAD_OPTION_CATEGORY_BOOT;
+   if (activate)
+   load_attrs |= LOAD_OPTION_ACTIVE;
load_opt_buf = malloc(MAX_LOADOPT_LEN);
if (load_opt_buf == NULL)
err(1, "malloc");
@@ -915,7 +917,7 @@ main(int argc, char *argv[])
 */
make_boot_var(opts.label ? opts.label : "",
opts.loader, opts.kernel, opts.env, opts.dry_run,
-   opts.has_bootnum ? opts.bootnum : -1);
+   opts.has_bootnum ? opts.bootnum : -1, opts.set_active);
else if (opts.set_active || opts.set_inactive )
handle_activity(opts.bootnum, opts.set_active);
else if (opts.order != NULL)
___
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: r338433 - in head/sys: amd64/include dev/efidev

2018-09-02 Thread Konstantin Belousov
Author: kib
Date: Sun Sep  2 19:48:41 2018
New Revision: 338433
URL: https://svnweb.freebsd.org/changeset/base/338433

Log:
  Normalize use of semicolon with EFI_TIME_LOCK macros.
  
  Reviewed by:  kevans
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week
  Approved by:re (rgrimes)
  Differential revision:https://reviews.freebsd.org/D16972

Modified:
  head/sys/amd64/include/efi.h
  head/sys/dev/efidev/efirt.c

Modified: head/sys/amd64/include/efi.h
==
--- head/sys/amd64/include/efi.hSun Sep  2 18:40:18 2018
(r338432)
+++ head/sys/amd64/include/efi.hSun Sep  2 19:48:41 2018
(r338433)
@@ -48,9 +48,9 @@
 #ifdef _KERNEL
 #include 
 
-#defineEFI_TIME_LOCK() mtx_lock(&atrtc_time_lock);
-#defineEFI_TIME_UNLOCK()   mtx_unlock(&atrtc_time_lock);
-#defineEFI_TIME_OWNED()mtx_assert(&atrtc_time_lock, MA_OWNED);
+#defineEFI_TIME_LOCK() mtx_lock(&atrtc_time_lock)
+#defineEFI_TIME_UNLOCK()   mtx_unlock(&atrtc_time_lock)
+#defineEFI_TIME_OWNED()mtx_assert(&atrtc_time_lock, MA_OWNED)
 #endif
 
 #endif /* __AMD64_INCLUDE_EFI_H_ */

Modified: head/sys/dev/efidev/efirt.c
==
--- head/sys/dev/efidev/efirt.c Sun Sep  2 18:40:18 2018(r338432)
+++ head/sys/dev/efidev/efirt.c Sun Sep  2 19:48:41 2018(r338433)
@@ -299,7 +299,7 @@ efi_get_time_locked(struct efi_tm *tm, struct efi_tmca
efi_status status;
int error;
 
-   EFI_TIME_OWNED()
+   EFI_TIME_OWNED();
error = efi_enter();
if (error != 0)
return (error);
@@ -317,7 +317,7 @@ efi_get_time(struct efi_tm *tm)
 
if (efi_runtime == NULL)
return (ENXIO);
-   EFI_TIME_LOCK()
+   EFI_TIME_LOCK();
/*
 * UEFI spec states that the Capabilities argument to GetTime is
 * optional, but some UEFI implementations choke when passed a NULL
@@ -325,7 +325,7 @@ efi_get_time(struct efi_tm *tm)
 * to workaround such implementations.
 */
error = efi_get_time_locked(tm, &dummy);
-   EFI_TIME_UNLOCK()
+   EFI_TIME_UNLOCK();
return (error);
 }
 
@@ -337,9 +337,9 @@ efi_get_time_capabilities(struct efi_tmcap *tmcap)
 
if (efi_runtime == NULL)
return (ENXIO);
-   EFI_TIME_LOCK()
+   EFI_TIME_LOCK();
error = efi_get_time_locked(&dummy, tmcap);
-   EFI_TIME_UNLOCK()
+   EFI_TIME_UNLOCK();
return (error);
 }
 
@@ -379,9 +379,9 @@ efi_set_time(struct efi_tm *tm)
 
if (efi_runtime == NULL)
return (ENXIO);
-   EFI_TIME_LOCK()
+   EFI_TIME_LOCK();
error = efi_set_time_locked(tm);
-   EFI_TIME_UNLOCK()
+   EFI_TIME_UNLOCK();
return (error);
 }
 
___
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: r338434 - head/sys/amd64/amd64

2018-09-02 Thread Konstantin Belousov
Author: kib
Date: Sun Sep  2 20:07:36 2018
New Revision: 338434
URL: https://svnweb.freebsd.org/changeset/base/338434

Log:
  Swap order of dererencing PCPU curpmap and checking for usermode in
  trap_pfault() KPTI violation check.
  
  EFI RT may set curpmap to NULL for the duration of the call for some
  machines (PCID but no INVPCID).  Since apparently EFI RT code must be
  ready for exceptions from the calls, avoid dereferencing curpmap until
  we know that this call does not come from usermode.
  
  Reviewed by:  kevans
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week
  Approved by:re (rgrimes)
  Differential revision:https://reviews.freebsd.org/D16972

Modified:
  head/sys/amd64/amd64/trap.c

Modified: head/sys/amd64/amd64/trap.c
==
--- head/sys/amd64/amd64/trap.c Sun Sep  2 19:48:41 2018(r338433)
+++ head/sys/amd64/amd64/trap.c Sun Sep  2 20:07:36 2018(r338434)
@@ -806,7 +806,7 @@ trap_pfault(struct trapframe *frame, int usermode)
 * If nx protection of the usermode portion of kernel page
 * tables caused trap, panic.
 */
-   if (PCPU_GET(curpmap)->pm_ucr3 != PMAP_NO_CR3 && usermode &&
+   if (usermode && PCPU_GET(curpmap)->pm_ucr3 != PMAP_NO_CR3 &&
pg_nx != 0 && (frame->tf_err & (PGEX_P | PGEX_W |
PGEX_U | PGEX_I)) == (PGEX_P | PGEX_U | PGEX_I) &&
(curpcb->pcb_saved_ucr3 & ~CR3_PCID_MASK)==
___
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: r338435 - in head/sys: dev/efidev kern

2018-09-02 Thread Konstantin Belousov
Author: kib
Date: Sun Sep  2 20:17:51 2018
New Revision: 338435
URL: https://svnweb.freebsd.org/changeset/base/338435

Log:
  Improve error messages from clock_if.m method failures.
  
  Print error message in verbose mode when CLOCK_SETTIME() clock_if.m
  method failed.  For EFIRT RTC clock, add error code for the failure of
  CLOCK_GETTIME() report.
  
  Reviewed by:  kevans
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week
  Approved by:re (rgrimes)
  Differential revision:https://reviews.freebsd.org/D16972

Modified:
  head/sys/dev/efidev/efirtc.c
  head/sys/kern/subr_rtc.c

Modified: head/sys/dev/efidev/efirtc.c
==
--- head/sys/dev/efidev/efirtc.cSun Sep  2 20:07:36 2018
(r338434)
+++ head/sys/dev/efidev/efirtc.cSun Sep  2 20:17:51 2018
(r338435)
@@ -74,7 +74,8 @@ efirtc_probe(device_t dev)
 */
if ((error = efi_get_time(&tm)) != 0) {
if (bootverbose)
-   device_printf(dev, "cannot read EFI realtime clock\n");
+   device_printf(dev, "cannot read EFI realtime clock, "
+   "error %d\n", error);
return (error);
}
device_set_desc(dev, "EFI Realtime Clock");

Modified: head/sys/kern/subr_rtc.c
==
--- head/sys/kern/subr_rtc.cSun Sep  2 20:07:36 2018(r338434)
+++ head/sys/kern/subr_rtc.cSun Sep  2 20:17:51 2018(r338435)
@@ -138,6 +138,7 @@ settime_task_func(void *arg, int pending)
 {
struct timespec ts;
struct rtc_instance *rtc;
+   int error;
 
rtc = arg;
if (!(rtc->flags & CLOCKF_SETTIME_NO_TS)) {
@@ -150,7 +151,9 @@ settime_task_func(void *arg, int pending)
ts.tv_sec  = 0;
ts.tv_nsec = 0;
}
-   CLOCK_SETTIME(rtc->clockdev, &ts);
+   error = CLOCK_SETTIME(rtc->clockdev, &ts);
+   if (error != 0 && bootverbose)
+   device_printf(rtc->clockdev, "CLOCK_SETTIME error %d\n", error);
 }
 
 static void
___
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: r338436 - in head/sys: amd64/include kern

2018-09-02 Thread Konstantin Belousov
Author: kib
Date: Sun Sep  2 21:16:43 2018
New Revision: 338436
URL: https://svnweb.freebsd.org/changeset/base/338436

Log:
  Add amd64 mdthread fields needed for the upcoming EFI RT exception
  handling.
  
  This is split into a separate commit from the main change to make it
  easier to handle possible revert after upcoming KBI freeze.
  
  Reviewed by:  kevans
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week
  Approved by:re (rgrimes)
  Differential revision:https://reviews.freebsd.org/D16972

Modified:
  head/sys/amd64/include/proc.h
  head/sys/kern/kern_thread.c

Modified: head/sys/amd64/include/proc.h
==
--- head/sys/amd64/include/proc.h   Sun Sep  2 20:17:51 2018
(r338435)
+++ head/sys/amd64/include/proc.h   Sun Sep  2 21:16:43 2018
(r338436)
@@ -62,6 +62,8 @@ struct mdthread {
register_t md_saved_flags;  /* (k) */
register_t md_spurflt_addr; /* (k) Spurious page fault address. */
struct pmap_invl_gen md_invl_gen;
+   register_t md_efirt_tmp;/* (k) */
+   int md_efirt_dis_pf;/* (k) */
 };
 
 struct mdproc {

Modified: head/sys/kern/kern_thread.c
==
--- head/sys/kern/kern_thread.c Sun Sep  2 20:17:51 2018(r338435)
+++ head/sys/kern/kern_thread.c Sun Sep  2 21:16:43 2018(r338436)
@@ -83,7 +83,7 @@ _Static_assert(offsetof(struct thread, td_pflags) == 0
 "struct thread KBI td_pflags");
 _Static_assert(offsetof(struct thread, td_frame) == 0x470,
 "struct thread KBI td_frame");
-_Static_assert(offsetof(struct thread, td_emuldata) == 0x518,
+_Static_assert(offsetof(struct thread, td_emuldata) == 0x528,
 "struct thread KBI td_emuldata");
 _Static_assert(offsetof(struct proc, p_flag) == 0xb0,
 "struct proc KBI p_flag");
___
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: r338437 - in head/sys: amd64/amd64 amd64/include arm64/arm64 arm64/include conf dev/efidev modules/efirt sys

2018-09-02 Thread Konstantin Belousov
Author: kib
Date: Sun Sep  2 21:37:05 2018
New Revision: 338437
URL: https://svnweb.freebsd.org/changeset/base/338437

Log:
  Catch exceptions during EFI RT calls on amd64.
  
  This appeared to be required to have EFI RT support and EFI RTC
  enabled by default, because there are too many reports of faulting
  calls on many different machines.  The knob is added to leave the
  exceptions unhandled to allow to debug the actual bugs.
  
  Reviewed by:  kevans
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week
  Approved by:re (rgrimes)
  Differential revision:https://reviews.freebsd.org/D16972

Added:
  head/sys/amd64/amd64/efirt_support.S   (contents, props changed)
Modified:
  head/sys/amd64/amd64/efirt_machdep.c
  head/sys/amd64/amd64/genassym.c
  head/sys/amd64/include/efi.h
  head/sys/arm64/arm64/efirt_machdep.c
  head/sys/arm64/include/efi.h
  head/sys/conf/files.amd64
  head/sys/dev/efidev/efirt.c
  head/sys/modules/efirt/Makefile
  head/sys/sys/efi.h

Modified: head/sys/amd64/amd64/efirt_machdep.c
==
--- head/sys/amd64/amd64/efirt_machdep.cSun Sep  2 21:16:43 2018
(r338436)
+++ head/sys/amd64/amd64/efirt_machdep.cSun Sep  2 21:37:05 2018
(r338437)
@@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -266,6 +267,7 @@ efi_arch_enter(void)
 
curpmap = PCPU_GET(curpmap);
PMAP_LOCK_ASSERT(curpmap, MA_OWNED);
+   curthread->td_md.md_efirt_dis_pf = vm_fault_disable_pagefaults();
 
/*
 * IPI TLB shootdown handler invltlb_pcid_handler() reloads
@@ -300,6 +302,7 @@ efi_arch_leave(void)
curpmap->pm_pcids[PCPU_GET(cpuid)].pm_pcid : 0));
if (!pmap_pcid_enabled)
invltlb();
+   vm_fault_enable_pagefaults(curthread->td_md.md_efirt_dis_pf);
 }
 
 /* XXX debug stuff */

Added: head/sys/amd64/amd64/efirt_support.S
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/amd64/amd64/efirt_support.SSun Sep  2 21:37:05 2018
(r338437)
@@ -0,0 +1,116 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2018 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * This software was developed by Konstantin Belousov 
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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$
+ */
+
+#include 
+
+#include "assym.inc"
+
+   .text
+ENTRY(efi_rt_arch_call)
+   pushq   %rbp
+   movq%rsp, %rbp
+
+   movq%rbx, EC_RBX(%rdi)
+   movq%rsp, EC_RSP(%rdi)
+   movq%rbp, EC_RBP(%rdi)
+   movq%r12, EC_R12(%rdi)
+   movq%r13, EC_R13(%rdi)
+   movq%r14, EC_R14(%rdi)
+   movq%r15, EC_R15(%rdi)
+   movqPCPU(CURTHREAD), %rax
+   movq%rdi, TD_MD+MD_EFIRT_TMP(%rax)
+   movqPCPU(CURPCB), %rsi
+
+   movlEC_ARGCNT(%rdi), %ecx
+   movl%ecx, %ebx
+   movl$4, %eax
+   cmpl%eax, %ecx
+   cmovbl  %eax, %ecx
+   shll$3, %ecx
+   subq%rcx, %rsp
+
+   cmpl$0, %ebx
+   jz  1f
+   movqEC_ARG1(%rdi), %rcx
+   decl%ebx
+   jz  1f
+   movqEC_ARG2(%rdi), %rdx
+   decl%ebx
+   jz  1f
+   movqEC_ARG3(%rdi), %r8
+   decl%ebx
+   jz  1f
+   movqEC_ARG4(%rdi), %r9
+   decl%ebx
+   jz  1f
+   movqEC_ARG5(%rdi), %rax
+   movq%rax, 4*8(%rsp)
+   decl%ebx
+   jz  1f
+   movq$

svn commit: r338438 - head/stand/lua

2018-09-02 Thread Kyle Evans
Author: kevans
Date: Mon Sep  3 03:23:09 2018
New Revision: 338438
URL: https://svnweb.freebsd.org/changeset/base/338438

Log:
  lualoader: Handle comma-separated kernels as well
  
  The format for kernels is documented as being space-delimited, but
  forthloader was more lenient on this and so people began to depend on it.
  
  A later pass will be made to document all of the fun features that forthloader
  allowed that may not be immediately obvious.
  
  Reported by:  mmacy
  Approved by:  re (kib)

Modified:
  head/stand/lua/core.lua

Modified: head/stand/lua/core.lua
==
--- head/stand/lua/core.lua Sun Sep  2 21:37:05 2018(r338437)
+++ head/stand/lua/core.lua Mon Sep  3 03:23:09 2018(r338438)
@@ -185,7 +185,7 @@ function core.kernelList()
end
 
if v ~= nil then
-   for n in v:gmatch("([^; ]+)[; ]?") do
+   for n in v:gmatch("([^;, ]+)[;, ]?") do
if unique[n] == nil then
i = i + 1
kernels[i] = n
___
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"