Re: rdomain.4: on removing rtables
On Tue, Sep 22, 2020 at 10:03:29PM +0200, Klemens Nanni wrote: > We have never been able to remove an rtable; until claudio moved them > explicitly with rtable_l2set() in if_loop.c:loop_clone_destroy(), i.e. > > revision 1.90 > date: 2020/01/08 09:09:10; author: claudio; state: Exp; lines: +6 -2; > In loop_clone_destroy() reset the rdomain with rtable_l2set() after > the if_detach() call. In if_detach() various route messages are > generated > and during that time the rtable_l2() mapping needs to stay. > OK kn@ > > it would still exist but not be assigned to any valid rdomain. Back then this > could be obvserved with `route -T1 ...' still "working" after having > destroyed lo1. > > Reverting claudio's commit on -CURRENT, that is with `netstat -R' now > available, confirms this: > > # sysctl kern.version > kern.version=OpenBSD 6.8-beta (GENERIC) #0: Tue Sep 22 21:24:48 CEST > 2020 > kn@eru:/sys/arch/amd64/compile/GENERIC > # ifconfig lo1 rdomain 1 > # netstat -R > Rdomain 0 > Interfaces: lo0 vio0 > Routing table: 0 > > Rdomain 1 > Interface: lo1 > Routing table: 1 > > # ifconfig lo1 destroy > # netstat -R > Rdomain 0 > Interfaces: lo0 vio0 > Routing table: 0 > > # route -T1 show > Routing tables > # echo $? > 0 > > > This is not documented anywhere and I'd certainly not expect it after > reading rtable(4). The manual says we can delete rdomains and is quiet > about deleting rtables, which can imply that rtables cannot be deleted > but might also imply that rtables are deleted automatically when > rdomains are deleted. > > Either way, explicit is better here, I think. > > Feedback? OK? The comment at the beginning of src/sys/net/rtable.c is the only place I'm aware of that documents that routing tables can not be deleted. I think it makes sense to document this in rtable(4). ok remi@ > > > Index: rdomain.4 > === > RCS file: /cvs/src/share/man/man4/rdomain.4,v > retrieving revision 1.14 > diff -u -p -r1.14 rdomain.4 > --- rdomain.4 30 Jul 2020 21:44:34 - 1.14 > +++ rdomain.4 22 Sep 2020 19:58:57 - > @@ -146,3 +146,5 @@ and IPv6 support first appeared in > .Sh CAVEATS > No tool is available to assign more than one rtable to an rdomain > other than to the default one (0). > +An rtable cannot be deleted. > +Deleting an rdomain will move its rtable into the default rdomain. >
Re: rdomain.4: add netstat -R example
On Tue, Sep 22, 2020 at 08:54:31PM +0200, Klemens Nanni wrote: > It's handy and otherwise easily missed when reading up on routing > domains and tables; wording taken from netstat(1) as is. > > Not listing pgrep(1)'s `-T' because examples don't have to be exhaustive > and ps(1) is already demonstrated; same for top(1) users which more > likely come across its `t' and `T' in the help page anyway (I guess). > > Feedback? OK? > ok remi@ > > Index: rdomain.4 > === > RCS file: /cvs/src/share/man/man4/rdomain.4,v > retrieving revision 1.14 > diff -u -p -r1.14 rdomain.4 > --- rdomain.4 30 Jul 2020 21:44:34 - 1.14 > +++ rdomain.4 22 Sep 2020 18:51:29 - > @@ -98,6 +98,10 @@ Put em0 and lo4 in rdomain 4: > # ifconfig em0 192.0.2.100/24 > .Ed > .Pp > +List all rdomains with associated interfaces and routing tables: > +.Pp > +.Dl # netstat -R > +.Pp > Set a default route and localhost reject route within rtable 4: > .Bd -literal -offset indent > # route -T4 -qn add -net 127 127.0.0.1 -reject > @@ -129,6 +133,7 @@ Delete rdomain 4 again: > # ifconfig lo4 destroy > .Ed > .Sh SEE ALSO > +.Xr netstat 1 , > .Xr ps 1 , > .Xr lo 4 , > .Xr route 4 , >
Re: rdomain.4: add netstat -R example
On Tue, Sep 22, 2020 at 08:54:31PM +0200, Klemens Nanni wrote: > It's handy and otherwise easily missed when reading up on routing > domains and tables; wording taken from netstat(1) as is. > > Not listing pgrep(1)'s `-T' because examples don't have to be exhaustive > and ps(1) is already demonstrated; same for top(1) users which more > likely come across its `t' and `T' in the help page anyway (I guess). > > Feedback? OK? > makes sense. ok by me. jmc > > Index: rdomain.4 > === > RCS file: /cvs/src/share/man/man4/rdomain.4,v > retrieving revision 1.14 > diff -u -p -r1.14 rdomain.4 > --- rdomain.4 30 Jul 2020 21:44:34 - 1.14 > +++ rdomain.4 22 Sep 2020 18:51:29 - > @@ -98,6 +98,10 @@ Put em0 and lo4 in rdomain 4: > # ifconfig em0 192.0.2.100/24 > .Ed > .Pp > +List all rdomains with associated interfaces and routing tables: > +.Pp > +.Dl # netstat -R > +.Pp > Set a default route and localhost reject route within rtable 4: > .Bd -literal -offset indent > # route -T4 -qn add -net 127 127.0.0.1 -reject > @@ -129,6 +133,7 @@ Delete rdomain 4 again: > # ifconfig lo4 destroy > .Ed > .Sh SEE ALSO > +.Xr netstat 1 , > .Xr ps 1 , > .Xr lo 4 , > .Xr route 4 , >
rdomain.4: on removing rtables
We have never been able to remove an rtable; until claudio moved them explicitly with rtable_l2set() in if_loop.c:loop_clone_destroy(), i.e. revision 1.90 date: 2020/01/08 09:09:10; author: claudio; state: Exp; lines: +6 -2; In loop_clone_destroy() reset the rdomain with rtable_l2set() after the if_detach() call. In if_detach() various route messages are generated and during that time the rtable_l2() mapping needs to stay. OK kn@ it would still exist but not be assigned to any valid rdomain. Back then this could be obvserved with `route -T1 ...' still "working" after having destroyed lo1. Reverting claudio's commit on -CURRENT, that is with `netstat -R' now available, confirms this: # sysctl kern.version kern.version=OpenBSD 6.8-beta (GENERIC) #0: Tue Sep 22 21:24:48 CEST 2020 kn@eru:/sys/arch/amd64/compile/GENERIC # ifconfig lo1 rdomain 1 # netstat -R Rdomain 0 Interfaces: lo0 vio0 Routing table: 0 Rdomain 1 Interface: lo1 Routing table: 1 # ifconfig lo1 destroy # netstat -R Rdomain 0 Interfaces: lo0 vio0 Routing table: 0 # route -T1 show Routing tables # echo $? 0 This is not documented anywhere and I'd certainly not expect it after reading rtable(4). The manual says we can delete rdomains and is quiet about deleting rtables, which can imply that rtables cannot be deleted but might also imply that rtables are deleted automatically when rdomains are deleted. Either way, explicit is better here, I think. Feedback? OK? Index: rdomain.4 === RCS file: /cvs/src/share/man/man4/rdomain.4,v retrieving revision 1.14 diff -u -p -r1.14 rdomain.4 --- rdomain.4 30 Jul 2020 21:44:34 - 1.14 +++ rdomain.4 22 Sep 2020 19:58:57 - @@ -146,3 +146,5 @@ and IPv6 support first appeared in .Sh CAVEATS No tool is available to assign more than one rtable to an rdomain other than to the default one (0). +An rtable cannot be deleted. +Deleting an rdomain will move its rtable into the default rdomain.
Re: missing support for OHMS and ENERGY sensors in sensorsd
It also lacks SENSOR_UNUSEDFEATURES. No. Paul de Weerd wrote: > Hi all, > > While browsing sensorsd.c for inspiration for a small project I'm > working on, I noticed that both src/usr.sbin/sensorsd/sensorsd.c and > src/sbin/sysctl/sysctl.c have a 'print_sensor' function that > returns/prints the value of the given sensor, including unit. > > However, sensorsd doesn't handle sensors with type SENSOR_OHMS or > SENSOR_ENERGY. That doesn't seem right. Below is a diff that adds > support for these types of sensors to sensorsd(8), using the same > format string as the print_sensor in sysctl(8). > > I'm not sure if these kinds of sensors even exist (I don't have > them), so I've not been able to test this outside of compiling the > program and seeing that it starts normally. > > Cheers, > > Paul > > Index: sensorsd.c > === > RCS file: /home/OpenBSD/cvs/src/usr.sbin/sensorsd/sensorsd.c,v > retrieving revision 1.67 > diff -u -p -r1.67 sensorsd.c > --- sensorsd.c22 Jul 2020 15:33:49 - 1.67 > +++ sensorsd.c21 Sep 2020 21:37:24 - > @@ -654,6 +654,9 @@ print_sensor(enum sensor_type type, int6 > case SENSOR_VOLTS_AC: > snprintf(fbuf, RFBUFSIZ, "%.2f V AC", value / 100.0); > break; > + case SENSOR_OHMS: > + snprintf(fbuf, RFBUFSIZ, "%lld ohm", value); > + break; > case SENSOR_WATTS: > snprintf(fbuf, RFBUFSIZ, "%.2f W", value / 100.0); > break; > @@ -707,6 +710,9 @@ print_sensor(enum sensor_type type, int6 > break; > case SENSOR_VELOCITY: > snprintf(fbuf, RFBUFSIZ, "%4.3f m/s", value / 100.0); > + break; > + case SENSOR_ENERGY: > + snprintf(fbuf, RFBUFSIZ, "%.2f J", value / 10.0); > break; > default: > snprintf(fbuf, RFBUFSIZ, "%lld ???", value); > > -- > >[<++>-]<+++.>+++[<-->-]<.>+++[<+ > +++>-]<.>++[<>-]<+.--.[-] > http://www.weirdnet.nl/ >
rdomain.4: add netstat -R example
It's handy and otherwise easily missed when reading up on routing domains and tables; wording taken from netstat(1) as is. Not listing pgrep(1)'s `-T' because examples don't have to be exhaustive and ps(1) is already demonstrated; same for top(1) users which more likely come across its `t' and `T' in the help page anyway (I guess). Feedback? OK? Index: rdomain.4 === RCS file: /cvs/src/share/man/man4/rdomain.4,v retrieving revision 1.14 diff -u -p -r1.14 rdomain.4 --- rdomain.4 30 Jul 2020 21:44:34 - 1.14 +++ rdomain.4 22 Sep 2020 18:51:29 - @@ -98,6 +98,10 @@ Put em0 and lo4 in rdomain 4: # ifconfig em0 192.0.2.100/24 .Ed .Pp +List all rdomains with associated interfaces and routing tables: +.Pp +.Dl # netstat -R +.Pp Set a default route and localhost reject route within rtable 4: .Bd -literal -offset indent # route -T4 -qn add -net 127 127.0.0.1 -reject @@ -129,6 +133,7 @@ Delete rdomain 4 again: # ifconfig lo4 destroy .Ed .Sh SEE ALSO +.Xr netstat 1 , .Xr ps 1 , .Xr lo 4 , .Xr route 4 ,
relax number of chunks for softraid level 1
Hello, I couldn't but notice that the requirements on softraid level 1 in base OpenBSD are actually lower than what the current user interface returns. The proposed patch does two things : - It relaxes the check for number of chunks for raid level 1 in the kernel - it allows building a level 1 array with only one disk. This patch allows for the following workflow : - Install OpenBSD on one disk - format another disk as a single chunk RAID1 - copy the OpenBSD installation on the RAID1 disk - check that you can boot on RAID1 - boot on bsd.rd and copy the single chunk RAID1 disk to the OpenBSD disk - reassemble the RAID1 with two disks It also allows reassembling a RAID1 array with a different number of chunks, which is terribly useful I think. - Index: sbin/bioctl/bioctl.c === RCS file: /cvs/src/sbin/bioctl/bioctl.c,v retrieving revision 1.144 diff -u -p -r1.144 bioctl.c --- sbin/bioctl/bioctl.c25 Apr 2020 14:37:43 - 1.144 +++ sbin/bioctl/bioctl.c21 Sep 2020 16:38:41 - @@ -841,7 +841,7 @@ bio_createraid(u_int16_t level, char *de min_disks = 2; break; case 1: - min_disks = 2; + min_disks = 1; break; case 5: min_disks = 3; Index: sys/dev/softraid.c === RCS file: /cvs/src/sys/dev/softraid.c,v retrieving revision 1.401 diff -u -p -r1.401 softraid.c --- sys/dev/softraid.c 14 Apr 2020 07:38:21 - 1.401 +++ sys/dev/softraid.c 21 Sep 2020 16:38:42 - @@ -3413,7 +3413,7 @@ sr_ioctl_createraid(struct sr_softc *sc, } else { /* Ensure we are assembling the correct # of chunks. */ - if (sd->sd_meta->ssdi.ssd_chunk_no != no_chunk) { + if (bc->bc_level != 1 && sd->sd_meta->ssdi.ssd_chunk_no != no_chunk) { sr_error(sc, "volume chunk count does not match metadata " "chunk count"); goto unwind; Index: sys/dev/softraid_raid1.c === RCS file: /cvs/src/sys/dev/softraid_raid1.c,v retrieving revision 1.65 diff -u -p -r1.65 softraid_raid1.c --- sys/dev/softraid_raid1.c12 Apr 2016 16:26:54 - 1.65 +++ sys/dev/softraid_raid1.c21 Sep 2020 16:38:42 - @@ -76,8 +76,8 @@ int sr_raid1_create(struct sr_discipline *sd, struct bioc_createraid *bc, int no_chunk, int64_t coerced_size) { - if (no_chunk < 2) { - sr_error(sd->sd_sc, "%s requires two or more chunks", + if (no_chunk < 1) { + sr_error(sd->sd_sc, "%s requires one or more chunks", sd->sd_name); return EINVAL; } -- Thomas de Grivel kmx.io Index: sbin/bioctl/bioctl.c === RCS file: /cvs/src/sbin/bioctl/bioctl.c,v retrieving revision 1.144 diff -u -p -r1.144 bioctl.c --- sbin/bioctl/bioctl.c 25 Apr 2020 14:37:43 - 1.144 +++ sbin/bioctl/bioctl.c 21 Sep 2020 16:38:41 - @@ -841,7 +841,7 @@ bio_createraid(u_int16_t level, char *de min_disks = 2; break; case 1: - min_disks = 2; + min_disks = 1; break; case 5: min_disks = 3; Index: sys/dev/softraid.c === RCS file: /cvs/src/sys/dev/softraid.c,v retrieving revision 1.401 diff -u -p -r1.401 softraid.c --- sys/dev/softraid.c 14 Apr 2020 07:38:21 - 1.401 +++ sys/dev/softraid.c 21 Sep 2020 16:38:42 - @@ -3413,7 +3413,7 @@ sr_ioctl_createraid(struct sr_softc *sc, } else { /* Ensure we are assembling the correct # of chunks. */ - if (sd->sd_meta->ssdi.ssd_chunk_no != no_chunk) { + if (bc->bc_level != 1 && sd->sd_meta->ssdi.ssd_chunk_no != no_chunk) { sr_error(sc, "volume chunk count does not match metadata " "chunk count"); goto unwind; Index: sys/dev/softraid_raid1.c === RCS file: /cvs/src/sys/dev/softraid_raid1.c,v retrieving revision 1.65 diff -u -p -r1.65 softraid_raid1.c --- sys/dev/softraid_raid1.c 12 Apr 2016 16:26:54 - 1.65 +++ sys/dev/softraid_raid1.c 21 Sep 2020 16:38:42 - @@ -76,8 +76,8 @@ int sr_raid1_create(struct sr_discipline *sd, struct bioc_createraid *bc, int no_chunk, int64_t coerced_size) { - if (no_chunk < 2) { - sr_error(sd->sd_sc, "%s requires two or more chunks", + if (no_chunk < 1) { + sr_error(sd->sd_sc, "%s requires one or more chunks", sd->sd_name); return EINVAL; }
Re: uvm: __inline -> inline
> Date: Tue, 22 Sep 2020 10:37:40 +0200 > From: Martin Pieuchot > > On 22/09/20(Tue) 10:20, Mark Kettenis wrote: > > > Date: Tue, 22 Sep 2020 09:15:00 +0200 > > > From: Martin Pieuchot > > > > > > Spell inline correctly, also reduce the diff with NetBSD for uvm_amap.c > > > and uvm_fault.c. > > > > > > ok? > > > > In general, yes. This might interfere with the diff that guenther@ > > did a while ago to lock amaps and unlock more of uvm. Now that the > > uvm_map_inentry() mystery is (largely) solved, it may be worth looking > > into that diff again. Or is that what you're doing right now? > > That's what I am doing right now without the knowledge of guenther@'s > prior work, could you share it? Can't immediately find it; maybe you can ask him directly.
Re: uvm: __inline -> inline
On 22/09/20(Tue) 10:20, Mark Kettenis wrote: > > Date: Tue, 22 Sep 2020 09:15:00 +0200 > > From: Martin Pieuchot > > > > Spell inline correctly, also reduce the diff with NetBSD for uvm_amap.c > > and uvm_fault.c. > > > > ok? > > In general, yes. This might interfere with the diff that guenther@ > did a while ago to lock amaps and unlock more of uvm. Now that the > uvm_map_inentry() mystery is (largely) solved, it may be worth looking > into that diff again. Or is that what you're doing right now? That's what I am doing right now without the knowledge of guenther@'s prior work, could you share it?
Re: uvm: __inline -> inline
> Date: Tue, 22 Sep 2020 09:15:00 +0200 > From: Martin Pieuchot > > Spell inline correctly, also reduce the diff with NetBSD for uvm_amap.c > and uvm_fault.c. > > ok? In general, yes. This might interfere with the diff that guenther@ did a while ago to lock amaps and unlock more of uvm. Now that the uvm_map_inentry() mystery is (largely) solved, it may be worth looking into that diff again. Or is that what you're doing right now? I'm not aware of any other large outstanding diffs in the uvm area. > Index: uvm/uvm_addr.c > === > RCS file: /cvs/src/sys/uvm/uvm_addr.c,v > retrieving revision 1.28 > diff -u -p -r1.28 uvm_addr.c > --- uvm/uvm_addr.c13 Sep 2020 10:05:25 - 1.28 > +++ uvm/uvm_addr.c22 Sep 2020 07:12:10 - > @@ -186,7 +186,7 @@ uvm_addr_entrybyspace(struct uaddr_free_ > } > #endif /* !SMALL_KERNEL */ > > -static __inline vaddr_t > +static inline vaddr_t > uvm_addr_align_forward(vaddr_t addr, vaddr_t align, vaddr_t offset) > { > vaddr_t adjusted; > @@ -201,7 +201,7 @@ uvm_addr_align_forward(vaddr_t addr, vad > return (adjusted < addr ? adjusted + align : adjusted); > } > > -static __inline vaddr_t > +static inline vaddr_t > uvm_addr_align_backward(vaddr_t addr, vaddr_t align, vaddr_t offset) > { > vaddr_t adjusted; > Index: uvm/uvm_amap.c > === > RCS file: /cvs/src/sys/uvm/uvm_amap.c,v > retrieving revision 1.82 > diff -u -p -r1.82 uvm_amap.c > --- uvm/uvm_amap.c4 Jan 2020 16:17:29 - 1.82 > +++ uvm/uvm_amap.c22 Sep 2020 07:07:45 - > @@ -63,20 +63,20 @@ static char amap_small_pool_names[UVM_AM > */ > > static struct vm_amap *amap_alloc1(int, int, int); > -static __inline void amap_list_insert(struct vm_amap *); > -static __inline void amap_list_remove(struct vm_amap *); > +static inline void amap_list_insert(struct vm_amap *); > +static inline void amap_list_remove(struct vm_amap *); > > struct vm_amap_chunk *amap_chunk_get(struct vm_amap *, int, int, int); > void amap_chunk_free(struct vm_amap *, struct vm_amap_chunk *); > void amap_wiperange_chunk(struct vm_amap *, struct vm_amap_chunk *, int, > int); > > -static __inline void > +static inline void > amap_list_insert(struct vm_amap *amap) > { > LIST_INSERT_HEAD(_list, amap, am_list); > } > > -static __inline void > +static inline void > amap_list_remove(struct vm_amap *amap) > { > LIST_REMOVE(amap, am_list); > @@ -190,13 +190,10 @@ amap_chunk_free(struct vm_amap *amap, st > * here are some in-line functions to help us. > */ > > -static __inline void pp_getreflen(int *, int, int *, int *); > -static __inline void pp_setreflen(int *, int, int, int); > - > /* > * pp_getreflen: get the reference and length for a specific offset > */ > -static __inline void > +static inline void > pp_getreflen(int *ppref, int offset, int *refp, int *lenp) > { > > @@ -212,7 +209,7 @@ pp_getreflen(int *ppref, int offset, int > /* > * pp_setreflen: set the reference and length for a specific offset > */ > -static __inline void > +static inline void > pp_setreflen(int *ppref, int offset, int ref, int len) > { > if (len == 1) { > Index: uvm/uvm_aobj.c > === > RCS file: /cvs/src/sys/uvm/uvm_aobj.c,v > retrieving revision 1.86 > diff -u -p -r1.86 uvm_aobj.c > --- uvm/uvm_aobj.c18 Jul 2019 23:47:33 - 1.86 > +++ uvm/uvm_aobj.c22 Sep 2020 07:11:50 - > @@ -256,7 +256,7 @@ uao_find_swhash_elt(struct uvm_aobj *aob > /* > * uao_find_swslot: find the swap slot number for an aobj/pageidx > */ > -__inline static int > +inline static int > uao_find_swslot(struct uvm_aobj *aobj, int pageidx) > { > > Index: uvm/uvm_fault.c > === > RCS file: /cvs/src/sys/uvm/uvm_fault.c,v > retrieving revision 1.98 > diff -u -p -r1.98 uvm_fault.c > --- uvm/uvm_fault.c 12 Sep 2020 17:08:49 - 1.98 > +++ uvm/uvm_fault.c 22 Sep 2020 07:07:59 - > @@ -159,7 +159,7 @@ static struct uvm_advice uvmadvice[MADV_ > * private prototypes > */ > static void uvmfault_amapcopy(struct uvm_faultinfo *); > -static __inline void uvmfault_anonflush(struct vm_anon **, int); > +static inline void uvmfault_anonflush(struct vm_anon **, int); > void uvmfault_unlockmaps(struct uvm_faultinfo *, boolean_t); > void uvmfault_update_stats(struct uvm_faultinfo *); > > @@ -171,7 +171,7 @@ void uvmfault_update_stats(struct uvm_fa > * > * => does not have to deactivate page if it is busy > */ > -static __inline void > +static inline void > uvmfault_anonflush(struct vm_anon **anons, int n) > { > int lcv; > Index: uvm/uvm_map.c > === > RCS file: /cvs/src/sys/uvm/uvm_map.c,v > retrieving revision 1.267 > diff -u
Re: pmap_enter(9) doesn't sleep
> Date: Tue, 22 Sep 2020 09:51:03 +0200 > From: Martin Pieuchot > > Allocations in the various pmap_enter(9) are done with uvm_pagealloc(9), > which sets the UVM_PLA_NOWAIT flag, and/or with pool_get(9) w/ PR_NOWAIT. > > So the comment below seems outdated to me, ok to kill it? This matches my understanding. ok kettenis@ > Index: uvm/uvm_fault.c > === > RCS file: /cvs/src/sys/uvm/uvm_fault.c,v > retrieving revision 1.98 > diff -u -p -r1.98 uvm_fault.c > --- uvm/uvm_fault.c 12 Sep 2020 17:08:49 - 1.98 > +++ uvm/uvm_fault.c 22 Sep 2020 07:46:43 - > @@ -702,13 +702,6 @@ ReFault: > pmap_update(ufi.orig_map->pmap); > > /* (shadowed == TRUE) if there is an anon at the faulting address */ > - /* > - * note that if we are really short of RAM we could sleep in the above > - * call to pmap_enter. bad? > - * > - * XXX Actually, that is bad; pmap_enter() should just fail in that > - * XXX case. --thorpej > - */ > /* >* if the desired page is not shadowed by the amap and we have a >* backing object, then we check to see if the backing object would > >
Re: uvm: __inline -> inline
ok mvs > On 22 Sep 2020, at 10:15, Martin Pieuchot wrote: > > Spell inline correctly, also reduce the diff with NetBSD for uvm_amap.c > and uvm_fault.c. > > ok? > > Index: uvm/uvm_addr.c > === > RCS file: /cvs/src/sys/uvm/uvm_addr.c,v > retrieving revision 1.28 > diff -u -p -r1.28 uvm_addr.c > --- uvm/uvm_addr.c13 Sep 2020 10:05:25 - 1.28 > +++ uvm/uvm_addr.c22 Sep 2020 07:12:10 - > @@ -186,7 +186,7 @@ uvm_addr_entrybyspace(struct uaddr_free_ > } > #endif /* !SMALL_KERNEL */ > > -static __inline vaddr_t > +static inline vaddr_t > uvm_addr_align_forward(vaddr_t addr, vaddr_t align, vaddr_t offset) > { > vaddr_t adjusted; > @@ -201,7 +201,7 @@ uvm_addr_align_forward(vaddr_t addr, vad > return (adjusted < addr ? adjusted + align : adjusted); > } > > -static __inline vaddr_t > +static inline vaddr_t > uvm_addr_align_backward(vaddr_t addr, vaddr_t align, vaddr_t offset) > { > vaddr_t adjusted; > Index: uvm/uvm_amap.c > === > RCS file: /cvs/src/sys/uvm/uvm_amap.c,v > retrieving revision 1.82 > diff -u -p -r1.82 uvm_amap.c > --- uvm/uvm_amap.c4 Jan 2020 16:17:29 - 1.82 > +++ uvm/uvm_amap.c22 Sep 2020 07:07:45 - > @@ -63,20 +63,20 @@ static char amap_small_pool_names[UVM_AM > */ > > static struct vm_amap *amap_alloc1(int, int, int); > -static __inline void amap_list_insert(struct vm_amap *); > -static __inline void amap_list_remove(struct vm_amap *); > +static inline void amap_list_insert(struct vm_amap *); > +static inline void amap_list_remove(struct vm_amap *); > > struct vm_amap_chunk *amap_chunk_get(struct vm_amap *, int, int, int); > void amap_chunk_free(struct vm_amap *, struct vm_amap_chunk *); > void amap_wiperange_chunk(struct vm_amap *, struct vm_amap_chunk *, int, int); > > -static __inline void > +static inline void > amap_list_insert(struct vm_amap *amap) > { > LIST_INSERT_HEAD(_list, amap, am_list); > } > > -static __inline void > +static inline void > amap_list_remove(struct vm_amap *amap) > { > LIST_REMOVE(amap, am_list); > @@ -190,13 +190,10 @@ amap_chunk_free(struct vm_amap *amap, st > * here are some in-line functions to help us. > */ > > -static __inline void pp_getreflen(int *, int, int *, int *); > -static __inline void pp_setreflen(int *, int, int, int); > - > /* > * pp_getreflen: get the reference and length for a specific offset > */ > -static __inline void > +static inline void > pp_getreflen(int *ppref, int offset, int *refp, int *lenp) > { > > @@ -212,7 +209,7 @@ pp_getreflen(int *ppref, int offset, int > /* > * pp_setreflen: set the reference and length for a specific offset > */ > -static __inline void > +static inline void > pp_setreflen(int *ppref, int offset, int ref, int len) > { > if (len == 1) { > Index: uvm/uvm_aobj.c > === > RCS file: /cvs/src/sys/uvm/uvm_aobj.c,v > retrieving revision 1.86 > diff -u -p -r1.86 uvm_aobj.c > --- uvm/uvm_aobj.c18 Jul 2019 23:47:33 - 1.86 > +++ uvm/uvm_aobj.c22 Sep 2020 07:11:50 - > @@ -256,7 +256,7 @@ uao_find_swhash_elt(struct uvm_aobj *aob > /* > * uao_find_swslot: find the swap slot number for an aobj/pageidx > */ > -__inline static int > +inline static int > uao_find_swslot(struct uvm_aobj *aobj, int pageidx) > { > > Index: uvm/uvm_fault.c > === > RCS file: /cvs/src/sys/uvm/uvm_fault.c,v > retrieving revision 1.98 > diff -u -p -r1.98 uvm_fault.c > --- uvm/uvm_fault.c 12 Sep 2020 17:08:49 - 1.98 > +++ uvm/uvm_fault.c 22 Sep 2020 07:07:59 - > @@ -159,7 +159,7 @@ static struct uvm_advice uvmadvice[MADV_ > * private prototypes > */ > static void uvmfault_amapcopy(struct uvm_faultinfo *); > -static __inline void uvmfault_anonflush(struct vm_anon **, int); > +static inline void uvmfault_anonflush(struct vm_anon **, int); > void uvmfault_unlockmaps(struct uvm_faultinfo *, boolean_t); > void uvmfault_update_stats(struct uvm_faultinfo *); > > @@ -171,7 +171,7 @@ void uvmfault_update_stats(struct uvm_fa > * > * => does not have to deactivate page if it is busy > */ > -static __inline void > +static inline void > uvmfault_anonflush(struct vm_anon **anons, int n) > { > int lcv; > Index: uvm/uvm_map.c > === > RCS file: /cvs/src/sys/uvm/uvm_map.c,v > retrieving revision 1.267 > diff -u -p -r1.267 uvm_map.c > --- uvm/uvm_map.c 14 Sep 2020 20:31:09 - 1.267 > +++ uvm/uvm_map.c 22 Sep 2020 07:11:47 - > @@ -167,7 +167,7 @@ boolean_t uvm_map_inentry_fix(struct p > * Tree management functions. > */ > > -static __inline void uvm_mapent_copy(struct vm_map_entry*, > +static inline voiduvm_mapent_copy(struct vm_map_entry*, >
pmap_enter(9) doesn't sleep
Allocations in the various pmap_enter(9) are done with uvm_pagealloc(9), which sets the UVM_PLA_NOWAIT flag, and/or with pool_get(9) w/ PR_NOWAIT. So the comment below seems outdated to me, ok to kill it? Index: uvm/uvm_fault.c === RCS file: /cvs/src/sys/uvm/uvm_fault.c,v retrieving revision 1.98 diff -u -p -r1.98 uvm_fault.c --- uvm/uvm_fault.c 12 Sep 2020 17:08:49 - 1.98 +++ uvm/uvm_fault.c 22 Sep 2020 07:46:43 - @@ -702,13 +702,6 @@ ReFault: pmap_update(ufi.orig_map->pmap); /* (shadowed == TRUE) if there is an anon at the faulting address */ - /* -* note that if we are really short of RAM we could sleep in the above -* call to pmap_enter. bad? -* -* XXX Actually, that is bad; pmap_enter() should just fail in that -* XXX case. --thorpej -*/ /* * if the desired page is not shadowed by the amap and we have a * backing object, then we check to see if the backing object would
uvm: __inline -> inline
Spell inline correctly, also reduce the diff with NetBSD for uvm_amap.c and uvm_fault.c. ok? Index: uvm/uvm_addr.c === RCS file: /cvs/src/sys/uvm/uvm_addr.c,v retrieving revision 1.28 diff -u -p -r1.28 uvm_addr.c --- uvm/uvm_addr.c 13 Sep 2020 10:05:25 - 1.28 +++ uvm/uvm_addr.c 22 Sep 2020 07:12:10 - @@ -186,7 +186,7 @@ uvm_addr_entrybyspace(struct uaddr_free_ } #endif /* !SMALL_KERNEL */ -static __inline vaddr_t +static inline vaddr_t uvm_addr_align_forward(vaddr_t addr, vaddr_t align, vaddr_t offset) { vaddr_t adjusted; @@ -201,7 +201,7 @@ uvm_addr_align_forward(vaddr_t addr, vad return (adjusted < addr ? adjusted + align : adjusted); } -static __inline vaddr_t +static inline vaddr_t uvm_addr_align_backward(vaddr_t addr, vaddr_t align, vaddr_t offset) { vaddr_t adjusted; Index: uvm/uvm_amap.c === RCS file: /cvs/src/sys/uvm/uvm_amap.c,v retrieving revision 1.82 diff -u -p -r1.82 uvm_amap.c --- uvm/uvm_amap.c 4 Jan 2020 16:17:29 - 1.82 +++ uvm/uvm_amap.c 22 Sep 2020 07:07:45 - @@ -63,20 +63,20 @@ static char amap_small_pool_names[UVM_AM */ static struct vm_amap *amap_alloc1(int, int, int); -static __inline void amap_list_insert(struct vm_amap *); -static __inline void amap_list_remove(struct vm_amap *); +static inline void amap_list_insert(struct vm_amap *); +static inline void amap_list_remove(struct vm_amap *); struct vm_amap_chunk *amap_chunk_get(struct vm_amap *, int, int, int); void amap_chunk_free(struct vm_amap *, struct vm_amap_chunk *); void amap_wiperange_chunk(struct vm_amap *, struct vm_amap_chunk *, int, int); -static __inline void +static inline void amap_list_insert(struct vm_amap *amap) { LIST_INSERT_HEAD(_list, amap, am_list); } -static __inline void +static inline void amap_list_remove(struct vm_amap *amap) { LIST_REMOVE(amap, am_list); @@ -190,13 +190,10 @@ amap_chunk_free(struct vm_amap *amap, st * here are some in-line functions to help us. */ -static __inline void pp_getreflen(int *, int, int *, int *); -static __inline void pp_setreflen(int *, int, int, int); - /* * pp_getreflen: get the reference and length for a specific offset */ -static __inline void +static inline void pp_getreflen(int *ppref, int offset, int *refp, int *lenp) { @@ -212,7 +209,7 @@ pp_getreflen(int *ppref, int offset, int /* * pp_setreflen: set the reference and length for a specific offset */ -static __inline void +static inline void pp_setreflen(int *ppref, int offset, int ref, int len) { if (len == 1) { Index: uvm/uvm_aobj.c === RCS file: /cvs/src/sys/uvm/uvm_aobj.c,v retrieving revision 1.86 diff -u -p -r1.86 uvm_aobj.c --- uvm/uvm_aobj.c 18 Jul 2019 23:47:33 - 1.86 +++ uvm/uvm_aobj.c 22 Sep 2020 07:11:50 - @@ -256,7 +256,7 @@ uao_find_swhash_elt(struct uvm_aobj *aob /* * uao_find_swslot: find the swap slot number for an aobj/pageidx */ -__inline static int +inline static int uao_find_swslot(struct uvm_aobj *aobj, int pageidx) { Index: uvm/uvm_fault.c === RCS file: /cvs/src/sys/uvm/uvm_fault.c,v retrieving revision 1.98 diff -u -p -r1.98 uvm_fault.c --- uvm/uvm_fault.c 12 Sep 2020 17:08:49 - 1.98 +++ uvm/uvm_fault.c 22 Sep 2020 07:07:59 - @@ -159,7 +159,7 @@ static struct uvm_advice uvmadvice[MADV_ * private prototypes */ static void uvmfault_amapcopy(struct uvm_faultinfo *); -static __inline void uvmfault_anonflush(struct vm_anon **, int); +static inline void uvmfault_anonflush(struct vm_anon **, int); void uvmfault_unlockmaps(struct uvm_faultinfo *, boolean_t); void uvmfault_update_stats(struct uvm_faultinfo *); @@ -171,7 +171,7 @@ voiduvmfault_update_stats(struct uvm_fa * * => does not have to deactivate page if it is busy */ -static __inline void +static inline void uvmfault_anonflush(struct vm_anon **anons, int n) { int lcv; Index: uvm/uvm_map.c === RCS file: /cvs/src/sys/uvm/uvm_map.c,v retrieving revision 1.267 diff -u -p -r1.267 uvm_map.c --- uvm/uvm_map.c 14 Sep 2020 20:31:09 - 1.267 +++ uvm/uvm_map.c 22 Sep 2020 07:11:47 - @@ -167,7 +167,7 @@ boolean_tuvm_map_inentry_fix(struct p * Tree management functions. */ -static __inline voiduvm_mapent_copy(struct vm_map_entry*, +static inline void uvm_mapent_copy(struct vm_map_entry*, struct vm_map_entry*); static inline int uvm_mapentry_addrcmp(const struct vm_map_entry*, const struct vm_map_entry*); @@ -361,7 +361,7 @@ uvm_mapentry_addrcmp(const struct vm_map /* * Copy mapentry. */