CVS log for src/sys/kern/subr_psref.c
Up to [cvs.NetBSD.org] / src / sys / kern
Request diff between arbitrary revisions
Keyword substitution: kv
Default branch: MAIN
Revision 1.18: download - view: text, markup, annotated - select for diffs
Sat Feb 12 16:31:06 2022 UTC (3 years, 1 month ago) by macallan
Branches: MAIN
CVS tags: thorpej-ifq-base,
thorpej-ifq,
thorpej-altq-separation-base,
thorpej-altq-separation,
perseant-exfatfs-base-20240630,
perseant-exfatfs-base,
perseant-exfatfs,
netbsd-10-base,
netbsd-10-1-RELEASE,
netbsd-10-0-RELEASE,
netbsd-10-0-RC6,
netbsd-10-0-RC5,
netbsd-10-0-RC4,
netbsd-10-0-RC3,
netbsd-10-0-RC2,
netbsd-10-0-RC1,
netbsd-10,
bouyer-sunxi-drm-base,
bouyer-sunxi-drm,
HEAD
Diff to: previous 1.17: preferred, colored
Changes since revision 1.17: +3 -3
lines
more __diagused to appease clang
Revision 1.17: download - view: text, markup, annotated - select for diffs
Tue Feb 8 12:59:16 2022 UTC (3 years, 1 month ago) by riastradh
Branches: MAIN
Diff to: previous 1.16: preferred, colored
Changes since revision 1.16: +3 -3
lines
kern: Mark some functions __diagused to pacify clang.
These functions are called only in KASSERT. This shouldn't be a
problem since the recent change to make KASSERT compile (but not run)
the expression, via sizeof, so the functions are referenced -- which
I did in order to avoid having #ifdefs and regular build breakage
because someone forgot to build with or without DIAGNOSTIC. But
apparently clang decided to make it a problem.
Maybe we should just set -Wno-unneeded-internal-declaration -- not
clear it flags any real problems, but it takes effort to research
because apparently clang has no documentation about what else it does
or why anyone decided this is objectionable enough to turn it on by
default. (The only documentation it seems to have, two example
warning messages with no elaboration at
<https://releases.llvm.org/13.0.0/tools/clang/docs/DiagnosticsReference.html#wunneeded-internal-declaration>,
seems to indicate it is mixed up with warning about static non-inline
functions in header files.)
Revision 1.16: download - view: text, markup, annotated - select for diffs
Fri Dec 31 14:19:57 2021 UTC (3 years, 2 months ago) by riastradh
Branches: MAIN
Diff to: previous 1.15: preferred, colored
Changes since revision 1.15: +2 -4
lines
libkern: Make KASSERT verify expression is valid if !DIAGNOSTIC.
This way it is no longer necessary to mark variables __diagused if
they are used in KASSERT conditions.
Fix fallout from this by removing now-unnecessary and `#ifdef
DIAGNOSTIC'.
Don't do the same for KDASSERT if !DEBUG -- unlike KASSERT and
DIAGNOSTIC, variables needed by KDASSERT and DEBUG are likely to be
expensive to compute (and potentially difficult for a compiler to
prove flushable), so we don't want to require them under !DEBUG.
Revision 1.13.14.2: download - view: text, markup, annotated - select for diffs
Sun Aug 1 22:42:38 2021 UTC (3 years, 7 months ago) by thorpej
Branches: thorpej-i2c-spi-conf
Diff to: previous 1.13.14.1: preferred, colored; branchpoint 1.13: preferred, colored; next MAIN 1.14: preferred, colored
Changes since revision 1.13.14.1: +3 -2
lines
Sync with HEAD.
Revision 1.15: download - view: text, markup, annotated - select for diffs
Wed Jul 21 06:35:45 2021 UTC (3 years, 8 months ago) by skrll
Branches: MAIN
CVS tags: thorpej-i2c-spi-conf2-base,
thorpej-i2c-spi-conf2,
thorpej-i2c-spi-conf-base,
thorpej-futex2-base,
thorpej-futex2,
thorpej-cfargs2-base,
thorpej-cfargs2
Diff to: previous 1.14: preferred, colored
Changes since revision 1.14: +3 -2
lines
need <sys/param.h> for COHERENCY_UNIT
Minor KNF along the way.
Revision 1.13.14.1: download - view: text, markup, annotated - select for diffs
Thu Jun 17 04:46:33 2021 UTC (3 years, 9 months ago) by thorpej
Branches: thorpej-i2c-spi-conf
Diff to: previous 1.13: preferred, colored
Changes since revision 1.13: +6 -6
lines
Sync w/ HEAD.
Revision 1.14: download - view: text, markup, annotated - select for diffs
Wed Jun 2 09:23:32 2021 UTC (3 years, 9 months ago) by riastradh
Branches: MAIN
CVS tags: cjep_sun2x-base1,
cjep_sun2x-base,
cjep_sun2x
Diff to: previous 1.13: preferred, colored
Changes since revision 1.13: +6 -6
lines
psref(9): Make use-after-free panic message more obvious.
Previously it would almost always manifest as
mismatched psref target class: 0x0 (ref) != 0x... (expected)
and now it will manifest as
psref target already destroyed: 0x...
Revision 1.11.4.1: download - view: text, markup, annotated - select for diffs
Mon Jun 10 22:09:03 2019 UTC (5 years, 9 months ago) by christos
Branches: phil-wifi
Diff to: previous 1.11: preferred, colored; next MAIN 1.12: preferred, colored
Changes since revision 1.11: +147 -2
lines
Sync with HEAD
Revision 1.13: download - view: text, markup, annotated - select for diffs
Fri May 17 03:34:26 2019 UTC (5 years, 10 months ago) by ozaki-r
Branches: MAIN
CVS tags: thorpej-futex-base,
thorpej-futex,
thorpej-cfargs-base,
thorpej-cfargs,
phil-wifi-20200421,
phil-wifi-20200411,
phil-wifi-20200406,
phil-wifi-20191119,
phil-wifi-20190609,
netbsd-9-base,
netbsd-9-4-RELEASE,
netbsd-9-3-RELEASE,
netbsd-9-2-RELEASE,
netbsd-9-1-RELEASE,
netbsd-9-0-RELEASE,
netbsd-9-0-RC2,
netbsd-9-0-RC1,
netbsd-9,
is-mlppp-base,
is-mlppp,
cjep_staticlib_x-base1,
cjep_staticlib_x-base,
cjep_staticlib_x,
bouyer-xenpvh-base2,
bouyer-xenpvh-base1,
bouyer-xenpvh-base,
bouyer-xenpvh,
ad-namecache-base3,
ad-namecache-base2,
ad-namecache-base1,
ad-namecache-base,
ad-namecache
Branch point for: thorpej-i2c-spi-conf
Diff to: previous 1.12: preferred, colored
Changes since revision 1.12: +137 -5
lines
Implement an aggressive psref leak detector
It is yet another psref leak detector that enables to tell where a leak occurs
while a simpler version that is already committed just tells an occurrence of a
leak.
Investigating of psref leaks is hard because once a leak occurs a percpu list of
psref that tracks references can be corrupted. A reference to a tracking object
is memorized in the list via an intermediate object (struct psref) that is
normally allocated on a stack of a thread. Thus, the intermediate object can be
overwritten on a leak resulting in corruption of the list.
The tracker makes a shadow entry to an intermediate object and stores some hints
into it (currently it's a caller address of psref_acquire). We can detect a
leak by checking the entries on certain points where any references should be
released such as the return point of syscalls and the end of each softint
handler.
The feature is expensive and enabled only if the kernel is built with
PSREF_DEBUG.
Proposed on tech-kern
Revision 1.12: download - view: text, markup, annotated - select for diffs
Fri Apr 19 01:52:55 2019 UTC (5 years, 11 months ago) by ozaki-r
Branches: MAIN
CVS tags: isaki-audio2-base,
isaki-audio2
Diff to: previous 1.11: preferred, colored
Changes since revision 1.11: +15 -2
lines
Implement a simple psref leak detector
It detects leaks by counting up the number of held psref by an LWP and checking
its zeroness at the end of syscalls and softint handlers. For the counter, a
unused field of struct lwp is reused.
The detector runs only if DIAGNOSTIC is turned on.
Revision 1.7.2.3: download - view: text, markup, annotated - select for diffs
Mon Feb 19 18:33:38 2018 UTC (7 years, 1 month ago) by snj
Branches: netbsd-8
CVS tags: netbsd-8-3-RELEASE,
netbsd-8-2-RELEASE,
netbsd-8-1-RELEASE,
netbsd-8-1-RC1,
netbsd-8-0-RELEASE,
netbsd-8-0-RC2,
netbsd-8-0-RC1
Diff to: previous 1.7.2.2: preferred, colored; branchpoint 1.7: preferred, colored; next MAIN 1.8: preferred, colored
Changes since revision 1.7.2.2: +6 -3
lines
Pull up following revision(s) (requested by ozaki-r in ticket #556):
sys/sys/xcall.h: 1.6
share/man/man9/xcall.9: 1.11-1.12
sys/kern/subr_xcall.c: 1.21-1.25
Refer softint(9)
--
Support arbitrary softint IPLs in high priority xcall
The high priority xcall supported only a softint of IPL_SOFTSERIAL. It meant
that it didn't work for xcall callbacks depending on lower IPLs than
IPL_SOFTSERIAL.
The change makes xcall have multiple softints of IPLs and allow users to specify
arbitrary IPLs. Users can specify an IPL by XC_HIGHPRI_IPL passed to the 1st
argument of xc_broadcast or xc_unicast.
Note that xcall still serves requests one by one (i.e., doesn't run them
concurrently) even if requests have different IPLs.
Proposed on tech-kern@
--
Use high priority xcall with a softint of an IPL the same as psref class's one
This mitigates undesired delay of psref_target_destroy under load such as heavy
netowrk traffic that loads softint.
--
Try to fix the build: avoid duplicate case labels when IPL_SOFT* are
all the same.
--
Fix build of kernels that some (or all) IPL_SOFT* share a value (e.g., mips)
--
Avoid allocating unused softints that share a value of IPL between another
Sort XC_IPL_* in order of priority (NFC)
Revision 1.11: download - view: text, markup, annotated - select for diffs
Thu Feb 1 03:17:00 2018 UTC (7 years, 1 month ago) by ozaki-r
Branches: MAIN
CVS tags: phil-wifi-base,
pgoyette-compat-merge-20190127,
pgoyette-compat-base,
pgoyette-compat-20190127,
pgoyette-compat-20190118,
pgoyette-compat-1226,
pgoyette-compat-1126,
pgoyette-compat-1020,
pgoyette-compat-0930,
pgoyette-compat-0906,
pgoyette-compat-0728,
pgoyette-compat-0625,
pgoyette-compat-0521,
pgoyette-compat-0502,
pgoyette-compat-0422,
pgoyette-compat-0415,
pgoyette-compat-0407,
pgoyette-compat-0330,
pgoyette-compat-0322,
pgoyette-compat-0315,
pgoyette-compat
Branch point for: phil-wifi
Diff to: previous 1.10: preferred, colored
Changes since revision 1.10: +6 -3
lines
Use high priority xcall with a softint of an IPL the same as psref class's one
This mitigates undesired delay of psref_target_destroy under load such as heavy
netowrk traffic that loads softint.
Revision 1.7.2.2: download - view: text, markup, annotated - select for diffs
Mon Jan 22 12:30:20 2018 UTC (7 years, 2 months ago) by martin
Branches: netbsd-8
Diff to: previous 1.7.2.1: preferred, colored; branchpoint 1.7: preferred, colored
Changes since revision 1.7.2.1: +10 -4
lines
Pull up following revision(s) (requested by jdolecek in ticket #506):
sys/kern/kern_softint.c: revision 1.45
sys/rump/librump/rumpkern/rump.c: revision 1.331
sys/kern/subr_pserialize.c: revision 1.10
sys/kern/subr_psref.c: revision 1.10
Prevent panic or hangup in softint_disestablish(), pserialize_perform() or
psref_target_destroy() while mp_online == false.
See http://mail-index.netbsd.org/tech-kern/2017/12/25/msg022829.html
Set mp_online = true. This change might fix PR#52886.
Revision 1.7.2.1: download - view: text, markup, annotated - select for diffs
Tue Jan 2 10:36:12 2018 UTC (7 years, 2 months ago) by snj
Branches: netbsd-8
Diff to: previous 1.7: preferred, colored
Changes since revision 1.7: +42 -17
lines
Pull up following revision(s) (requested by ozaki-r in ticket #458):
sys/sys/psref.h: 1.3
sys/kern/subr_psref.c: 1.8-1.9
Fix psref(9) part of PR kern/52515. It is complete to fix the PR now.
implementated by ozaki-r@n.o, reviewed by riastradh@n.o, thanks.
--
Improve debugging functions
- Make psref_check_duplication check just if a given psref is on the list
- It checked both psref and target
- Suggested by riastradh@ some time ago
- Add psref_check_existence that checks a releasing psref is surely on the list
Revision 1.10: download - view: text, markup, annotated - select for diffs
Thu Dec 28 03:39:48 2017 UTC (7 years, 2 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.9: preferred, colored
Changes since revision 1.9: +10 -4
lines
Prevent panic or hangup in softint_disestablish(), pserialize_perform() or
psref_target_destroy() while mp_online == false.
See http://mail-index.netbsd.org/tech-kern/2017/12/25/msg022829.html
Revision 1.9: download - view: text, markup, annotated - select for diffs
Thu Dec 14 05:45:55 2017 UTC (7 years, 3 months ago) by ozaki-r
Branches: MAIN
Diff to: previous 1.8: preferred, colored
Changes since revision 1.8: +33 -11
lines
Improve debugging functions
- Make psref_check_duplication check just if a given psref is on the list
- It checked both psref and target
- Suggested by riastradh@ some time ago
- Add psref_check_existence that checks a releasing psref is surely on the list
Revision 1.8: download - view: text, markup, annotated - select for diffs
Mon Dec 11 02:33:17 2017 UTC (7 years, 3 months ago) by knakahara
Branches: MAIN
Diff to: previous 1.7: preferred, colored
Changes since revision 1.7: +12 -9
lines
Fix psref(9) part of PR kern/52515. It is complete to fix the PR now.
implementated by ozaki-r@n.o, reviewed by riastradh@n.o, thanks.
XXX need pullup-8
Revision 1.7.8.2: download - view: text, markup, annotated - select for diffs
Sun Dec 3 11:38:45 2017 UTC (7 years, 3 months ago) by jdolecek
Branches: tls-maxphys
Diff to: previous 1.7.8.1: preferred, colored; branchpoint 1.7: preferred, colored; next MAIN 1.8: preferred, colored
Changes since revision 1.7.8.1: +520 -0
lines
update from HEAD
Revision 1.4.2.4: download - view: text, markup, annotated - select for diffs
Mon Aug 28 17:53:07 2017 UTC (7 years, 6 months ago) by skrll
Branches: nick-nhusb
Diff to: previous 1.4.2.3: preferred, colored; branchpoint 1.4: preferred, colored; next MAIN 1.5: preferred, colored
Changes since revision 1.4.2.3: +2 -11
lines
Sync with HEAD
Revision 1.7.8.1
Thu Jun 1 02:45:13 2017 UTC (7 years, 9 months ago) by jdolecek
Branches: tls-maxphys
FILE REMOVED
Changes since revision 1.7: +0 -520
lines
file subr_psref.c was added on branch tls-maxphys on 2017-12-03 11:38:45 +0000
Revision 1.7: download - view: text, markup, annotated - select for diffs
Thu Jun 1 02:45:13 2017 UTC (7 years, 9 months ago) by chs
Branches: MAIN
CVS tags: tls-maxphys-base-20171202,
perseant-stdc-iso10646-base,
perseant-stdc-iso10646,
nick-nhusb-base-20170825,
netbsd-8-base,
matt-nb8-mediatek-base,
matt-nb8-mediatek
Branch point for: tls-maxphys,
netbsd-8
Diff to: previous 1.6: preferred, colored
Changes since revision 1.6: +2 -11
lines
remove checks for failure after memory allocation calls that cannot fail:
kmem_alloc() with KM_SLEEP
kmem_zalloc() with KM_SLEEP
percpu_alloc()
pserialize_create()
psref_class_create()
all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.
Revision 1.4.4.2: download - view: text, markup, annotated - select for diffs
Sat Jan 7 08:56:49 2017 UTC (8 years, 2 months ago) by pgoyette
Branches: pgoyette-localcount
Diff to: previous 1.4.4.1: preferred, colored; branchpoint 1.4: preferred, colored; next MAIN 1.5: preferred, colored
Changes since revision 1.4.4.1: +29 -2
lines
Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
Revision 1.4.2.3: download - view: text, markup, annotated - select for diffs
Mon Dec 5 10:55:26 2016 UTC (8 years, 3 months ago) by skrll
Branches: nick-nhusb
Diff to: previous 1.4.2.2: preferred, colored; branchpoint 1.4: preferred, colored
Changes since revision 1.4.2.2: +47 -11
lines
Sync with HEAD
Revision 1.6: download - view: text, markup, annotated - select for diffs
Wed Nov 9 09:00:46 2016 UTC (8 years, 4 months ago) by ozaki-r
Branches: MAIN
CVS tags: prg-localcount2-base3,
prg-localcount2-base2,
prg-localcount2-base1,
prg-localcount2-base,
prg-localcount2,
pgoyette-localcount-20170426,
pgoyette-localcount-20170320,
pgoyette-localcount-20170107,
nick-nhusb-base-20170204,
nick-nhusb-base-20161204,
jdolecek-ncq-base,
jdolecek-ncq,
bouyer-socketcan-base1,
bouyer-socketcan-base,
bouyer-socketcan
Diff to: previous 1.5: preferred, colored
Changes since revision 1.5: +29 -2
lines
Add a new sanity check to psref
It checks if a target being acquired is already acquired with
the same psref. It is usable but not lightweight, so enabled
only if DEBUG.
Revision 1.4.4.1: download - view: text, markup, annotated - select for diffs
Fri Nov 4 14:49:17 2016 UTC (8 years, 4 months ago) by pgoyette
Branches: pgoyette-localcount
Diff to: previous 1.4: preferred, colored
Changes since revision 1.4: +20 -11
lines
Sync with HEAD
Revision 1.5: download - view: text, markup, annotated - select for diffs
Fri Oct 28 07:27:52 2016 UTC (8 years, 4 months ago) by ozaki-r
Branches: MAIN
CVS tags: pgoyette-localcount-20161104
Diff to: previous 1.4: preferred, colored
Changes since revision 1.4: +20 -11
lines
Fix an assertion in _psref_held
The assertion, psref->psref_lwp == curlwp, is valid only if the target
is held by the caller.
Reviewed by riastradh@
Revision 1.4.2.2: download - view: text, markup, annotated - select for diffs
Fri Apr 22 15:44:16 2016 UTC (8 years, 11 months ago) by skrll
Branches: nick-nhusb
Diff to: previous 1.4.2.1: preferred, colored; branchpoint 1.4: preferred, colored
Changes since revision 1.4.2.1: +493 -0
lines
Sync with HEAD
Revision 1.4.2.1
Wed Apr 13 08:31:00 2016 UTC (8 years, 11 months ago) by skrll
Branches: nick-nhusb
FILE REMOVED
Changes since revision 1.4: +0 -493
lines
file subr_psref.c was added on branch nick-nhusb on 2016-04-22 15:44:16 +0000
Revision 1.4: download - view: text, markup, annotated - select for diffs
Wed Apr 13 08:31:00 2016 UTC (8 years, 11 months ago) by riastradh
Branches: MAIN
CVS tags: pgoyette-localcount-base,
pgoyette-localcount-20160806,
pgoyette-localcount-20160726,
nick-nhusb-base-20161004,
nick-nhusb-base-20160907,
nick-nhusb-base-20160529,
nick-nhusb-base-20160422,
localcount-20160914
Branch point for: pgoyette-localcount,
nick-nhusb
Diff to: previous 1.3: preferred, colored
Changes since revision 1.3: +23 -12
lines
Split psref_held into internal and public variants.
For internal use, we expect psrefs to be held by other LWPs when
asking in the cross-call thread whether the target in question is
referenced.
For public use, the caller should not assert about some other LWP
holding a psref.
But the rest of the logic is the same.
Revision 1.3: download - view: text, markup, annotated - select for diffs
Mon Apr 11 13:52:23 2016 UTC (8 years, 11 months ago) by riastradh
Branches: MAIN
Diff to: previous 1.2: preferred, colored
Changes since revision 1.2: +2 -3
lines
Back out previous -- <sys/intr.h> does provide splraiseipl.
Man page says <sys/param.h>, but that's wrong.
The real problem was that rump didn't have splraiseipl at all, and
that already got fixed before I woke up this morning and panicked
because I had obviously broken all the builds!
Revision 1.2: download - view: text, markup, annotated - select for diffs
Mon Apr 11 13:18:13 2016 UTC (8 years, 11 months ago) by riastradh
Branches: MAIN
Diff to: previous 1.1: preferred, colored
Changes since revision 1.1: +3 -2
lines
Need <sys/param.h> for splraiseipl.
How did this pass the releng autobuilds before? We went through
several full builds of HEAD after I committed subr_psref.c.
Revision 1.1: download - view: text, markup, annotated - select for diffs
Sat Apr 9 06:21:16 2016 UTC (8 years, 11 months ago) by riastradh
Branches: MAIN
Add passive references, intermediate between pserialize and refcount.
Discussed on tech-kern:
https://mail-index.netbsd.org/tech-kern/2016/01/24/msg020069.html
API is still experimental and likely to change. (Obvious changes:
either remove extra arguments everywhere, or shrink psref_target to a
single bit, at the expense of possibly valuable diagnostic checks.)
Should do some real testing before we use this in anger!
CVSweb <webmaster@jp.NetBSD.org>