CVS commit: src/sys

2021-12-22 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Thu Dec 23 04:06:51 UTC 2021

Modified Files:
src/sys/arch/x86/x86: hyperv.c
src/sys/dev/hyperv: hypervvar.h vmbus.c

Log Message:
hyper-v: move idt vector allocating to vmbus_init_interrupts_md()
for refactoring

And, the deallocating is also moved to
vmbus_deinit_interrupts_md().

reviewed by nonaka@n.o.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/x86/x86/hyperv.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/hyperv/hypervvar.h
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/hyperv/vmbus.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/x86/x86/hyperv.c
diff -u src/sys/arch/x86/x86/hyperv.c:1.13 src/sys/arch/x86/x86/hyperv.c:1.14
--- src/sys/arch/x86/x86/hyperv.c:1.13	Thu Jan 28 01:57:31 2021
+++ src/sys/arch/x86/x86/hyperv.c	Thu Dec 23 04:06:51 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: hyperv.c,v 1.13 2021/01/28 01:57:31 jmcneill Exp $	*/
+/*	$NetBSD: hyperv.c,v 1.14 2021/12/23 04:06:51 yamaguchi Exp $	*/
 
 /*-
  * Copyright (c) 2009-2012,2016-2017 Microsoft Corp.
@@ -33,7 +33,7 @@
  */
 #include 
 #ifdef __KERNEL_RCSID
-__KERNEL_RCSID(0, "$NetBSD: hyperv.c,v 1.13 2021/01/28 01:57:31 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hyperv.c,v 1.14 2021/12/23 04:06:51 yamaguchi Exp $");
 #endif
 #ifdef __FBSDID
 __FBSDID("$FreeBSD: head/sys/dev/hyperv/vmbus/hyperv.c 331757 2018-03-30 02:25:12Z emaste $");
@@ -755,52 +755,65 @@ hyperv_send_eom(void)
 }
 
 void
-vmbus_init_interrupts_md(struct vmbus_softc *sc)
+vmbus_init_interrupts_md(struct vmbus_softc *sc, cpuid_t cpu)
 {
 	extern void Xintr_hyperv_hypercall(void);
 	struct vmbus_percpu_data *pd;
 	struct hyperv_percpu_data *hv_pd;
-	struct idt_vec *iv = &(cpu_info_primary.ci_idtvec);
-	cpuid_t cid;
+	struct cpu_info *ci;
+	struct idt_vec *iv;
+	int hyperv_idtvec;
+	cpuid_t cpu0;
 
-	if (idt_vec_is_pcpu())
-		return;
-	/*
-	 * All Hyper-V ISR required resources are setup, now let's find a
-	 * free IDT vector for Hyper-V ISR and set it up.
-	 */
-	iv = &(cpu_info_primary.ci_idtvec);
-	cid = cpu_index(_info_primary);
-	pd = >sc_percpu[cid];
+	cpu0 = cpu_index(_info_primary);
+
+	if (cpu == cpu0 || idt_vec_is_pcpu()) {
+		/*
+		 * All Hyper-V ISR required resources are setup, now let's find a
+		 * free IDT vector for Hyper-V ISR and set it up.
+		 */
+		ci = cpu_lookup(cpu);
+		iv = >ci_idtvec;
+		mutex_enter(_lock);
+		hyperv_idtvec = idt_vec_alloc(iv,
+		APIC_LEVEL(NIPL), IDT_INTR_HIGH);
+		mutex_exit(_lock);
+		KASSERT(hyperv_idtvec > 0);
+		idt_vec_set(iv, hyperv_idtvec, Xintr_hyperv_hypercall);
+	} else {
+		pd = >sc_percpu[cpu0];
+		hv_pd = pd->md_cookie;
+		KASSERT(hv_pd != NULL && hv_pd->pd_idtvec > 0);
+		hyperv_idtvec = hv_pd->pd_idtvec;
+	}
 
 	hv_pd = kmem_zalloc(sizeof(*hv_pd), KM_SLEEP);
-	mutex_enter(_lock);
-	hv_pd->pd_idtvec = idt_vec_alloc(iv,
-	APIC_LEVEL(NIPL), IDT_INTR_HIGH);
-	mutex_exit(_lock);
-	KASSERT(hv_pd->pd_idtvec > 0);
-	idt_vec_set(iv, hv_pd->pd_idtvec, Xintr_hyperv_hypercall);
+	hv_pd->pd_idtvec = hyperv_idtvec;
+	pd = >sc_percpu[cpu];
 	pd->md_cookie = (void *)hv_pd;
 }
 
 void
-vmbus_deinit_interrupts_md(struct vmbus_softc *sc)
+vmbus_deinit_interrupts_md(struct vmbus_softc *sc, cpuid_t cpu)
 {
 	struct vmbus_percpu_data *pd;
 	struct hyperv_percpu_data *hv_pd;
+	struct cpu_info *ci;
 	struct idt_vec *iv;
-	cpuid_t cid;
-
-	if (idt_vec_is_pcpu())
-		return;
 
-	iv = &(cpu_info_primary.ci_idtvec);
-	cid = cpu_index(_info_primary);
-	pd = >sc_percpu[cid];
+	pd = >sc_percpu[cpu];
 	hv_pd = pd->md_cookie;
+	KASSERT(hv_pd != NULL);
 
-	if (hv_pd->pd_idtvec > 0)
-		idt_vec_free(iv, hv_pd->pd_idtvec);
+	if (cpu == cpu_index(_info_primary) ||
+	idt_vec_is_pcpu()) {
+		ci = cpu_lookup(cpu);
+		iv = >ci_idtvec;
+
+		if (hv_pd->pd_idtvec > 0) {
+			idt_vec_free(iv, hv_pd->pd_idtvec);
+		}
+	}
 
 	pd->md_cookie = NULL;
 	kmem_free(hv_pd, sizeof(*hv_pd));
@@ -810,38 +823,15 @@ void
 vmbus_init_synic_md(struct vmbus_softc *sc, cpuid_t cpu)
 {
 	extern void Xintr_hyperv_hypercall(void);
-	struct vmbus_percpu_data *pd, *pd0;
+	struct vmbus_percpu_data *pd;
 	struct hyperv_percpu_data *hv_pd;
-	struct cpu_info *ci;
-	struct idt_vec *iv;
 	uint64_t val, orig;
 	uint32_t sint;
 	int hyperv_idtvec;
 
 	pd = >sc_percpu[cpu];
-
-	hv_pd = kmem_alloc(sizeof(*hv_pd), KM_SLEEP);
-	pd->md_cookie = (void *)hv_pd;
-
-	/* Allocate IDT vector for ISR and set it up. */
-	if (idt_vec_is_pcpu()) {
-		ci = curcpu();
-		iv = >ci_idtvec;
-
-		mutex_enter(_lock);
-		hyperv_idtvec = idt_vec_alloc(iv, APIC_LEVEL(NIPL), IDT_INTR_HIGH);
-		mutex_exit(_lock);
-		KASSERT(hyperv_idtvec > 0);
-		idt_vec_set(iv, hyperv_idtvec, Xintr_hyperv_hypercall);
-
-		hv_pd = kmem_alloc(sizeof(*hv_pd), KM_SLEEP);
-		hv_pd->pd_idtvec = hyperv_idtvec;
-		pd->md_cookie = hv_pd;
-	} else {
-		pd0 = >sc_percpu[cpu_index(_info_primary)];
-		hv_pd = pd0->md_cookie;
-		hyperv_idtvec = 

CVS commit: src/sys

2021-12-22 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Thu Dec 23 04:06:51 UTC 2021

Modified Files:
src/sys/arch/x86/x86: hyperv.c
src/sys/dev/hyperv: hypervvar.h vmbus.c

Log Message:
hyper-v: move idt vector allocating to vmbus_init_interrupts_md()
for refactoring

And, the deallocating is also moved to
vmbus_deinit_interrupts_md().

reviewed by nonaka@n.o.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/x86/x86/hyperv.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/hyperv/hypervvar.h
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/hyperv/vmbus.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/x86/x86

2021-12-22 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Thu Dec 23 02:45:44 UTC 2021

Modified Files:
src/sys/arch/x86/x86: intr.c

Log Message:
Move the variable into the section that uses it


To generate a diff of this commit:
cvs rdiff -u -r1.158 -r1.159 src/sys/arch/x86/x86/intr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/x86/x86/intr.c
diff -u src/sys/arch/x86/x86/intr.c:1.158 src/sys/arch/x86/x86/intr.c:1.159
--- src/sys/arch/x86/x86/intr.c:1.158	Thu Dec 23 02:10:53 2021
+++ src/sys/arch/x86/x86/intr.c	Thu Dec 23 02:45:43 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.c,v 1.158 2021/12/23 02:10:53 yamaguchi Exp $	*/
+/*	$NetBSD: intr.c,v 1.159 2021/12/23 02:45:43 yamaguchi Exp $	*/
 
 /*
  * Copyright (c) 2007, 2008, 2009, 2019 The NetBSD Foundation, Inc.
@@ -133,7 +133,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.158 2021/12/23 02:10:53 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.159 2021/12/23 02:45:43 yamaguchi Exp $");
 
 #include "opt_intrdebug.h"
 #include "opt_multiprocessor.h"
@@ -508,7 +508,6 @@ intr_allocate_slot(struct pic *pic, int 
 	struct cpu_info *ci, *lci;
 	struct intrsource *isp;
 	int slot = 0, idtvec, error;
-	struct idt_vec *iv;
 
 	KASSERT(mutex_owned(_lock));
 
@@ -606,6 +605,8 @@ intr_allocate_slot(struct pic *pic, int 
 		 * are used by a device using MSI multiple vectors must be
 		 * continuous.
 		 */
+		struct idt_vec *iv;
+
 		iv = idt_vec_ref(>ci_idtvec);
 		idtvec = idt_vec_alloc(iv, APIC_LEVEL(level), IDT_INTR_HIGH);
 	}



CVS commit: src/sys/arch/x86/x86

2021-12-22 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Thu Dec 23 02:45:44 UTC 2021

Modified Files:
src/sys/arch/x86/x86: intr.c

Log Message:
Move the variable into the section that uses it


To generate a diff of this commit:
cvs rdiff -u -r1.158 -r1.159 src/sys/arch/x86/x86/intr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/x86/x86

2021-12-22 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Thu Dec 23 02:10:53 UTC 2021

Modified Files:
src/sys/arch/x86/x86: intr.c

Log Message:
delete the extra space


To generate a diff of this commit:
cvs rdiff -u -r1.157 -r1.158 src/sys/arch/x86/x86/intr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/x86/x86

2021-12-22 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Thu Dec 23 02:10:53 UTC 2021

Modified Files:
src/sys/arch/x86/x86: intr.c

Log Message:
delete the extra space


To generate a diff of this commit:
cvs rdiff -u -r1.157 -r1.158 src/sys/arch/x86/x86/intr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/x86/x86/intr.c
diff -u src/sys/arch/x86/x86/intr.c:1.157 src/sys/arch/x86/x86/intr.c:1.158
--- src/sys/arch/x86/x86/intr.c:1.157	Thu Dec 23 02:07:21 2021
+++ src/sys/arch/x86/x86/intr.c	Thu Dec 23 02:10:53 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.c,v 1.157 2021/12/23 02:07:21 yamaguchi Exp $	*/
+/*	$NetBSD: intr.c,v 1.158 2021/12/23 02:10:53 yamaguchi Exp $	*/
 
 /*
  * Copyright (c) 2007, 2008, 2009, 2019 The NetBSD Foundation, Inc.
@@ -133,7 +133,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.157 2021/12/23 02:07:21 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.158 2021/12/23 02:10:53 yamaguchi Exp $");
 
 #include "opt_intrdebug.h"
 #include "opt_multiprocessor.h"
@@ -1801,7 +1801,7 @@ intr_deactivate_xcall(void *arg1, void *
 
 	if (idt_vec_is_pcpu()) {
 		idt_vec_free(>ci_idtvec, idt_vec);
-	} else  {
+	} else {
 		/*
 		 * Skip unsetgate(), because the same idt[] entry is
 		 * overwritten in intr_activate_xcall().



CVS commit: src/sys/arch

2021-12-22 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Thu Dec 23 02:07:21 UTC 2021

Modified Files:
src/sys/arch/amd64/amd64: db_interface.c
src/sys/arch/i386/i386: db_interface.c
src/sys/arch/x86/x86: idt.c intr.c

Log Message:
x86: improve error handling related to idt_vec_alloc()


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/amd64/amd64/db_interface.c
cvs rdiff -u -r1.86 -r1.87 src/sys/arch/i386/i386/db_interface.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/x86/x86/idt.c
cvs rdiff -u -r1.156 -r1.157 src/sys/arch/x86/x86/intr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/amd64/amd64/db_interface.c
diff -u src/sys/arch/amd64/amd64/db_interface.c:1.39 src/sys/arch/amd64/amd64/db_interface.c:1.40
--- src/sys/arch/amd64/amd64/db_interface.c:1.39	Tue Feb 23 07:13:51 2021
+++ src/sys/arch/amd64/amd64/db_interface.c	Thu Dec 23 02:07:21 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_interface.c,v 1.39 2021/02/23 07:13:51 mrg Exp $	*/
+/*	$NetBSD: db_interface.c,v 1.40 2021/12/23 02:07:21 yamaguchi Exp $	*/
 
 /*
  * Mach Operating System
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.39 2021/02/23 07:13:51 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.40 2021/12/23 02:07:21 yamaguchi Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -119,6 +119,7 @@ db_machine_init(void)
 		handler = _x2apic_ddbipi;
 #endif
 	ddb_vec = idt_vec_alloc(iv, 0xf0, 0xff);
+	KASSERT(ddb_vec > 0);
 	set_idtgate([ddb_vec], handler, 1, SDT_SYS386IGT, SEL_KPL,
 	GSEL(GCODE_SEL, SEL_KPL));
 #else

Index: src/sys/arch/i386/i386/db_interface.c
diff -u src/sys/arch/i386/i386/db_interface.c:1.86 src/sys/arch/i386/i386/db_interface.c:1.87
--- src/sys/arch/i386/i386/db_interface.c:1.86	Tue Feb 23 07:13:52 2021
+++ src/sys/arch/i386/i386/db_interface.c	Thu Dec 23 02:07:21 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_interface.c,v 1.86 2021/02/23 07:13:52 mrg Exp $	*/
+/*	$NetBSD: db_interface.c,v 1.87 2021/12/23 02:07:21 yamaguchi Exp $	*/
 
 /*
  * Mach Operating System
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.86 2021/02/23 07:13:52 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.87 2021/12/23 02:07:21 yamaguchi Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -122,6 +122,7 @@ db_machine_init(void)
 		handler = _x2apic_ddbipi;
 #endif
 	ddb_vec = idt_vec_alloc(iv, 0xf0, 0xff);
+	KASSERT(ddb_vec > 0);
 	idt_vec_set(iv, ddb_vec, handler);
 #else
 	/* Initialised as part of xen_ipi_init() */

Index: src/sys/arch/x86/x86/idt.c
diff -u src/sys/arch/x86/x86/idt.c:1.14 src/sys/arch/x86/x86/idt.c:1.15
--- src/sys/arch/x86/x86/idt.c:1.14	Tue Jul 14 15:59:21 2020
+++ src/sys/arch/x86/x86/idt.c	Thu Dec 23 02:07:21 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: idt.c,v 1.14 2020/07/14 15:59:21 para Exp $	*/
+/*	$NetBSD: idt.c,v 1.15 2021/12/23 02:07:21 yamaguchi Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2009 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: idt.c,v 1.14 2020/07/14 15:59:21 para Exp $");
+__KERNEL_RCSID(0, "$NetBSD: idt.c,v 1.15 2021/12/23 02:07:21 yamaguchi Exp $");
 
 #include "opt_pcpu_idt.h"
 
@@ -170,6 +170,9 @@ idt_vec_alloc(struct idt_vec *iv, int lo
 
 	KASSERT(mutex_owned(_lock) || !mp_online);
 
+	if (low < 0 || high >= __arraycount(iv->iv_allocmap))
+		return -1;
+
 	for (vec = low; vec <= high; vec++) {
 		if (idt_allocmap[vec] == 0) {
 			/* idt_vec_free() can be unlocked, so membar. */
@@ -178,7 +181,8 @@ idt_vec_alloc(struct idt_vec *iv, int lo
 			return vec;
 		}
 	}
-	return 0;
+
+	return -1;
 }
 
 void
