Re: CVS commit: src/sys/kern
Date:Fri, 30 Sep 2022 20:15:07 -0400 From:Christos Zoulas Message-ID: | It does not need an extra flag (it looks in the file descriptor flags to | find if it needs to set or not. One of us is confused. From where in this case does anything get the exclose flag set? That's the whole question here. The flags arg that is passed around has O_CLOEXEC set in it - you used that in the call to fd_set_exclose() in kern/tty_ptm.c ... but where you said that would be better done in fd_affix(). That does not have access to the flags. So from where is it going to get the close on exec info ? My reading of do_open() is that the O_CLOEXEC flag is never even examined when a cloning device is opened, it doesn't get set on the original fd (the cloner) or the cloned device (other than by your recent modification for /dev/pmx). Did I misread the code? Or are you planning something different than it seemed? | to find other cases where we forgot to call fd_set_exclose() before calling | fd_affix(). My point is that it should not be necessary to call fd_set_exclose() in every (or any) cloning device driver. The open syscall handling is where that should be done, just as it is for all the opens that are not cloning devices. Why be different? | It also does not need locking because the process can't access | the descriptor before calling fd_affix. The locking I was referring to are the vnode locks/references in do_open(), not anything related to the file struct or descriptor. I just do not feel competent to get all of that correct in this case (more complex than the normal case because of the extra vnode involved) and would prefer if someone familiar with all of that were to handle it - particularly in the extra error case that will need to be handled, even if I cannot see how it would actually fire in the case in question. kre
Re: CVS commit: src/sys/kern
> On Sep 30, 2022, at 5:57 PM, Robert Elz wrote: > >Date:Fri, 30 Sep 2022 16:34:20 -0400 >From:Christos Zoulas >Message-ID: <232331ad-d501-4547-b730-03590c0c9...@zoulas.com> > > | How about handling exclose there? > > That would be possible, but why? We still need higher level code to > handle the locking, which can also handle cloexec -- the problem we > have now is simply that the relevant call is missing, I don't think adding > it will be hard, but it needs to be done by someone who understands the > locking requirements, and correct exit strategy in this case if an error > occurs (failing to successfully lock a newly created clone would seem to > be a very bizarre case, but still...) That is, I don't feel competent to > suggest the 3 or 4 lines that ought be added in do_open to fix this (for > just O_CLOEXEC it would be trivial there, as that cannot fail). > > Currently fd_affix (I mistakenly made it fp_affix in the last message...) > doesn't have a flags parameter, so to do it the way you suggest, we'd need > to alter its signature, bump to 9.99.101 (and I haven't yet gotten around > to making my kernel be 98.99.100 which I'm kind of planning to do ...) > and go alter all the calls everywhere, mostly just filling in an extra > arg with a 0. It does not need an extra flag (it looks in the file descriptor flags to find if it needs to set or not. In fact the first thing I thought was to add an assertion to make sure that the flags agrees with that is set in exclose, to find other cases where we forgot to call fd_set_exclose() before calling fd_affix(). It also does not need locking because the process can't access the descriptor before calling fd_affix. christos signature.asc Description: Message signed with OpenPGP
Re: CVS commit: src/sys/kern
On Sat, 1 Oct 2022, Robert Elz wrote: Currently fd_affix (I mistakenly made it fp_affix in the last message...) doesn't have a flags parameter, so to do it the way you suggest, we'd need to alter its signature, bump to 9.99.101 ... and add some COMPAT_09 goop for backward compability :) ... (and I haven't yet gotten around to making my kernel be 98.99.100 which I'm kind of planning to do ...) and go alter all the calls everywhere, mostly just filling in an extra arg with a 0. kre !DSPAM:63376773211686829812153! ++--+--+ | Paul Goyette | PGP Key fingerprint: | E-mail addresses:| | (Retired) | FA29 0E3B 35AF E8AE 6651 | p...@whooppee.com| | Software Developer | 0786 F758 55DE 53BA 7731 | pgoye...@netbsd.org | | & Network Engineer | | pgoyett...@gmail.com | ++--+--+
Re: CVS commit: src/sys/kern
Date:Fri, 30 Sep 2022 16:34:20 -0400 From:Christos Zoulas Message-ID: <232331ad-d501-4547-b730-03590c0c9...@zoulas.com> | How about handling exclose there? That would be possible, but why? We still need higher level code to handle the locking, which can also handle cloexec -- the problem we have now is simply that the relevant call is missing, I don't think adding it will be hard, but it needs to be done by someone who understands the locking requirements, and correct exit strategy in this case if an error occurs (failing to successfully lock a newly created clone would seem to be a very bizarre case, but still...) That is, I don't feel competent to suggest the 3 or 4 lines that ought be added in do_open to fix this (for just O_CLOEXEC it would be trivial there, as that cannot fail). Currently fd_affix (I mistakenly made it fp_affix in the last message...) doesn't have a flags parameter, so to do it the way you suggest, we'd need to alter its signature, bump to 9.99.101 (and I haven't yet gotten around to making my kernel be 98.99.100 which I'm kind of planning to do ...) and go alter all the calls everywhere, mostly just filling in an extra arg with a 0. kre
Re: CVS commit: src/sys/kern
> On Sep 30, 2022, at 10:13 AM, Robert Elz wrote: > >Date:Thu, 29 Sep 2022 16:47:06 - (UTC) >From:chris...@astron.com (Christos Zoulas) >Message-ID: > > | I think that the way to go is to: > | > | 1. Do the fd_set_exclose() in fd_affix(). That will remove most of the > calls > |to fd_set_exclose() *and* the open-coded versions of it. > | 2. Move the open_setfp locking initialization code to fd_affix() and do it > |if fp->f_type == DTYPE_VNODE. This should enable locking in all the > |appropriate cloners. > > I initially intended to reply and say that decisions where to put stuff > like that were for someone else (you, dholland, ...) rather than me, as > I haven't played around much at this level since before vnodes existed. > > But I have been thinking about it, and I disagree with that approach. > > fp_affix() has a job to do, and should be left to do it, without being > burdened by applying weird side effects, sometimes. The "do one thing > and do it well" philosophy applies to more than the commands. > > eg: currently fd_affix() is a void func, but to handle the lock flags > it would need to be able to fail, and return an error code. It would > also need to be able to sleep. That's just wrong. > > O_CLOEXEC and O_??LOCK are high level open() flags, and deserve to be > handled somewhere near the upper levels of the open syscall handling, > not buried in some utility function. That is the feedback that I wanted. But there were two parts to it. How about handling exclose there? It is just making sure that the value from flags is propagated to the exclose field. christos signature.asc Description: Message signed with OpenPGP
Re: CVS commit: src/sys/kern
Date:Thu, 29 Sep 2022 16:47:06 - (UTC) From:chris...@astron.com (Christos Zoulas) Message-ID: | I think that the way to go is to: | | 1. Do the fd_set_exclose() in fd_affix(). That will remove most of the calls |to fd_set_exclose() *and* the open-coded versions of it. | 2. Move the open_setfp locking initialization code to fd_affix() and do it |if fp->f_type == DTYPE_VNODE. This should enable locking in all the |appropriate cloners. I initially intended to reply and say that decisions where to put stuff like that were for someone else (you, dholland, ...) rather than me, as I haven't played around much at this level since before vnodes existed. But I have been thinking about it, and I disagree with that approach. fp_affix() has a job to do, and should be left to do it, without being burdened by applying weird side effects, sometimes. The "do one thing and do it well" philosophy applies to more than the commands. eg: currently fd_affix() is a void func, but to handle the lock flags it would need to be able to fail, and return an error code. It would also need to be able to sleep. That's just wrong. O_CLOEXEC and O_??LOCK are high level open() flags, and deserve to be handled somewhere near the upper levels of the open syscall handling, not buried in some utility function. kre
CVS commit: src/sys/arch/sparc/sparc
Module Name:src Committed By: jdc Date: Fri Sep 30 14:32:45 UTC 2022 Modified Files: src/sys/arch/sparc/sparc: autoconf.c Log Message: Make this compile for SUN4-only kernels (move namebuf inside the SUN4C/SUN4M/SUN4D ifdef to match where it's used). To generate a diff of this commit: cvs rdiff -u -r1.270 -r1.271 src/sys/arch/sparc/sparc/autoconf.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/sparc/sparc/autoconf.c diff -u src/sys/arch/sparc/sparc/autoconf.c:1.270 src/sys/arch/sparc/sparc/autoconf.c:1.271 --- src/sys/arch/sparc/sparc/autoconf.c:1.270 Sat Jan 22 11:49:16 2022 +++ src/sys/arch/sparc/sparc/autoconf.c Fri Sep 30 14:32:45 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: autoconf.c,v 1.270 2022/01/22 11:49:16 thorpej Exp $ */ +/* $NetBSD: autoconf.c,v 1.271 2022/09/30 14:32:45 jdc Exp $ */ /* * Copyright (c) 1996 @@ -48,7 +48,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.270 2022/01/22 11:49:16 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.271 2022/09/30 14:32:45 jdc Exp $"); #include "opt_ddb.h" #include "opt_kgdb.h" @@ -1119,8 +1119,8 @@ mainbus_attach(device_t parent, device_t }; struct mainbus_attach_args ma; - char namebuf[32]; #if defined(SUN4C) || defined(SUN4M) || defined(SUN4D) + char namebuf[32]; const char *sp = NULL; int node0, node; const struct boot_special *openboot_special, *ssp;
CVS commit: src/sys/arch/sparc/sparc
Module Name:src Committed By: jdc Date: Fri Sep 30 14:32:45 UTC 2022 Modified Files: src/sys/arch/sparc/sparc: autoconf.c Log Message: Make this compile for SUN4-only kernels (move namebuf inside the SUN4C/SUN4M/SUN4D ifdef to match where it's used). To generate a diff of this commit: cvs rdiff -u -r1.270 -r1.271 src/sys/arch/sparc/sparc/autoconf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/net
Module Name:src Committed By: knakahara Date: Fri Sep 30 07:36:36 UTC 2022 Modified Files: src/sys/net: if_ipsec.c Log Message: ipsecif(4) can use fixed SP reqid based on ifindex, that can reduce number of reqid. If we want to use fixed SP reqid for ipsecif(4), set net.ipsecif.use_fixed_reqid=1 Default(=0) is the same as before. net.ipsecif.use_fixed_reqid can be changed only if there is no ipsecif(4) yet. If we want to change the range of ipseif(4) SP reqid, set net.ipsecif.reqid_base and net.ipsecif.reqid_last. These can also be changed only if there is no ipsecif(4) yet. To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/sys/net/if_ipsec.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/net/if_ipsec.c diff -u src/sys/net/if_ipsec.c:1.31 src/sys/net/if_ipsec.c:1.32 --- src/sys/net/if_ipsec.c:1.31 Mon Oct 11 05:13:11 2021 +++ src/sys/net/if_ipsec.c Fri Sep 30 07:36:36 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: if_ipsec.c,v 1.31 2021/10/11 05:13:11 knakahara Exp $ */ +/* $NetBSD: if_ipsec.c,v 1.32 2022/09/30 07:36:36 knakahara Exp $ */ /* * Copyright (c) 2017 Internet Initiative Japan Inc. @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_ipsec.c,v 1.31 2021/10/11 05:13:11 knakahara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ipsec.c,v 1.32 2022/09/30 07:36:36 knakahara Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -110,7 +110,7 @@ static inline size_t if_ipsec_set_sadb_d struct sockaddr *, int); static inline size_t if_ipsec_set_sadb_x_policy(struct sadb_x_policy *, struct sadb_x_ipsecrequest *, uint16_t, uint8_t, uint32_t, uint8_t, -struct sockaddr *, struct sockaddr *); +struct sockaddr *, struct sockaddr *, uint16_t); static inline void if_ipsec_set_sadb_msg(struct sadb_msg *, uint16_t, uint8_t); static inline void if_ipsec_set_sadb_msg_add(struct sadb_msg *, uint16_t); static inline void if_ipsec_set_sadb_msg_del(struct sadb_msg *, uint16_t); @@ -118,7 +118,7 @@ static inline void if_ipsec_set_sadb_msg static int if_ipsec_share_sp(struct ipsec_variant *); static int if_ipsec_unshare_sp(struct ipsec_variant *); static inline struct secpolicy *if_ipsec_add_sp0(struct sockaddr *, -in_port_t, struct sockaddr *, in_port_t, int, int, int, u_int); +in_port_t, struct sockaddr *, in_port_t, int, int, int, u_int, uint16_t); static inline int if_ipsec_del_sp0(struct secpolicy *); static int if_ipsec_add_sp(struct ipsec_variant *, struct sockaddr *, in_port_t, struct sockaddr *, in_port_t); @@ -140,8 +140,17 @@ static int if_ipsec_set_addr_port(struct /* This list is used in ioctl context only. */ static struct { LIST_HEAD(ipsec_sclist, ipsec_softc) list; + bool use_fixed_reqid; +#define REQID_BASE_DEFAULT 0x2000 +#define REQID_LAST_DEFAULT 0x2fff + u_int16_t reqid_base; + u_int16_t reqid_last; kmutex_t lock; -} ipsec_softcs __cacheline_aligned; +} ipsec_softcs __cacheline_aligned = { + .use_fixed_reqid = false, + .reqid_base = REQID_BASE_DEFAULT, + .reqid_last = REQID_LAST_DEFAULT, +}; struct psref_class *iv_psref_class __read_mostly; @@ -153,6 +162,14 @@ static struct sysctllog *if_ipsec_sysctl static pktq_rps_hash_func_t if_ipsec_pktq_rps_hash_p; +enum { + REQID_INDEX_IPV4IN = 0, + REQID_INDEX_IPV4OUT, + REQID_INDEX_IPV6IN, + REQID_INDEX_IPV6OUT, + REQID_INDEX_NUM, +}; + #ifdef INET6 static int sysctl_if_ipsec_pmtu_global(SYSCTLFN_ARGS) @@ -205,6 +222,84 @@ sysctl_if_ipsec_pmtu_perif(SYSCTLFN_ARGS } #endif +static int +sysctl_if_ipsec_use_fixed_reqid(SYSCTLFN_ARGS) +{ + bool fixed; + int error; + struct sysctlnode node = *rnode; + + mutex_enter(_softcs.lock); + fixed = ipsec_softcs.use_fixed_reqid; + node.sysctl_data = + error = sysctl_lookup(SYSCTLFN_CALL()); + if (error || newp == NULL) { + mutex_exit(_softcs.lock); + return error; + } + + if (!LIST_EMPTY(_softcs.list)) { + mutex_exit(_softcs.lock); + return EBUSY; + } + ipsec_softcs.use_fixed_reqid = fixed; + mutex_exit(_softcs.lock); + + return 0; +} + +static int +sysctl_if_ipsec_reqid_base(SYSCTLFN_ARGS) +{ + int base; + int error; + struct sysctlnode node = *rnode; + + mutex_enter(_softcs.lock); + base = ipsec_softcs.reqid_base; + node.sysctl_data = + error = sysctl_lookup(SYSCTLFN_CALL()); + if (error || newp == NULL) { + mutex_exit(_softcs.lock); + return error; + } + + if (!LIST_EMPTY(_softcs.list)) { + mutex_exit(_softcs.lock); + return EBUSY; + } + ipsec_softcs.reqid_base = base; + mutex_exit(_softcs.lock); + + return 0; +} + +static int +sysctl_if_ipsec_reqid_last(SYSCTLFN_ARGS) +{ + int last; + int error; + struct sysctlnode node = *rnode; + + mutex_enter(_softcs.lock); + last = ipsec_softcs.reqid_last; + node.sysctl_data = + error = sysctl_lookup(SYSCTLFN_CALL()); + if (error || newp == NULL) { + mutex_exit(_softcs.lock); + return error; + } + + if (!LIST_EMPTY(_softcs.list)) { +
CVS commit: src/sys/net
Module Name:src Committed By: knakahara Date: Fri Sep 30 07:36:36 UTC 2022 Modified Files: src/sys/net: if_ipsec.c Log Message: ipsecif(4) can use fixed SP reqid based on ifindex, that can reduce number of reqid. If we want to use fixed SP reqid for ipsecif(4), set net.ipsecif.use_fixed_reqid=1 Default(=0) is the same as before. net.ipsecif.use_fixed_reqid can be changed only if there is no ipsecif(4) yet. If we want to change the range of ipseif(4) SP reqid, set net.ipsecif.reqid_base and net.ipsecif.reqid_last. These can also be changed only if there is no ipsecif(4) yet. To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/sys/net/if_ipsec.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/evbarm/fdt
Module Name:src Committed By: skrll Date: Fri Sep 30 06:39:55 UTC 2022 Modified Files: src/sys/arch/evbarm/fdt: fdt_machdep.c Log Message: Actually release the VA in fdt_unmap_range To generate a diff of this commit: cvs rdiff -u -r1.94 -r1.95 src/sys/arch/evbarm/fdt/fdt_machdep.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/evbarm/fdt/fdt_machdep.c diff -u src/sys/arch/evbarm/fdt/fdt_machdep.c:1.94 src/sys/arch/evbarm/fdt/fdt_machdep.c:1.95 --- src/sys/arch/evbarm/fdt/fdt_machdep.c:1.94 Fri Sep 30 06:36:28 2022 +++ src/sys/arch/evbarm/fdt/fdt_machdep.c Fri Sep 30 06:39:54 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: fdt_machdep.c,v 1.94 2022/09/30 06:36:28 skrll Exp $ */ +/* $NetBSD: fdt_machdep.c,v 1.95 2022/09/30 06:39:54 skrll Exp $ */ /*- * Copyright (c) 2015-2017 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: fdt_machdep.c,v 1.94 2022/09/30 06:36:28 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fdt_machdep.c,v 1.95 2022/09/30 06:39:54 skrll Exp $"); #include "opt_arm_debug.h" #include "opt_bootconfig.h" @@ -342,9 +342,12 @@ fdt_unmap_range(void *ptr, uint64_t size const char *start = ptr, *end = start + size; const vaddr_t startva = trunc_page((vaddr_t)(uintptr_t)start); const vaddr_t endva = round_page((vaddr_t)(uintptr_t)end); + const vsize_t sz = endva - startva; - pmap_kremove(startva, endva - startva); + pmap_kremove(startva, sz); pmap_update(pmap_kernel()); + + uvm_km_free(kernel_map, startva, sz, UVM_KMF_VAONLY); } static void
CVS commit: src/sys/arch/evbarm/fdt
Module Name:src Committed By: skrll Date: Fri Sep 30 06:39:55 UTC 2022 Modified Files: src/sys/arch/evbarm/fdt: fdt_machdep.c Log Message: Actually release the VA in fdt_unmap_range To generate a diff of this commit: cvs rdiff -u -r1.94 -r1.95 src/sys/arch/evbarm/fdt/fdt_machdep.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/evbarm/fdt
Module Name:src Committed By: skrll Date: Fri Sep 30 06:36:28 UTC 2022 Modified Files: src/sys/arch/evbarm/fdt: fdt_machdep.c Log Message: KNF To generate a diff of this commit: cvs rdiff -u -r1.93 -r1.94 src/sys/arch/evbarm/fdt/fdt_machdep.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/evbarm/fdt/fdt_machdep.c diff -u src/sys/arch/evbarm/fdt/fdt_machdep.c:1.93 src/sys/arch/evbarm/fdt/fdt_machdep.c:1.94 --- src/sys/arch/evbarm/fdt/fdt_machdep.c:1.93 Wed Sep 28 05:54:24 2022 +++ src/sys/arch/evbarm/fdt/fdt_machdep.c Fri Sep 30 06:36:28 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: fdt_machdep.c,v 1.93 2022/09/28 05:54:24 skrll Exp $ */ +/* $NetBSD: fdt_machdep.c,v 1.94 2022/09/30 06:36:28 skrll Exp $ */ /*- * Copyright (c) 2015-2017 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: fdt_machdep.c,v 1.93 2022/09/28 05:54:24 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fdt_machdep.c,v 1.94 2022/09/30 06:36:28 skrll Exp $"); #include "opt_arm_debug.h" #include "opt_bootconfig.h" @@ -322,7 +322,7 @@ fdt_map_range(uint64_t start, uint64_t e const vaddr_t voff = start & PAGE_MASK; - va = uvm_km_alloc(kernel_map, *psize, 0, UVM_KMF_VAONLY|UVM_KMF_NOWAIT); + va = uvm_km_alloc(kernel_map, *psize, 0, UVM_KMF_VAONLY | UVM_KMF_NOWAIT); if (va == 0) { printf("Failed to allocate VA for %s\n", purpose); return NULL; @@ -330,7 +330,7 @@ fdt_map_range(uint64_t start, uint64_t e ptr = (void *)(va + voff); for (pa = startpa; pa < endpa; pa += PAGE_SIZE, va += PAGE_SIZE) - pmap_kenter_pa(va, pa, VM_PROT_READ|VM_PROT_WRITE, 0); + pmap_kenter_pa(va, pa, VM_PROT_READ | VM_PROT_WRITE, 0); pmap_update(pmap_kernel()); return ptr;
CVS commit: src/sys/arch/evbarm/fdt
Module Name:src Committed By: skrll Date: Fri Sep 30 06:36:28 UTC 2022 Modified Files: src/sys/arch/evbarm/fdt: fdt_machdep.c Log Message: KNF To generate a diff of this commit: cvs rdiff -u -r1.93 -r1.94 src/sys/arch/evbarm/fdt/fdt_machdep.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/riscv
Module Name:src Committed By: skrll Date: Fri Sep 30 06:23:59 UTC 2022 Modified Files: src/sys/arch/riscv/include: pte.h src/sys/arch/riscv/riscv: locore.S Log Message: Don't set A, D in page table pointers, but do set them in leaf entries. Beagle-v now boots to the msgbufaddr panic same as qemu To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/arch/riscv/include/pte.h cvs rdiff -u -r1.28 -r1.29 src/sys/arch/riscv/riscv/locore.S 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/riscv/include/pte.h diff -u src/sys/arch/riscv/include/pte.h:1.7 src/sys/arch/riscv/include/pte.h:1.8 --- src/sys/arch/riscv/include/pte.h:1.7 Wed Sep 21 06:34:30 2022 +++ src/sys/arch/riscv/include/pte.h Fri Sep 30 06:23:58 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: pte.h,v 1.7 2022/09/21 06:34:30 skrll Exp $ */ +/* $NetBSD: pte.h,v 1.8 2022/09/30 06:23:58 skrll Exp $ */ /* * Copyright (c) 2014, 2019, 2021 The NetBSD Foundation, Inc. @@ -72,7 +72,7 @@ typedef uint32_t pd_entry_t; #define PTE_V __BIT(0) // Valid #define PTE_HARDWIRED (PTE_A | PTE_D) -#define PTE_KERN (PTE_V | PTE_G) +#define PTE_KERN (PTE_V | PTE_G | PTE_A | PTE_D) #define PTE_RW (PTE_R | PTE_W) #define PTE_RX (PTE_R | PTE_X) Index: src/sys/arch/riscv/riscv/locore.S diff -u src/sys/arch/riscv/riscv/locore.S:1.28 src/sys/arch/riscv/riscv/locore.S:1.29 --- src/sys/arch/riscv/riscv/locore.S:1.28 Wed Sep 28 06:05:28 2022 +++ src/sys/arch/riscv/riscv/locore.S Fri Sep 30 06:23:59 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.S,v 1.28 2022/09/28 06:05:28 skrll Exp $ */ +/* $NetBSD: locore.S,v 1.29 2022/09/30 06:23:59 skrll Exp $ */ /*- * Copyright (c) 2014, 2022 The NetBSD Foundation, Inc. @@ -190,7 +190,7 @@ ENTRY_NP(start) call clear_bss // zero through kernel_end (inc. stack) - li s7, PTE_KERN // for megapages + li s7, PTE_V // page table pointer {X,W,R} = {0,0,0} // We allocated the kernel first PDE page so let's insert in the // page table.
CVS commit: src/sys/arch/riscv
Module Name:src Committed By: skrll Date: Fri Sep 30 06:23:59 UTC 2022 Modified Files: src/sys/arch/riscv/include: pte.h src/sys/arch/riscv/riscv: locore.S Log Message: Don't set A, D in page table pointers, but do set them in leaf entries. Beagle-v now boots to the msgbufaddr panic same as qemu To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/arch/riscv/include/pte.h cvs rdiff -u -r1.28 -r1.29 src/sys/arch/riscv/riscv/locore.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.