@@ -189,7 +193,7 @@ idt_vec_reserve(struct idt_vec *iv, int 
 	KASSERT(mutex_owned(_lock) || !mp_online);
 
 	result = idt_vec_alloc(iv, vec, vec);
-	if (result != vec) {
+	if (result < 0) {
 		panic("%s: failed to reserve vec %d", __func__, vec);
 	}
 }
@@ -201,6 +205,7 @@ idt_vec_set(struct idt_vec *iv, int vec,
 	char *idt_allocmap __diagused = iv->iv_allocmap;
 
 	KASSERT(idt_allocmap[vec] == 1);
+
 	idt = iv->iv_idt;
 	set_idtgate([vec], function, 0, SDT_SYS386IGT, SEL_KPL,
 	   GSEL(GCODE_SEL, SEL_KPL));
@@ -215,6 +220,8 @@ idt_vec_free(struct idt_vec *iv, int vec
 	idt_descriptor_t *idt;
 	char *idt_allocmap = iv->iv_allocmap;
 
+	KASSERT(idt_allocmap[vec] == 1);
+
 	idt = iv->iv_idt;
 	unset_idtgate([vec]);
 	idt_allocmap[vec] = 0;

Index: src/sys/arch/x86/x86/intr.c
diff -u src/sys/arch/x86/x86/intr.c:1.156 src/sys/arch/x86/x86/intr.c:1.157
--- src/sys/arch/x86/x86/intr.c:1.156	Thu Oct  7 12:52:27 2021
+++ src/sys/arch/x86/x86/intr.c	Thu Dec 23 02:07:21 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.c,v 1.156 2021/10/07 12:52:27 msaitoh Exp $	*/
+/*	$NetBSD: intr.c,v 1.157 2021/12/23 02:07:21 yamaguchi Exp $	*/
 
 /*
  * Copyright (c) 2007, 2008, 2009, 2019 The NetBSD Foundation, 

CVS commit: src/sys/arch

2021-12-22 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Thu Dec 23 02:07:21 UTC 2021

Modified Files:
src/sys/arch/amd64/amd64: db_interface.c
src/sys/arch/i386/i386: db_interface.c
src/sys/arch/x86/x86: idt.c intr.c

Log Message:
x86: improve error handling related to idt_vec_alloc()


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/amd64/amd64/db_interface.c
cvs rdiff -u -r1.86 -r1.87 src/sys/arch/i386/i386/db_interface.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/x86/x86/idt.c
cvs rdiff -u -r1.156 -r1.157 src/sys/arch/x86/x86/intr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev

2021-12-22 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Dec 22 21:45:02 UTC 2021

Modified Files:
src/sys/dev/acpi: ehci_acpi.c
src/sys/dev/pci: ehci_pci.c
src/sys/dev/usb: ehci.c ehcivar.h

Log Message:
Three fixes

- pass the 64bit DMA tag if the HCCPARAMS says ehci supports it and the
  64bit DMA tag is available/valid.  This should help with the
  "cannot create xfer" error on 64bit systems.

- restrict the control structure memory allocation to the low 4GB
  (CTRLDSSEGMENT was always set to zero anyway)

- if ehci_init fails then tidyup before returning the error.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/acpi/ehci_acpi.c
cvs rdiff -u -r1.72 -r1.73 src/sys/dev/pci/ehci_pci.c
cvs rdiff -u -r1.296 -r1.297 src/sys/dev/usb/ehci.c
cvs rdiff -u -r1.48 -r1.49 src/sys/dev/usb/ehcivar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/acpi/ehci_acpi.c
diff -u src/sys/dev/acpi/ehci_acpi.c:1.7 src/sys/dev/acpi/ehci_acpi.c:1.8
--- src/sys/dev/acpi/ehci_acpi.c:1.7	Sat Aug  7 16:19:09 2021
+++ src/sys/dev/acpi/ehci_acpi.c	Wed Dec 22 21:45:02 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ehci_acpi.c,v 1.7 2021/08/07 16:19:09 thorpej Exp $ */
+/* $NetBSD: ehci_acpi.c,v 1.8 2021/12/22 21:45:02 skrll Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ehci_acpi.c,v 1.7 2021/08/07 16:19:09 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci_acpi.c,v 1.8 2021/12/22 21:45:02 skrll Exp $");
 
 #include 
 #include 
@@ -98,7 +98,6 @@ ehci_acpi_attach(device_t parent, device
 
 	sc->sc_dev = self;
 	sc->sc_bus.ub_hcpriv = sc;
-	sc->sc_bus.ub_dmatag = aa->aa_dmat;
 	sc->sc_bus.ub_revision = USBREV_2_0;
 	sc->sc_flags = EHCIF_ETTF;
 	sc->sc_vendor_init = ehci_acpi_init;
@@ -125,25 +124,41 @@ ehci_acpi_attach(device_t parent, device
 	error = bus_space_map(sc->iot, mem->ar_base, mem->ar_length, 0, >ioh);
 	if (error) {
 		aprint_error_dev(self, "couldn't map registers\n");
-		return;
+		goto done;
 	}
 
 	/* Disable interrupts */
 	sc->sc_offs = EREAD1(sc, EHCI_CAPLENGTH);
 	EOWRITE4(sc, EHCI_USBINTR, 0);
 
+	const uint32_t hccparams = EREAD4(sc, EHCI_HCCPARAMS);
+	if (EHCI_HCC_64BIT(hccparams)) {
+		aprint_verbose_dev(self, "64-bit DMA");
+		if (BUS_DMA_TAG_VALID(aa->aa_dmat64)) {
+			aprint_verbose("\n");
+			sc->sc_bus.ub_dmatag = aa->aa_dmat64;
+		} else {
+			aprint_verbose(" - limited\n");
+			sc->sc_bus.ub_dmatag = aa->aa_dmat;
+		}
+	} else {
+		aprint_verbose_dev(self, "32-bit DMA\n");
+		sc->sc_bus.ub_dmatag = aa->aa_dmat;
+	}
+
 	ih = acpi_intr_establish(self,
 	(uint64_t)(uintptr_t)aa->aa_node->ad_handle,
 	IPL_USB, true, ehci_intr, sc, device_xname(self));
 	if (ih == NULL) {
 		aprint_error_dev(self, "couldn't establish interrupt\n");
-		return;
+		goto done;
 	}
 
 	error = ehci_init(sc);
 	if (error) {
 		aprint_error_dev(self, "init failed, error = %d\n", error);
-		return;
+		acpi_intr_disestablish(ih);
+		goto done;
 	}
 
 	sc->sc_child = config_found(self, >sc_bus, usbctlprint, CFARGS_NONE);

Index: src/sys/dev/pci/ehci_pci.c
diff -u src/sys/dev/pci/ehci_pci.c:1.72 src/sys/dev/pci/ehci_pci.c:1.73
--- src/sys/dev/pci/ehci_pci.c:1.72	Sat Aug  7 16:19:14 2021
+++ src/sys/dev/pci/ehci_pci.c	Wed Dec 22 21:45:02 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ehci_pci.c,v 1.72 2021/08/07 16:19:14 thorpej Exp $	*/
+/*	$NetBSD: ehci_pci.c,v 1.73 2021/12/22 21:45:02 skrll Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ehci_pci.c,v 1.72 2021/08/07 16:19:14 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci_pci.c,v 1.73 2021/12/22 21:45:02 skrll Exp $");
 
 #include 
 #include 
@@ -144,7 +144,22 @@ ehci_pci_attach(device_t parent, device_
 
 	sc->sc_pc = pc;
 	sc->sc_tag = tag;
-	sc->sc.sc_bus.ub_dmatag = pa->pa_dmat;
+
+	const uint32_t hccparams = EREAD4(>sc, EHCI_HCCPARAMS);
+
+	if (EHCI_HCC_64BIT(hccparams)) {
+		aprint_verbose_dev(self, "64-bit DMA");
+		if (pci_dma64_available(pa)) {
+			sc->sc.sc_bus.ub_dmatag = pa->pa_dmat64;
+			aprint_verbose("\n");
+		} else {
+			aprint_verbose(" - limited\n");
+			sc->sc.sc_bus.ub_dmatag = pa->pa_dmat;
+		}
+	} else {
+		aprint_verbose_dev(self, "32-bit DMA\n");
+		sc->sc.sc_bus.ub_dmatag = pa->pa_dmat;
+	}
 
 	/* Disable interrupts, so we don't get any spurious ones. */
 	sc->sc.sc_offs = EREAD1(>sc, EHCI_CAPLENGTH);

Index: src/sys/dev/usb/ehci.c
diff -u src/sys/dev/usb/ehci.c:1.296 src/sys/dev/usb/ehci.c:1.297
--- src/sys/dev/usb/ehci.c:1.296	Wed Dec 22 21:36:40 2021
+++ src/sys/dev/usb/ehci.c	Wed Dec 22 21:45:02 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ehci.c,v 1.296 2021/12/22 21:36:40 skrll Exp $ */
+/*	$NetBSD: ehci.c,v 1.297 2021/12/22 21:45:02 skrll Exp $ */
 
 /*
  * Copyright (c) 2004-2012,2016,2020 The NetBSD Foundation, Inc.
@@ -54,7 +54,7 @@
  */
 
 #include 

CVS commit: src/sys/dev

2021-12-22 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Dec 22 21:45:02 UTC 2021

Modified Files:
src/sys/dev/acpi: ehci_acpi.c
src/sys/dev/pci: ehci_pci.c
src/sys/dev/usb: ehci.c ehcivar.h

Log Message:
Three fixes

- pass the 64bit DMA tag if the HCCPARAMS says ehci supports it and the
  64bit DMA tag is available/valid.  This should help with the
  "cannot create xfer" error on 64bit systems.

- restrict the control structure memory allocation to the low 4GB
  (CTRLDSSEGMENT was always set to zero anyway)

- if ehci_init fails then tidyup before returning the error.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/acpi/ehci_acpi.c
cvs rdiff -u -r1.72 -r1.73 src/sys/dev/pci/ehci_pci.c
cvs rdiff -u -r1.296 -r1.297 src/sys/dev/usb/ehci.c
cvs rdiff -u -r1.48 -r1.49 src/sys/dev/usb/ehcivar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/usb

2021-12-22 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Dec 22 21:36:40 UTC 2021

Modified Files:
src/sys/dev/usb: ehci.c

Log Message:
Whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.295 -r1.296 src/sys/dev/usb/ehci.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/usb/ehci.c
diff -u src/sys/dev/usb/ehci.c:1.295 src/sys/dev/usb/ehci.c:1.296
--- src/sys/dev/usb/ehci.c:1.295	Tue Dec 21 10:16:05 2021
+++ src/sys/dev/usb/ehci.c	Wed Dec 22 21:36:40 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ehci.c,v 1.295 2021/12/21 10:16:05 skrll Exp $ */
+/*	$NetBSD: ehci.c,v 1.296 2021/12/22 21:36:40 skrll Exp $ */
 
 /*
  * Copyright (c) 2004-2012,2016,2020 The NetBSD Foundation, Inc.
@@ -54,7 +54,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.295 2021/12/21 10:16:05 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.296 2021/12/22 21:36:40 skrll Exp $");
 
 #include "ohci.h"
 #include "uhci.h"
@@ -2001,8 +2001,8 @@ ehci_open(struct usbd_pipe *pipe)
 	switch (xfertype) {
 	case UE_CONTROL:
 		err = usb_allocmem(sc->sc_bus.ub_dmatag,
-		 sizeof(usb_device_request_t), 0, USBMALLOC_COHERENT,
-		 >ctrl.reqdma);
+		sizeof(usb_device_request_t), 0, USBMALLOC_COHERENT,
+		>ctrl.reqdma);
 #ifdef EHCI_DEBUG
 		if (err)
 			printf("ehci_open: usb_allocmem()=%d\n", err);



CVS commit: src/sys/dev/usb

2021-12-22 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Dec 22 21:36:40 UTC 2021

Modified Files:
src/sys/dev/usb: ehci.c

Log Message:
Whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.295 -r1.296 src/sys/dev/usb/ehci.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/external/bsd/common/include/linux

2021-12-22 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Dec 22 18:04:54 UTC 2021

Modified Files:
src/sys/external/bsd/common/include/linux: slab.h

Log Message:
Reduce code duplication: kmem_cache_create() is now exactly the same as
kmem_cache_create_dtor() except for the dtor argument, so implement
the former in terms of the latter.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/external/bsd/common/include/linux/slab.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/common/include/linux/slab.h
diff -u src/sys/external/bsd/common/include/linux/slab.h:1.12 src/sys/external/bsd/common/include/linux/slab.h:1.13
--- src/sys/external/bsd/common/include/linux/slab.h:1.12	Wed Dec 22 16:57:29 2021
+++ src/sys/external/bsd/common/include/linux/slab.h	Wed Dec 22 18:04:53 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: slab.h,v 1.12 2021/12/22 16:57:29 thorpej Exp $	*/
+/*	$NetBSD: slab.h,v 1.13 2021/12/22 18:04:53 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -194,27 +194,6 @@ kmem_cache_dtor(void *cookie, void *ptr)
 		(*kc->kc_dtor)(ptr);
 }
 
-static inline struct kmem_cache *
-kmem_cache_create(const char *name, size_t size, size_t align,
-unsigned long flags, void (*ctor)(void *))
-{
-	struct kmem_cache *kc;
-	int pcflags = 0;
-
-	if (ISSET(flags, SLAB_HWCACHE_ALIGN))
-		align = roundup(MAX(1, align), CACHE_LINE_SIZE);
-	if (ISSET(flags, SLAB_TYPESAFE_BY_RCU))
-		pcflags |= PR_PSERIALIZE;
-
-	kc = kmem_alloc(sizeof(*kc), KM_SLEEP);
-	kc->kc_pool_cache = pool_cache_init(size, align, 0, pcflags, name, NULL,
-	IPL_VM, _cache_ctor, NULL, kc);
-	kc->kc_size = size;
-	kc->kc_ctor = ctor;
-
-	return kc;
-}
-
 /* XXX extension */
 static inline struct kmem_cache *
 kmem_cache_create_dtor(const char *name, size_t size, size_t align,
@@ -230,7 +209,8 @@ kmem_cache_create_dtor(const char *name,
 
 	kc = kmem_alloc(sizeof(*kc), KM_SLEEP);
 	kc->kc_pool_cache = pool_cache_init(size, align, 0, pcflags, name, NULL,
-	IPL_VM, _cache_ctor, _cache_dtor, kc);
+	IPL_VM, _cache_ctor, dtor != NULL ? _cache_dtor : NULL,
+	kc);
 	kc->kc_size = size;
 	kc->kc_ctor = ctor;
 	kc->kc_dtor = dtor;
@@ -238,6 +218,13 @@ kmem_cache_create_dtor(const char *name,
 	return kc;
 }
 
+static inline struct kmem_cache *
+kmem_cache_create(const char *name, size_t size, size_t align,
+unsigned long flags, void (*ctor)(void *))
+{
+	return kmem_cache_create_dtor(name, size, align, flags, ctor, NULL);
+}
+
 #define	KMEM_CACHE(T, F)		  \
 	kmem_cache_create(#T, sizeof(struct T), __alignof__(struct T),	  \
 	(F), NULL)



CVS commit: src/sys/external/bsd/common/include/linux

2021-12-22 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Dec 22 18:04:54 UTC 2021

Modified Files:
src/sys/external/bsd/common/include/linux: slab.h

Log Message:
Reduce code duplication: kmem_cache_create() is now exactly the same as
kmem_cache_create_dtor() except for the dtor argument, so implement
the former in terms of the latter.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/external/bsd/common/include/linux/slab.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src

2021-12-22 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Dec 22 17:28:18 UTC 2021

Modified Files:
src/distrib/sets/lists/comp: mi
src/share/man/man9: Makefile pool.9 pool_cache.9

Log Message:
Document PR_PSERIALIZE.  Remove documentation for pool_cache_setpredestruct().


To generate a diff of this commit:
cvs rdiff -u -r1.2400 -r1.2401 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.459 -r1.460 src/share/man/man9/Makefile
cvs rdiff -u -r1.49 -r1.50 src/share/man/man9/pool.9
cvs rdiff -u -r1.23 -r1.24 src/share/man/man9/pool_cache.9

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.2400 src/distrib/sets/lists/comp/mi:1.2401
--- src/distrib/sets/lists/comp/mi:1.2400	Tue Dec 21 18:59:22 2021
+++ src/distrib/sets/lists/comp/mi	Wed Dec 22 17:28:17 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.2400 2021/12/21 18:59:22 thorpej Exp $
+#	$NetBSD: mi,v 1.2401 2021/12/22 17:28:17 thorpej Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.compcomp-sys-root
@@ -12282,7 +12282,7 @@
 ./usr/share/man/cat9/pool_cache_sethardlimit.0	comp-sys-catman		.cat
 ./usr/share/man/cat9/pool_cache_sethiwat.0	comp-sys-catman		.cat
 ./usr/share/man/cat9/pool_cache_setlowat.0	comp-sys-catman		.cat
-./usr/share/man/cat9/pool_cache_setpredestruct.0	comp-sys-catman		.cat
+./usr/share/man/cat9/pool_cache_setpredestruct.0	comp-obsolete	obsolete
 ./usr/share/man/cat9/pool_create.0		comp-sys-catman		.cat
 ./usr/share/man/cat9/pool_destroy.0		comp-sys-catman		.cat
 ./usr/share/man/cat9/pool_get.0			comp-sys-catman		.cat
@@ -20475,7 +20475,7 @@
 ./usr/share/man/html9/pool_cache_sethardlimit.html	comp-sys-htmlman	html
 ./usr/share/man/html9/pool_cache_sethiwat.html	comp-sys-htmlman	html
 ./usr/share/man/html9/pool_cache_setlowat.html	comp-sys-htmlman	html
-./usr/share/man/html9/pool_cache_setpredestruct.html	comp-sys-htmlman	html
+./usr/share/man/html9/pool_cache_setpredestruct.html	comp-obsolete	obsolete
 ./usr/share/man/html9/pool_create.html		comp-sys-htmlman	html
 ./usr/share/man/html9/pool_destroy.html		comp-sys-htmlman	html
 ./usr/share/man/html9/pool_get.html		comp-sys-htmlman	html
@@ -28829,7 +28829,7 @@
 ./usr/share/man/man9/pool_cache_sethardlimit.9	comp-sys-man		.man
 ./usr/share/man/man9/pool_cache_sethiwat.9	comp-sys-man		.man
 ./usr/share/man/man9/pool_cache_setlowat.9	comp-sys-man		.man
-./usr/share/man/man9/pool_cache_setpredestruct.9	comp-sys-man		.man
+./usr/share/man/man9/pool_cache_setpredestruct.9	comp-obsolete	obsolete
 ./usr/share/man/man9/pool_create.9		comp-sys-man		.man
 ./usr/share/man/man9/pool_destroy.9		comp-sys-man		.man
 ./usr/share/man/man9/pool_get.9			comp-sys-man		.man

Index: src/share/man/man9/Makefile
diff -u src/share/man/man9/Makefile:1.459 src/share/man/man9/Makefile:1.460
--- src/share/man/man9/Makefile:1.459	Tue Dec 21 18:59:22 2021
+++ src/share/man/man9/Makefile	Wed Dec 22 17:28:17 2021
@@ -1,4 +1,4 @@
-#   $NetBSD: Makefile,v 1.459 2021/12/21 18:59:22 thorpej Exp $
+#   $NetBSD: Makefile,v 1.460 2021/12/22 17:28:17 thorpej Exp $
 
 #	Makefile for section 9 (kernel function and variable) manual pages.
 
@@ -758,8 +758,7 @@ MLINKS+=pool_cache.9 pool_cache_init.9 \
 	pool_cache.9 pool_cache_invalidate.9 \
 	pool_cache.9 pool_cache_sethiwat.9 \
 	pool_cache.9 pool_cache_setlowat.9 \
-	pool_cache.9 pool_cache_sethardlimit.9 \
-	pool_cache.9 pool_cache_setpredestruct.9
+	pool_cache.9 pool_cache_sethardlimit.9
 MLINKS+=powerhook_establish.9 powerhook_disestablish.9
 MLINKS+=preempt.9 yield.9
 MLINKS+=pserialize.9 pserialize_create.9 \

Index: src/share/man/man9/pool.9
diff -u src/share/man/man9/pool.9:1.49 src/share/man/man9/pool.9:1.50
--- src/share/man/man9/pool.9:1.49	Mon Apr 13 08:59:14 2020
+++ src/share/man/man9/pool.9	Wed Dec 22 17:28:17 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: pool.9,v 1.49 2020/04/13 08:59:14 wiz Exp $
+.\"	$NetBSD: pool.9,v 1.50 2021/12/22 17:28:17 thorpej Exp $
 .\"
 .\" Copyright (c) 1997, 1998, 2007 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -98,12 +98,28 @@ The offset within an item to which the
 .Fa align
 parameter applies.
 .It Fa flags
-Should be set to zero or
-.Dv PR_NOTOUCH .
+Should be set to zero,
+.Dv PR_NOTOUCH ,
+or
+.Dv PR_PSERIALIZE .
 If
 .Dv PR_NOTOUCH
 is given, free items are never used to keep internal state so that
 the pool can be used for non memory backed objects.
+If
+.Dv PR_PSERIALIZE
+is given, then the allocator guarantees that a passive serialization
+barrier equivalent to
+.Dq xc_barrier(0)
+will be performed before the object's backing store is returned to
+the system.
+.Dv PR_PSERIALIZE
+implies
+.Dv PR_NOTOUCH .
+Because of the guarantees provided by
+.Dv PR_PSERIALIZE ,
+objects muste never be freed to a pool using this option from either
+hard or soft interrupt context, as doing so may block.
 .It 

CVS commit: src

2021-12-22 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Dec 22 17:28:18 UTC 2021

Modified Files:
src/distrib/sets/lists/comp: mi
src/share/man/man9: Makefile pool.9 pool_cache.9

Log Message:
Document PR_PSERIALIZE.  Remove documentation for pool_cache_setpredestruct().


To generate a diff of this commit:
cvs rdiff -u -r1.2400 -r1.2401 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.459 -r1.460 src/share/man/man9/Makefile
cvs rdiff -u -r1.49 -r1.50 src/share/man/man9/pool.9
cvs rdiff -u -r1.23 -r1.24 src/share/man/man9/pool_cache.9

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys

2021-12-22 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Dec 22 16:57:29 UTC 2021

Modified Files:
src/sys/external/bsd/common/include/linux: slab.h
src/sys/kern: kern_lwp.c subr_pool.c
src/sys/sys: pool.h

Log Message:
Do the last change differently:

Instead of having a pre-destruct hook, put knowledge of passive
serialization into the pool allocator directly, enabled by PR_PSERIALIZE
when the pool / pool_cache is initialized.  This will guarantee that
a passive serialization barrier will be performed before the object's
destructor is called, or before the page containing the object is freed
back to the system (in the case of no destructor).  Note that the internal
allocator overhead is different when PR_PSERIALIZE is used (it implies
PR_NOTOUCH, because the objects must remain in a valid state).

In the DRM Linux API shim, this allows us to remove the custom page
allocator for SLAB_TYPESAFE_BY_RCU.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/external/bsd/common/include/linux/slab.h
cvs rdiff -u -r1.245 -r1.246 src/sys/kern/kern_lwp.c
cvs rdiff -u -r1.278 -r1.279 src/sys/kern/subr_pool.c
cvs rdiff -u -r1.95 -r1.96 src/sys/sys/pool.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys

2021-12-22 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Dec 22 16:57:29 UTC 2021

Modified Files:
src/sys/external/bsd/common/include/linux: slab.h
src/sys/kern: kern_lwp.c subr_pool.c
src/sys/sys: pool.h

Log Message:
Do the last change differently:

Instead of having a pre-destruct hook, put knowledge of passive
serialization into the pool allocator directly, enabled by PR_PSERIALIZE
when the pool / pool_cache is initialized.  This will guarantee that
a passive serialization barrier will be performed before the object's
destructor is called, or before the page containing the object is freed
back to the system (in the case of no destructor).  Note that the internal
allocator overhead is different when PR_PSERIALIZE is used (it implies
PR_NOTOUCH, because the objects must remain in a valid state).

In the DRM Linux API shim, this allows us to remove the custom page
allocator for SLAB_TYPESAFE_BY_RCU.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/external/bsd/common/include/linux/slab.h
cvs rdiff -u -r1.245 -r1.246 src/sys/kern/kern_lwp.c
cvs rdiff -u -r1.278 -r1.279 src/sys/kern/subr_pool.c
cvs rdiff -u -r1.95 -r1.96 src/sys/sys/pool.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/common/include/linux/slab.h
diff -u src/sys/external/bsd/common/include/linux/slab.h:1.11 src/sys/external/bsd/common/include/linux/slab.h:1.12
--- src/sys/external/bsd/common/include/linux/slab.h:1.11	Tue Dec 21 19:07:09 2021
+++ src/sys/external/bsd/common/include/linux/slab.h	Wed Dec 22 16:57:29 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: slab.h,v 1.11 2021/12/21 19:07:09 thorpej Exp $	*/
+/*	$NetBSD: slab.h,v 1.12 2021/12/22 16:57:29 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -174,24 +174,6 @@ struct kmem_cache {
 	void		(*kc_dtor)(void *);
 };
 
-/* XXX These should be in .  */
-void *	pool_page_alloc(struct pool *, int);
-void	pool_page_free(struct pool *, void *);
-
-static void
-pool_page_free_rcu(struct pool *pp, void *v)
-{
-
-	synchronize_rcu();
-	pool_page_free(pp, v);
-}
-
-static struct pool_allocator pool_allocator_kmem_rcu = {
-	.pa_alloc = pool_page_alloc,
-	.pa_free = pool_page_free_rcu,
-	.pa_pagesz = 0,
-};
-
 static int
 kmem_cache_ctor(void *cookie, void *ptr, int flags __unused)
 {
@@ -212,26 +194,20 @@ kmem_cache_dtor(void *cookie, void *ptr)
 		(*kc->kc_dtor)(ptr);
 }
 
-static void
-kmem_cache_pre_dtor(void *cookie)
-{
-	synchronize_rcu();
-}
-
 static inline struct kmem_cache *
 kmem_cache_create(const char *name, size_t size, size_t align,
 unsigned long flags, void (*ctor)(void *))
 {
-	struct pool_allocator *palloc = NULL;
 	struct kmem_cache *kc;
+	int pcflags = 0;
 
 	if (ISSET(flags, SLAB_HWCACHE_ALIGN))
 		align = roundup(MAX(1, align), CACHE_LINE_SIZE);
 	if (ISSET(flags, SLAB_TYPESAFE_BY_RCU))
-		palloc = _allocator_kmem_rcu;
+		pcflags |= PR_PSERIALIZE;
 
 	kc = kmem_alloc(sizeof(*kc), KM_SLEEP);
-	kc->kc_pool_cache = pool_cache_init(size, align, 0, 0, name, palloc,
+	kc->kc_pool_cache = pool_cache_init(size, align, 0, pcflags, name, NULL,
 	IPL_VM, _cache_ctor, NULL, kc);
 	kc->kc_size = size;
 	kc->kc_ctor = ctor;
@@ -244,26 +220,20 @@ static inline struct kmem_cache *
 kmem_cache_create_dtor(const char *name, size_t size, size_t align,
 unsigned long flags, void (*ctor)(void *), void (*dtor)(void *))
 {
-	struct pool_allocator *palloc = NULL;
 	struct kmem_cache *kc;
+	int pcflags = 0;
 
 	if (ISSET(flags, SLAB_HWCACHE_ALIGN))
 		align = roundup(MAX(1, align), CACHE_LINE_SIZE);
-	/*
-	 * No need to use pool_allocator_kmem_rcu here; RCU synchronization
-	 * will be handled by the pre-destructor hook.
-	 */
+	if (ISSET(flags, SLAB_TYPESAFE_BY_RCU))
+		pcflags |= PR_PSERIALIZE;
 
 	kc = kmem_alloc(sizeof(*kc), KM_SLEEP);
-	kc->kc_pool_cache = pool_cache_init(size, align, 0, 0, name, palloc,
+	kc->kc_pool_cache = pool_cache_init(size, align, 0, pcflags, name, NULL,
 	IPL_VM, _cache_ctor, _cache_dtor, kc);
 	kc->kc_size = size;
 	kc->kc_ctor = ctor;
 	kc->kc_dtor = dtor;
-	if (ISSET(flags, SLAB_TYPESAFE_BY_RCU)) {
-		pool_cache_setpredestruct(kc->kc_pool_cache,
-		kmem_cache_pre_dtor);
-	}
 
 	return kc;
 }

Index: src/sys/kern/kern_lwp.c
diff -u src/sys/kern/kern_lwp.c:1.245 src/sys/kern/kern_lwp.c:1.246
--- src/sys/kern/kern_lwp.c:1.245	Tue Dec 21 19:00:37 2021
+++ src/sys/kern/kern_lwp.c	Wed Dec 22 16:57:28 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_lwp.c,v 1.245 2021/12/21 19:00:37 thorpej Exp $	*/
+/*	$NetBSD: kern_lwp.c,v 1.246 2021/12/22 16:57:28 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2006, 2007, 2008, 2009, 2019, 2020
@@ -217,7 +217,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.245 2021/12/21 19:00:37 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.246 2021/12/22 16:57:28 thorpej Exp $");
 
 #include "opt_ddb.h"
 #include 

CVS commit: src/usr.bin/xlint/lint1

2021-12-22 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Dec 22 15:47:42 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: lex.c

Log Message:
lint: remove redundant EOF tests in lexer

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 src/usr.bin/xlint/lint1/lex.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/lint1/lex.c
diff -u src/usr.bin/xlint/lint1/lex.c:1.94 src/usr.bin/xlint/lint1/lex.c:1.95
--- src/usr.bin/xlint/lint1/lex.c:1.94	Wed Dec 22 15:20:08 2021
+++ src/usr.bin/xlint/lint1/lex.c	Wed Dec 22 15:47:42 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.94 2021/12/22 15:20:08 rillig Exp $ */
+/* $NetBSD: lex.c,v 1.95 2021/12/22 15:47:42 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: lex.c,v 1.94 2021/12/22 15:20:08 rillig Exp $");
+__RCSID("$NetBSD: lex.c,v 1.95 2021/12/22 15:47:42 rillig Exp $");
 #endif
 
 #include 
@@ -945,12 +945,7 @@ get_escaped_char(int delim)
 warning(82);
 			v = 0;
 			n = 0;
-			/*
-			 * TODO: remove the redundant EOF test once the test
-			 *  controlling_expression_with_comma_operator is
-			 *  fixed in d_c99_bool_strict_syshdr.c.
-			 */
-			while ((c = inpc()) != EOF && isxdigit(c)) {
+			while (c = inpc(), isxdigit(c)) {
 c = isdigit(c) ?
 c - '0' : toupper(c) - 'A' + 10;
 v = (v << 4) + c;
@@ -1140,12 +1135,7 @@ lex_comment(void)
 	eoc = false;
 
 	/* Skip whitespace after the start of the comment */
-	/*
-	 * TODO: remove the redundant EOF test once the test
-	 *  controlling_expression_with_comma_operator is fixed in
-	 *  d_c99_bool_strict_syshdr.c.
-	 */
-	while ((c = inpc()) != EOF && isspace(c))
+	while (c = inpc(), isspace(c))
 		continue;
 
 	/* Read the potential keyword to keywd */



CVS commit: src/usr.bin/xlint/lint1

2021-12-22 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Dec 22 15:47:42 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: lex.c

Log Message:
lint: remove redundant EOF tests in lexer

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 src/usr.bin/xlint/lint1/lex.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src

2021-12-22 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Dec 22 15:36:38 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: d_c99_bool_strict_syshdr.c
d_c99_bool_strict_syshdr.exp
src/usr.bin/xlint/lint1: ckbool.c

Log Message:
lint: fix wrong error in strict bool mode in condition with comma

For the result of the comma operator, it doesn't matter whether the
comma itself comes from a system header or not.  Instead, it's the main
operator of the right operand.

Since 2021-11-16.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 \
src/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.c
cvs rdiff -u -r1.13 -r1.14 \
src/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.exp
cvs rdiff -u -r1.9 -r1.10 src/usr.bin/xlint/lint1/ckbool.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.c
diff -u src/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.c:1.11 src/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.c:1.12
--- src/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.c:1.11	Wed Dec 22 15:20:08 2021
+++ src/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.c	Wed Dec 22 15:36:37 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: d_c99_bool_strict_syshdr.c,v 1.11 2021/12/22 15:20:08 rillig Exp $	*/
+/*	$NetBSD: d_c99_bool_strict_syshdr.c,v 1.12 2021/12/22 15:36:37 rillig Exp $	*/
 # 3 "d_c99_bool_strict_syshdr.c"
 
 /*
@@ -181,6 +181,12 @@ str_equal_good(const char *s1, const cha
 
 int read_char(void);
 
+/*
+ * Between tree.c 1.395 from 2021-11-16 and ckbool.c 1.10 from 2021-12-22,
+ * lint wrongly complained that the controlling expression would have to be
+ * _Bool instead of int.  Since the right-hand side of the ',' operator comes
+ * from a system header, this is OK though.
+ */
 void
 controlling_expression_with_comma_operator(void)
 {
@@ -195,17 +201,5 @@ controlling_expression_with_comma_operat
 	)] & 0x0040 /* Space */))
 # 197 "c_c99_bool_strict_syshdr.c"
 	)
-	/* expect-1: error: controlling expression must be bool, not 'int' [333] */
 		continue;
-	/*
-	 * TODO: investigate why lint doesn't accept this call to isspace().
-	 *  It comes from a system header, therefore type 'int' should be OK.
-	 *  It is probably because the ',' of the controlling expression
-	 *  comes from the main source file, and lint assumes that the main
-	 *  operator of the controlling expression decides its outcome.  This
-	 *  assumption does not hold for the ',' operator since its result
-	 *  only depends on its right-hand operand.
-	 *
-	 *  Since tree.c 1.395 from 2021-11-16.
-	 */
 }

Index: src/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.exp
diff -u src/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.exp:1.13 src/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.exp:1.14
--- src/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.exp:1.13	Wed Dec 22 15:20:08 2021
+++ src/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.exp	Wed Dec 22 15:36:37 2021
@@ -4,4 +4,3 @@ d_c99_bool_strict_syshdr.c(80): error: o
 d_c99_bool_strict_syshdr.c(157): error: return value type mismatch (_Bool) and (int) [211]
 d_c99_bool_strict_syshdr.c(172): error: operand of '!' must be bool, not 'int' [330]
 d_c99_bool_strict_syshdr.c(172): warning: function 'str_equal_bad' expects to return value [214]
-c_c99_bool_strict_syshdr.c(197): error: controlling expression must be bool, not 'int' [333]

Index: src/usr.bin/xlint/lint1/ckbool.c
diff -u src/usr.bin/xlint/lint1/ckbool.c:1.9 src/usr.bin/xlint/lint1/ckbool.c:1.10
--- src/usr.bin/xlint/lint1/ckbool.c:1.9	Tue Nov 16 21:01:05 2021
+++ src/usr.bin/xlint/lint1/ckbool.c	Wed Dec 22 15:36:37 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ckbool.c,v 1.9 2021/11/16 21:01:05 rillig Exp $ */
+/* $NetBSD: ckbool.c,v 1.10 2021/12/22 15:36:37 rillig Exp $ */
 
 /*-
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #include 
 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: ckbool.c,v 1.9 2021/11/16 21:01:05 rillig Exp $");
+__RCSID("$NetBSD: ckbool.c,v 1.10 2021/12/22 15:36:37 rillig Exp $");
 #endif
 
 #include 
@@ -49,6 +49,7 @@ __RCSID("$NetBSD: ckbool.c,v 1.9 2021/11
  * See d_c99_bool_strict.c for the exact rules and for examples.
  */
 
+
 static const char *
 op_name(op_t op)
 {
@@ -215,6 +216,8 @@ is_typeok_bool_operand(const tnode_t *tn
 
 	lint_assert(Tflag);
 
+	while (tn->tn_op == COMMA)
+		tn = tn->tn_right;
 	tn = before_conversion(tn);
 	t = tn->tn_type->t_tspec;
 



CVS commit: src

2021-12-22 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Dec 22 15:36:38 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: d_c99_bool_strict_syshdr.c
d_c99_bool_strict_syshdr.exp
src/usr.bin/xlint/lint1: ckbool.c

Log Message:
lint: fix wrong error in strict bool mode in condition with comma

For the result of the comma operator, it doesn't matter whether the
comma itself comes from a system header or not.  Instead, it's the main
operator of the right operand.

Since 2021-11-16.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 \
src/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.c
cvs rdiff -u -r1.13 -r1.14 \
src/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.exp
cvs rdiff -u -r1.9 -r1.10 src/usr.bin/xlint/lint1/ckbool.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src

2021-12-22 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Dec 22 15:20:08 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: d_c99_bool_strict_syshdr.c
d_c99_bool_strict_syshdr.exp
src/usr.bin/xlint/lint1: lex.c lint1.h

Log Message:
lint: clean up lex.c

Rename 'struct kwtab' to 'struct keyword' since a single keyword is not
a whole keyword table.

Sync comment for lex_name with reality: sbuf_t no longer contains the
hash value.

Remove redundant tests for EOF, as EOF is neither a space nor a digit
nor an xdigit.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 \
src/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.c
cvs rdiff -u -r1.12 -r1.13 \
src/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.exp
cvs rdiff -u -r1.93 -r1.94 src/usr.bin/xlint/lint1/lex.c
cvs rdiff -u -r1.132 -r1.133 src/usr.bin/xlint/lint1/lint1.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.c
diff -u src/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.c:1.10 src/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.c:1.11
--- src/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.c:1.10	Tue Dec 21 16:25:14 2021
+++ src/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.c	Wed Dec 22 15:20:08 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: d_c99_bool_strict_syshdr.c,v 1.10 2021/12/21 16:25:14 rillig Exp $	*/
+/*	$NetBSD: d_c99_bool_strict_syshdr.c,v 1.11 2021/12/22 15:20:08 rillig Exp $	*/
 # 3 "d_c99_bool_strict_syshdr.c"
 
 /*
@@ -177,3 +177,35 @@ str_equal_good(const char *s1, const cha
 {
 	return strcmp(s1, s2) == 0;
 }
+
+
+int read_char(void);
+
+void
+controlling_expression_with_comma_operator(void)
+{
+	int c;
+
+	while (c = read_char(),
+# 191 "c_c99_bool_strict_syshdr.c" 3 4
+	((int)((ctype_table + 1)[(
+# 193 "c_c99_bool_strict_syshdr.c"
+		c
+# 195 "c_c99_bool_strict_syshdr.c" 3 4
+	)] & 0x0040 /* Space */))
+# 197 "c_c99_bool_strict_syshdr.c"
+	)
+	/* expect-1: error: controlling expression must be bool, not 'int' [333] */
+		continue;
+	/*
+	 * TODO: investigate why lint doesn't accept this call to isspace().
+	 *  It comes from a system header, therefore type 'int' should be OK.
+	 *  It is probably because the ',' of the controlling expression
+	 *  comes from the main source file, and lint assumes that the main
+	 *  operator of the controlling expression decides its outcome.  This
+	 *  assumption does not hold for the ',' operator since its result
+	 *  only depends on its right-hand operand.
+	 *
+	 *  Since tree.c 1.395 from 2021-11-16.
+	 */
+}

Index: src/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.exp
diff -u src/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.exp:1.12 src/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.exp:1.13
--- src/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.exp:1.12	Tue Dec 21 16:25:14 2021
+++ src/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.exp	Wed Dec 22 15:20:08 2021
@@ -4,3 +4,4 @@ d_c99_bool_strict_syshdr.c(80): error: o
 d_c99_bool_strict_syshdr.c(157): error: return value type mismatch (_Bool) and (int) [211]
 d_c99_bool_strict_syshdr.c(172): error: operand of '!' must be bool, not 'int' [330]
 d_c99_bool_strict_syshdr.c(172): warning: function 'str_equal_bad' expects to return value [214]
+c_c99_bool_strict_syshdr.c(197): error: controlling expression must be bool, not 'int' [333]

Index: src/usr.bin/xlint/lint1/lex.c
diff -u src/usr.bin/xlint/lint1/lex.c:1.93 src/usr.bin/xlint/lint1/lex.c:1.94
--- src/usr.bin/xlint/lint1/lex.c:1.93	Wed Dec 22 14:49:11 2021
+++ src/usr.bin/xlint/lint1/lex.c	Wed Dec 22 15:20:08 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.93 2021/12/22 14:49:11 rillig Exp $ */
+/* $NetBSD: lex.c,v 1.94 2021/12/22 15:20:08 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: lex.c,v 1.93 2021/12/22 14:49:11 rillig Exp $");
+__RCSID("$NetBSD: lex.c,v 1.94 2021/12/22 15:20:08 rillig Exp $");
 #endif
 
 #include 
@@ -64,9 +64,8 @@ pos_t	curr_pos = { "", 1, 0 };
  */
 pos_t	csrc_pos = { "", 1, 0 };
 
-bool in_gcc_attribute;		/* Are we parsing a gcc attribute? */
-
-bool in_system_header = false;
+bool in_gcc_attribute;
+bool in_system_header;
 
 static	sbuf_t *allocsb(void);
 static	void	freesb(sbuf_t *);
@@ -115,11 +114,8 @@ lex_unknown_character(int c)
 #define kwdef_gcc_attr(name, token) \
 	kwdef(name, token, 0, 0, 0,		0, 0, 1, 1, 5)
 
-/*
- * Keywords.
- * During initialization they are written to the symbol table.
- */
-static	struct	kwtab {
+/* During initialization, these keywords are written to the symbol table. */
+static struct keyword {
 	const	char *kw_name;	/* keyword */
 	int	kw_token;	/* token returned by yylex() */
 	scl_t	kw_scl;		/* storage class if kw_token 

CVS commit: src

2021-12-22 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Dec 22 15:20:08 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: d_c99_bool_strict_syshdr.c
d_c99_bool_strict_syshdr.exp
src/usr.bin/xlint/lint1: lex.c lint1.h

Log Message:
lint: clean up lex.c

Rename 'struct kwtab' to 'struct keyword' since a single keyword is not
a whole keyword table.

Sync comment for lex_name with reality: sbuf_t no longer contains the
hash value.

Remove redundant tests for EOF, as EOF is neither a space nor a digit
nor an xdigit.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 \
src/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.c
cvs rdiff -u -r1.12 -r1.13 \
src/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.exp
cvs rdiff -u -r1.93 -r1.94 src/usr.bin/xlint/lint1/lex.c
cvs rdiff -u -r1.132 -r1.133 src/usr.bin/xlint/lint1/lint1.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src

2021-12-22 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Dec 22 14:49:11 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: d_c99_init.c decl_struct_member.c
src/usr.bin/xlint/common: lint.h
src/usr.bin/xlint/lint1: lex.c lint1.h
src/usr.bin/xlint/lint2: lint2.h

Log Message:
lint: remove spaces around bit-field colon

As seen in /usr/share/misc/style.

No binary change.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/tests/usr.bin/xlint/lint1/d_c99_init.c
cvs rdiff -u -r1.12 -r1.13 src/tests/usr.bin/xlint/lint1/decl_struct_member.c
cvs rdiff -u -r1.33 -r1.34 src/usr.bin/xlint/common/lint.h
cvs rdiff -u -r1.92 -r1.93 src/usr.bin/xlint/lint1/lex.c
cvs rdiff -u -r1.131 -r1.132 src/usr.bin/xlint/lint1/lint1.h
cvs rdiff -u -r1.20 -r1.21 src/usr.bin/xlint/lint2/lint2.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/usr.bin/xlint/lint1/d_c99_init.c
diff -u src/tests/usr.bin/xlint/lint1/d_c99_init.c:1.37 src/tests/usr.bin/xlint/lint1/d_c99_init.c:1.38
--- src/tests/usr.bin/xlint/lint1/d_c99_init.c:1.37	Wed Dec 22 14:32:31 2021
+++ src/tests/usr.bin/xlint/lint1/d_c99_init.c	Wed Dec 22 14:49:11 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: d_c99_init.c,v 1.37 2021/12/22 14:32:31 rillig Exp $	*/
+/*	$NetBSD: d_c99_init.c,v 1.38 2021/12/22 14:49:11 rillig Exp $	*/
 # 3 "d_c99_init.c"
 
 /*
@@ -224,7 +224,7 @@ struct geometry geometry = {
 
 struct ends_with_unnamed_bit_field {
 	int member;
-	int : 0;
+	int:0;
 } ends_with_unnamed_bit_field = {
 	12345,
 	/* expect+1: too many struct/union initializers */
@@ -442,7 +442,7 @@ struct point unknown_member_on_scalar = 
 };
 
 struct {
-	int : 16;
+	int:16;
 	/* expect+2: warning: structure has no named members [65] */
 	/* expect+1: error: cannot initialize struct/union with no named member [179] */
 } struct_with_only_unnamed_members = {
@@ -450,7 +450,7 @@ struct {
 };
 
 union {
-	int : 16;
+	int:16;
 	/* expect+2: warning: union has no named members [65] */
 	/* expect+1: error: cannot initialize struct/union with no named member [179] */
 } union_with_only_unnamed_members = {

Index: src/tests/usr.bin/xlint/lint1/decl_struct_member.c
diff -u src/tests/usr.bin/xlint/lint1/decl_struct_member.c:1.12 src/tests/usr.bin/xlint/lint1/decl_struct_member.c:1.13
--- src/tests/usr.bin/xlint/lint1/decl_struct_member.c:1.12	Sun Sep  5 11:42:32 2021
+++ src/tests/usr.bin/xlint/lint1/decl_struct_member.c	Wed Dec 22 14:49:11 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: decl_struct_member.c,v 1.12 2021/09/05 11:42:32 rillig Exp $	*/
+/*	$NetBSD: decl_struct_member.c,v 1.13 2021/12/22 14:49:11 rillig Exp $	*/
 # 3 "decl_struct_member.c"
 
 struct multi_attributes {
@@ -52,8 +52,8 @@ struct cover_notype_struct_declarators {
 };
 
 struct cover_notype_struct_declarator_bit_field {
-	const a: 3, : 0, b: 4;
-	const : 0;
+	const a:3, :0, b:4;
+	const:0;
 };
 
 /*

Index: src/usr.bin/xlint/common/lint.h
diff -u src/usr.bin/xlint/common/lint.h:1.33 src/usr.bin/xlint/common/lint.h:1.34
--- src/usr.bin/xlint/common/lint.h:1.33	Mon Nov  1 19:48:51 2021
+++ src/usr.bin/xlint/common/lint.h	Wed Dec 22 14:49:11 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: lint.h,v 1.33 2021/11/01 19:48:51 rillig Exp $	*/
+/*	$NetBSD: lint.h,v 1.34 2021/12/22 14:49:11 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -99,13 +99,13 @@ typedef	struct {
 #endif
 	tspec_t	tt_signed_counterpart;
 	tspec_t	tt_unsigned_counterpart;
-	bool	tt_is_integer : 1;	/* integer type */
+	bool	tt_is_integer:1;	/* integer type */
 #ifdef IS_LINT1
-	bool	tt_is_uinteger : 1;	/* unsigned integer type */
-	bool	tt_is_floating : 1;	/* floating point type */
-	bool	tt_is_arithmetic : 1;	/* arithmetic type */
-	bool	tt_is_scalar : 1;	/* scalar type */
-	bool	tt_is_complex : 1;	/* complex type */
+	bool	tt_is_uinteger:1;	/* unsigned integer type */
+	bool	tt_is_floating:1;	/* floating point type */
+	bool	tt_is_arithmetic:1;	/* arithmetic type */
+	bool	tt_is_scalar:1;		/* scalar type */
+	bool	tt_is_complex:1;	/* complex type */
 #endif
 	const char *tt_name;		/* name of the type */
 } ttab_t;

Index: src/usr.bin/xlint/lint1/lex.c
diff -u src/usr.bin/xlint/lint1/lex.c:1.92 src/usr.bin/xlint/lint1/lex.c:1.93
--- src/usr.bin/xlint/lint1/lex.c:1.92	Wed Dec 22 14:38:34 2021
+++ src/usr.bin/xlint/lint1/lex.c	Wed Dec 22 14:49:11 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.92 2021/12/22 14:38:34 rillig Exp $ */
+/* $NetBSD: lex.c,v 1.93 2021/12/22 14:49:11 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: lex.c,v 1.92 2021/12/22 14:38:34 rillig Exp $");
+__RCSID("$NetBSD: lex.c,v 1.93 2021/12/22 14:49:11 rillig Exp $");
 #endif
 
 #include 
@@ -126,13 +126,13 @@ static	struct	kwtab {
 	tspec_t	kw_tspec;	/* type spec. if kw_token
  * T_TYPE or T_STRUCT_OR_UNION */
 	

CVS commit: src

2021-12-22 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Dec 22 14:49:11 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: d_c99_init.c decl_struct_member.c
src/usr.bin/xlint/common: lint.h
src/usr.bin/xlint/lint1: lex.c lint1.h
src/usr.bin/xlint/lint2: lint2.h

Log Message:
lint: remove spaces around bit-field colon

As seen in /usr/share/misc/style.

No binary change.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/tests/usr.bin/xlint/lint1/d_c99_init.c
cvs rdiff -u -r1.12 -r1.13 src/tests/usr.bin/xlint/lint1/decl_struct_member.c
cvs rdiff -u -r1.33 -r1.34 src/usr.bin/xlint/common/lint.h
cvs rdiff -u -r1.92 -r1.93 src/usr.bin/xlint/lint1/lex.c
cvs rdiff -u -r1.131 -r1.132 src/usr.bin/xlint/lint1/lint1.h
cvs rdiff -u -r1.20 -r1.21 src/usr.bin/xlint/lint2/lint2.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/xlint/lint1

2021-12-22 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Dec 22 14:38:34 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: lex.c

Log Message:
lint: rename C89 to C90 in variable names

No binary change.


To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.92 src/usr.bin/xlint/lint1/lex.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/lint1/lex.c
diff -u src/usr.bin/xlint/lint1/lex.c:1.91 src/usr.bin/xlint/lint1/lex.c:1.92
--- src/usr.bin/xlint/lint1/lex.c:1.91	Wed Dec 22 14:25:35 2021
+++ src/usr.bin/xlint/lint1/lex.c	Wed Dec 22 14:38:34 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.91 2021/12/22 14:25:35 rillig Exp $ */
+/* $NetBSD: lex.c,v 1.92 2021/12/22 14:38:34 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: lex.c,v 1.91 2021/12/22 14:25:35 rillig Exp $");
+__RCSID("$NetBSD: lex.c,v 1.92 2021/12/22 14:38:34 rillig Exp $");
 #endif
 
 #include 
@@ -96,20 +96,20 @@ lex_unknown_character(int c)
 	error(250, c);
 }
 
-#define kwdef(name, token, scl, tspec, tqual,	c89, c99, gcc, attr, deco) \
+#define kwdef(name, token, scl, tspec, tqual,	c90, c99, gcc, attr, deco) \
 	{ \
 		name, token, scl, tspec, tqual, \
-		(c89) > 0, (c99) > 0, (gcc) > 0, (attr) > 0, \
+		(c90) > 0, (c99) > 0, (gcc) > 0, (attr) > 0, \
 		((deco) & 1) != 0, ((deco) & 2) != 0, ((deco) & 4) != 0, \
 	}
-#define kwdef_token(name, token,		c89, c99, gcc, attr, deco) \
-	kwdef(name, token, 0, 0, 0,		c89, c99, gcc, attr, deco)
-#define kwdef_sclass(name, sclass,		c89, c99, gcc, attr, deco) \
-	kwdef(name, T_SCLASS, sclass, 0, 0,	c89, c99, gcc, attr, deco)
-#define kwdef_type(name, tspec,			c89, c99, gcc, attr, deco) \
-	kwdef(name, T_TYPE, 0, tspec, 0,	c89, c99, gcc, attr, deco)
-#define kwdef_tqual(name, tqual,		c89, c99, gcc, attr, deco) \
-	kwdef(name, T_QUAL, 0, 0, tqual,	c89, c99, gcc, attr, deco)
+#define kwdef_token(name, token,		c90, c99, gcc, attr, deco) \
+	kwdef(name, token, 0, 0, 0,		c90, c99, gcc, attr, deco)
+#define kwdef_sclass(name, sclass,		c90, c99, gcc, attr, deco) \
+	kwdef(name, T_SCLASS, sclass, 0, 0,	c90, c99, gcc, attr, deco)
+#define kwdef_type(name, tspec,			c90, c99, gcc, attr, deco) \
+	kwdef(name, T_TYPE, 0, tspec, 0,	c90, c99, gcc, attr, deco)
+#define kwdef_tqual(name, tqual,		c90, c99, gcc, attr, deco) \
+	kwdef(name, T_QUAL, 0, 0, tqual,	c90, c99, gcc, attr, deco)
 #define kwdef_keyword(name, token) \
 	kwdef(name, token, 0, 0, 0,		0, 0, 0, 0, 1)
 #define kwdef_gcc_attr(name, token) \
@@ -126,7 +126,7 @@ static	struct	kwtab {
 	tspec_t	kw_tspec;	/* type spec. if kw_token
  * T_TYPE or T_STRUCT_OR_UNION */
 	tqual_t	kw_tqual;	/* type qual. if kw_token T_QUAL */
-	bool	kw_c89 : 1;	/* C89 keyword */
+	bool	kw_c90 : 1;	/* C90 keyword */
 	bool	kw_c99 : 1;	/* C99 keyword */
 	bool	kw_gcc : 1;	/* GCC keyword */
 	bool	kw_attr : 1;	/* GCC attribute, keyword */
@@ -330,7 +330,7 @@ initscan(void)
 	struct	kwtab *kw;
 
 	for (kw = kwtab; kw->kw_name != NULL; kw++) {
-		if ((kw->kw_c89 || kw->kw_c99) && tflag)
+		if ((kw->kw_c90 || kw->kw_c99) && tflag)
 			continue;
 		if (kw->kw_c99 && !(Sflag || gflag))
 			continue;



CVS commit: src/usr.bin/xlint/lint1

2021-12-22 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Dec 22 14:38:34 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: lex.c

Log Message:
lint: rename C89 to C90 in variable names

No binary change.


To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.92 src/usr.bin/xlint/lint1/lex.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/xlint/lint1

2021-12-22 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Dec 22 14:35:23 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: init.c

Log Message:
lint: clean up initialization

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.229 -r1.230 src/usr.bin/xlint/lint1/init.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/lint1/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.229 src/usr.bin/xlint/lint1/init.c:1.230
--- src/usr.bin/xlint/lint1/init.c:1.229	Wed Dec 22 00:45:53 2021
+++ src/usr.bin/xlint/lint1/init.c	Wed Dec 22 14:35:23 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.229 2021/12/22 00:45:53 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.230 2021/12/22 14:35:23 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.229 2021/12/22 00:45:53 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.230 2021/12/22 14:35:23 rillig Exp $");
 #endif
 
 #include 
@@ -976,7 +976,7 @@ initialization_init_array_from_string(in
 	if (bl != NULL)
 		brace_level_advance(bl, >in_max_subscript);
 
-	if (tp == in->in_sym->s_type && tp->t_incomplete_array)
+	if (tp->t_incomplete_array)
 		update_type_of_array_of_unknown_size(in->in_sym, len + 1);
 
 	return true;
@@ -998,8 +998,7 @@ initialization_expr(initialization *in, 
 	debug_enter();
 
 	bl = in->in_brace_level;
-	if (bl != NULL &&
-	!brace_level_goto(bl, tn, >in_max_subscript)) {
+	if (bl != NULL && !brace_level_goto(bl, tn, >in_max_subscript)) {
 		in->in_err = true;
 		goto done;
 	}



CVS commit: src/usr.bin/xlint/lint1

2021-12-22 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Dec 22 14:35:23 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: init.c

Log Message:
lint: clean up initialization

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.229 -r1.230 src/usr.bin/xlint/lint1/init.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/usr.bin/xlint/lint1

2021-12-22 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Dec 22 14:32:31 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: d_c99_init.c

Log Message:
tests/lint: improve test for initialization of array of unknown size

Previously, the test didn't show that the size of the resulting object
was updated too early.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/tests/usr.bin/xlint/lint1/d_c99_init.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/usr.bin/xlint/lint1/d_c99_init.c
diff -u src/tests/usr.bin/xlint/lint1/d_c99_init.c:1.36 src/tests/usr.bin/xlint/lint1/d_c99_init.c:1.37
--- src/tests/usr.bin/xlint/lint1/d_c99_init.c:1.36	Wed Dec 22 00:45:53 2021
+++ src/tests/usr.bin/xlint/lint1/d_c99_init.c	Wed Dec 22 14:32:31 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: d_c99_init.c,v 1.36 2021/12/22 00:45:53 rillig Exp $	*/
+/*	$NetBSD: d_c99_init.c,v 1.37 2021/12/22 14:32:31 rillig Exp $	*/
 # 3 "d_c99_init.c"
 
 /*
@@ -182,11 +182,11 @@ struct point points[] = {
 		 * yet since its type is still incomplete.  Lint could warn
 		 * about this, but GCC and Clang already do.
 		 *
-		 * This test case demonstrates that in
-		 * extend_if_array_of_unknown_size, setcomplete is called too
-		 * early.
+		 * Before init.c 1.179 from 2021.03.30, the type information
+		 * of 'points' was set too early, resulting in a negative
+		 * array size below.
 		 */
-		sizeof(points),
+		sizeof(int[-(int)sizeof(points)]),
 		4
 	}
 };



CVS commit: src/tests/usr.bin/xlint/lint1

2021-12-22 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Dec 22 14:32:31 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: d_c99_init.c

Log Message:
tests/lint: improve test for initialization of array of unknown size

Previously, the test didn't show that the size of the resulting object
was updated too early.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/tests/usr.bin/xlint/lint1/d_c99_init.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src

2021-12-22 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Dec 22 14:25:35 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_035.c msg_265.c msg_265.exp
msg_312.c msg_312.exp
src/usr.bin/xlint/lint1: decl.c err.c lex.c

Log Message:
lint: use C90 instead of C89 when referring to the C standard


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/tests/usr.bin/xlint/lint1/msg_035.c
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_265.c
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_265.exp \
src/tests/usr.bin/xlint/lint1/msg_312.c \
src/tests/usr.bin/xlint/lint1/msg_312.exp
cvs rdiff -u -r1.242 -r1.243 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.150 -r1.151 src/usr.bin/xlint/lint1/err.c
cvs rdiff -u -r1.90 -r1.91 src/usr.bin/xlint/lint1/lex.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/usr.bin/xlint/lint1/msg_035.c
diff -u src/tests/usr.bin/xlint/lint1/msg_035.c:1.9 src/tests/usr.bin/xlint/lint1/msg_035.c:1.10
--- src/tests/usr.bin/xlint/lint1/msg_035.c:1.9	Sun May  2 21:22:09 2021
+++ src/tests/usr.bin/xlint/lint1/msg_035.c	Wed Dec 22 14:25:35 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_035.c,v 1.9 2021/05/02 21:22:09 rillig Exp $	*/
+/*	$NetBSD: msg_035.c,v 1.10 2021/12/22 14:25:35 rillig Exp $	*/
 # 3 "msg_035.c"
 
 // Test for message: illegal bit-field type '%s' [35]
@@ -9,7 +9,7 @@
 /*
  * In traditional C, only unsigned int is a portable bit-field type.
  *
- * In C89, only int, signed int and unsigned int are allowed (3.5.2.1p7).
+ * In C90, only int, signed int and unsigned int are allowed (3.5.2.1p7).
  *
  * In C99 and C11, only _Bool, signed int and unsigned int are allowed,
  * plus implementation-defined types (6.7.2.1p5).

Index: src/tests/usr.bin/xlint/lint1/msg_265.c
diff -u src/tests/usr.bin/xlint/lint1/msg_265.c:1.3 src/tests/usr.bin/xlint/lint1/msg_265.c:1.4
--- src/tests/usr.bin/xlint/lint1/msg_265.c:1.3	Sun Jan 31 11:12:07 2021
+++ src/tests/usr.bin/xlint/lint1/msg_265.c	Wed Dec 22 14:25:35 2021
@@ -1,13 +1,16 @@
-/*	$NetBSD: msg_265.c,v 1.3 2021/01/31 11:12:07 rillig Exp $	*/
+/*	$NetBSD: msg_265.c,v 1.4 2021/12/22 14:25:35 rillig Exp $	*/
 # 3 "msg_265.c"
 
-/* Test for message: %s C does not support 'long long' [265] */
+/* Test for message: %s does not support 'long long' [265] */
 
 /* lint1-flags: -w */
 
-long long unsupported_variable;			/* expect: 265 */
+/* expect+1: C90 does not support 'long long' [265] */
+long long unsupported_variable;
 
 /*LONGLONG*/
-long long suppressed_variable;
+long long suppressed_variable,
+second_suppressed_variable;
 
-long long another_unsupported_variable;		/* expect: 265 */
+/* expect+1: C90 does not support 'long long' [265] */
+long long another_unsupported_variable;

Index: src/tests/usr.bin/xlint/lint1/msg_265.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_265.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_265.exp:1.3
--- src/tests/usr.bin/xlint/lint1/msg_265.exp:1.2	Sun Jan  3 20:20:01 2021
+++ src/tests/usr.bin/xlint/lint1/msg_265.exp	Wed Dec 22 14:25:35 2021
@@ -1,2 +1,2 @@
-msg_265.c(8): warning: c89 C does not support 'long long' [265]
-msg_265.c(13): warning: c89 C does not support 'long long' [265]
+msg_265.c(9): warning: C90 does not support 'long long' [265]
+msg_265.c(16): warning: C90 does not support 'long long' [265]
Index: src/tests/usr.bin/xlint/lint1/msg_312.c
diff -u src/tests/usr.bin/xlint/lint1/msg_312.c:1.2 src/tests/usr.bin/xlint/lint1/msg_312.c:1.3
--- src/tests/usr.bin/xlint/lint1/msg_312.c:1.2	Sun Feb 21 09:07:58 2021
+++ src/tests/usr.bin/xlint/lint1/msg_312.c	Wed Dec 22 14:25:35 2021
@@ -1,7 +1,9 @@
-/*	$NetBSD: msg_312.c,v 1.2 2021/02/21 09:07:58 rillig Exp $	*/
+/*	$NetBSD: msg_312.c,v 1.3 2021/12/22 14:25:35 rillig Exp $	*/
 # 3 "msg_312.c"
 
-// Test for message: %s C does not support // comments [312]
+/* Test for message: %s does not support // comments [312] */
 
-TODO: "Add example code that triggers the above message." /* expect: 249 */
-TODO: "Add example code that almost triggers the above message."
+/* lint1-flags: -tw */
+
+/* expect+1: traditional C does not support // comments [312] */
+// C99 comment
Index: src/tests/usr.bin/xlint/lint1/msg_312.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_312.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_312.exp:1.3
--- src/tests/usr.bin/xlint/lint1/msg_312.exp:1.2	Sun Mar 21 20:45:00 2021
+++ src/tests/usr.bin/xlint/lint1/msg_312.exp	Wed Dec 22 14:25:35 2021
@@ -1 +1 @@
-msg_312.c(6): error: syntax error ':' [249]
+msg_312.c(9): warning: traditional C does not support // comments [312]

Index: src/usr.bin/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.242 src/usr.bin/xlint/lint1/decl.c:1.243
--- src/usr.bin/xlint/lint1/decl.c:1.242	Mon Nov  1 19:10:07 2021
+++ src/usr.bin/xlint/lint1/decl.c	Wed Dec 22 14:25:35 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.242 2021/11/01 

CVS commit: src

2021-12-22 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Dec 22 14:25:35 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_035.c msg_265.c msg_265.exp
msg_312.c msg_312.exp
src/usr.bin/xlint/lint1: decl.c err.c lex.c

Log Message:
lint: use C90 instead of C89 when referring to the C standard


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/tests/usr.bin/xlint/lint1/msg_035.c
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_265.c
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_265.exp \
src/tests/usr.bin/xlint/lint1/msg_312.c \
src/tests/usr.bin/xlint/lint1/msg_312.exp
cvs rdiff -u -r1.242 -r1.243 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.150 -r1.151 src/usr.bin/xlint/lint1/err.c
cvs rdiff -u -r1.90 -r1.91 src/usr.bin/xlint/lint1/lex.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/usr.bin/xlint/lint1

2021-12-22 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Dec 22 14:11:15 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: d_init_array_using_string.c

Log Message:
tests/lint: fix space-tab indentation


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 \
src/tests/usr.bin/xlint/lint1/d_init_array_using_string.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/usr.bin/xlint/lint1/d_init_array_using_string.c
diff -u src/tests/usr.bin/xlint/lint1/d_init_array_using_string.c:1.8 src/tests/usr.bin/xlint/lint1/d_init_array_using_string.c:1.9
--- src/tests/usr.bin/xlint/lint1/d_init_array_using_string.c:1.8	Wed Dec 22 00:45:53 2021
+++ src/tests/usr.bin/xlint/lint1/d_init_array_using_string.c	Wed Dec 22 14:11:14 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: d_init_array_using_string.c,v 1.8 2021/12/22 00:45:53 rillig Exp $	*/
+/*	$NetBSD: d_init_array_using_string.c,v 1.9 2021/12/22 14:11:14 rillig Exp $	*/
 # 3 "d_init_array_using_string.c"
 
 /*
@@ -70,9 +70,9 @@ test_array_initialization_in_struct(void
 	};
 
 	struct cs_ws too_many_characters = {
-		/* expect+1: warning: string literal too long (11) for target array (10) */
+		/* expect+1: warning: string literal too long (11) for target array (10) */
 		"0123456789X",
-		/* expect+1: warning: string literal too long (11) for target array (10) */
+		/* expect+1: warning: string literal too long (11) for target array (10) */
 		L"0123456789X",
 	};
 



CVS commit: src/tests/usr.bin/xlint/lint1

2021-12-22 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Dec 22 14:11:15 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: d_init_array_using_string.c

Log Message:
tests/lint: fix space-tab indentation


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 \
src/tests/usr.bin/xlint/lint1/d_init_array_using_string.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/external/cddl/osnet/dist/uts/common/fs/zfs

2021-12-22 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Wed Dec 22 14:04:10 UTC 2021

Modified Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs: zfs_vnops.c

Log Message:
In zfs_setattr() don't recheck the auth policy for a "nodump" flags
change. zfs_netbsd_setattr() has already checked if this request is
authorised, and our secpolicy_xvattr() doesn't check kauth chflags.

XXX: Fix this propery when we migrate to openzfs.

riastradh@: Seems reasonable.


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.76 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.77
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.76	Wed Oct 20 03:08:19 2021
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c	Wed Dec 22 14:04:10 2021
@@ -3503,7 +3503,17 @@ zfs_setattr(vnode_t *vp, vattr_t *vap, i
 		if (XVA_ISSET_REQ(xvap, XAT_NODUMP)) {
 			if (xoap->xoa_nodump !=
 			((zp->z_pflags & ZFS_NODUMP) != 0)) {
+#if 0
+/*
+ * XXXSB - zfs_netbsd_setattr()
+ * has already checked if this
+ * request is authorised, and our
+ * secpolicy_xvattr() doesn't check
+ * kauth chflags.  Fix this when we
+ * migrate to openzfs.
+ */
 need_policy = TRUE;
+#endif
 			} else {
 XVA_CLR_REQ(xvap, XAT_NODUMP);
 XVA_SET_REQ(, XAT_NODUMP);



CVS commit: src/external/cddl/osnet/dist/uts/common/fs/zfs

2021-12-22 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Wed Dec 22 14:04:10 UTC 2021

Modified Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs: zfs_vnops.c

Log Message:
In zfs_setattr() don't recheck the auth policy for a "nodump" flags
change. zfs_netbsd_setattr() has already checked if this request is
authorised, and our secpolicy_xvattr() doesn't check kauth chflags.

XXX: Fix this propery when we migrate to openzfs.

riastradh@: Seems reasonable.


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/external/bsd/drm2/dist/include/drm

2021-12-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Dec 22 12:05:24 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/dist/include/drm: drm_device.h

Log Message:
drm: Omit local diff -- vmem is entirely a NetBSDism.

Use struct vmem rather than vmem_t to obviate need for header file
dependency.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 \
src/sys/external/bsd/drm2/dist/include/drm/drm_device.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/dist/include/drm/drm_device.h
diff -u src/sys/external/bsd/drm2/dist/include/drm/drm_device.h:1.9 src/sys/external/bsd/drm2/dist/include/drm/drm_device.h:1.10
--- src/sys/external/bsd/drm2/dist/include/drm/drm_device.h:1.9	Tue Dec 21 12:28:34 2021
+++ src/sys/external/bsd/drm2/dist/include/drm/drm_device.h	Wed Dec 22 12:05:24 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_device.h,v 1.9 2021/12/21 12:28:34 tnn Exp $	*/
+/*	$NetBSD: drm_device.h,v 1.10 2021/12/22 12:05:24 riastradh Exp $	*/
 
 #ifndef _DRM_DEVICE_H_
 #define _DRM_DEVICE_H_
@@ -29,12 +29,6 @@ struct drm_fb_helper;
 struct pci_dev;
 struct pci_controller;
 
-#if defined(__NetBSD__)
-#include 
-#else
-typedef struct vmem vmem_t;
-#endif
-
 /**
  * enum drm_switch_power - power state of drm device
  */
@@ -297,7 +291,7 @@ struct drm_device {
 	bool dmat_subregion_p;
 	bus_addr_t dmat_subregion_min;
 	bus_addr_t dmat_subregion_max;
-	vmem_t *cma_pool;
+	struct vmem *cma_pool;
 #endif
 
 	/** @num_crtcs: Number of CRTCs on this device */



CVS commit: src/sys/external/bsd/drm2/dist/include/drm

2021-12-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Dec 22 12:05:24 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/dist/include/drm: drm_device.h

Log Message:
drm: Omit local diff -- vmem is entirely a NetBSDism.

Use struct vmem rather than vmem_t to obviate need for header file
dependency.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 \
src/sys/external/bsd/drm2/dist/include/drm/drm_device.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.