<feed xmlns='http://www.w3.org/2005/Atom'>
<title>src/sys/libkern, branch releng/12.2</title>
<subtitle>FreeBSD source tree</subtitle>
<id>https://cgit-dev.freebsd.org/src/atom?h=releng%2F12.2</id>
<link rel='self' href='https://cgit-dev.freebsd.org/src/atom?h=releng%2F12.2'/>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/'/>
<updated>2020-08-24T12:59:55Z</updated>
<entry>
<title>MFC r361247, r361343, r361418-r361419, r361422, r361449</title>
<updated>2020-08-24T12:59:55Z</updated>
<author>
<name>Emmanuel Vadot</name>
<email>manu@FreeBSD.org</email>
</author>
<published>2020-08-24T12:59:55Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=b87c9716d25fff3a883933c07950c72f19bc3f86'/>
<id>urn:sha1:b87c9716d25fff3a883933c07950c72f19bc3f86</id>
<content type='text'>
r361247:
linuxkpi: Add irq_work.h

Since handlers are call in a thread context we can simply use a workqueue
to emulate those functions.
The DRM code was patched to do that already, having it in linuxkpi allows us
to not patch the upstream code.

Sponsored-by: The FreeBSD Foundation
Reviewed by:	hselasky
Differential Revision:	https://reviews.freebsd.org/D24859

r361343:
linuxkpi: Add rcu_work functions

The rcu_work function helps to queue some work after waiting for a grace
period.
This is needed by DRM drivers.

Sponsored-by: The FreeBSD Foundation
Reviewed by:	hselasky
Differential Revision:	https://reviews.freebsd.org/D24942

r361418:
libkern: Add arc4random_uniform

This variant get a random number up to the limit passed as the argument.
This is simply a copy of the libc version.

Sponsored-by: The FreeBSD Foundation
Reviewed by:	cem, hselasky (previous version)
Differential Revision:	https://reviews.freebsd.org/D24962

r361419:
linuxkpi: Add prandom_u32_max

This is just a wrapper around arc4random_uniform
Needed by DRM v5.3

Sponsored-by: The FreeBSD Foundation
Reviewed by:	cem, hselasky
Differential Revision:	https://reviews.freebsd.org/D24961

r361422:
bbr: Use arc4random_uniform from libkern.

This unbreak LINT build

Reported by:	jenkins, melifaro

r361449:
linuxkpi: Add __same_type and __must_be_array macros

The same_type macro simply wraps around builtin_types_compatible_p which
exist for both GCC and CLANG, which returns 1 if both types are the same.
The __must_be_array macros returns 1 if the argument is an array.

This is needed for DRM v5.3

Sponsored-by: The FreeBSD Foundation
Reviewed by:	hselasky
Differential Revision:	https://reviews.freebsd.org/D24953
</content>
</entry>
<entry>
<title>MFC r344384:</title>
<updated>2019-05-25T19:59:59Z</updated>
<author>
<name>Johannes Lundberg</name>
<email>johalun@FreeBSD.org</email>
</author>
<published>2019-05-25T19:59:59Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=d5a3bd4b8b3d148e63fb69e1a50504d7cb739592'/>
<id>urn:sha1:d5a3bd4b8b3d148e63fb69e1a50504d7cb739592</id>
<content type='text'>
Add non-sleepable strdup variant strdup_flags

debugfs expects to do non-sleepable allocations

Reviewed by:	hps@
Sponsored by:	iX Systems
Differential Revision:	https://reviews.freebsd.org/D19259
</content>
</entry>
<entry>
<title>Sync strlcpy with userland version, again</title>
<updated>2018-06-21T17:35:13Z</updated>
<author>
<name>Conrad Meyer</name>
<email>cem@FreeBSD.org</email>
</author>
<published>2018-06-21T17:35:13Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=e38b830780d47a9014e09015c4acdb1a3f6d3416'/>
<id>urn:sha1:e38b830780d47a9014e09015c4acdb1a3f6d3416</id>
<content type='text'>
No functional change.

Please remember to update libkern copies of libc functions when you update
libc.

Sponsored by:	Dell EMC Isilon
</content>
</entry>
<entry>
<title>str(r)chr: Replace union abuse with __DECONST</title>
<updated>2018-06-04T18:47:14Z</updated>
<author>
<name>Conrad Meyer</name>
<email>cem@FreeBSD.org</email>
</author>
<published>2018-06-04T18:47:14Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=3d825c42cad66b2c7f537c1d487cbf7cbb06a937'/>
<id>urn:sha1:3d825c42cad66b2c7f537c1d487cbf7cbb06a937</id>
<content type='text'>
Writing one union member and reading another is technically illegal C,
although we do it in many places in the tree.  Use the __DECONST macro
instead, which is (technically) a valid C construct.

Trivial style(9) cleanups to touched lines while here.

Sponsored by:	Dell EMC Isilon
</content>
</entry>
<entry>
<title>Use __builtin for various mem* and b* (e.g. bzero) routines.</title>
<updated>2018-06-02T18:03:35Z</updated>
<author>
<name>Mateusz Guzik</name>
<email>mjg@FreeBSD.org</email>
</author>
<published>2018-06-02T18:03:35Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=ba96f37758412151885d50838d2031623fc2b918'/>
<id>urn:sha1:ba96f37758412151885d50838d2031623fc2b918</id>
<content type='text'>
Some of the routines were using artificially limited builtin already,
drop the explicit limit.

The use of builtins allows quite often allows the compiler to elide the call
or most zeroing to begin with. For instance, if the target object is 32 bytes
in size and gets zeroed + has 16 bytes initialized, the compiler can just
add code to zero out the rest.

Note not all the primites have asm variants and some of the existing ones
are not optimized. Maintaines are strongly encourage to take a look
(regardless of this change).
</content>
</entry>
<entry>
<title>libkern: tidy up memset</title>
<updated>2018-06-02T17:57:09Z</updated>
<author>
<name>Mateusz Guzik</name>
<email>mjg@FreeBSD.org</email>
</author>
<published>2018-06-02T17:57:09Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=97e8984893905ab824659c12dcc6b8ffb44ac0ed'/>
<id>urn:sha1:97e8984893905ab824659c12dcc6b8ffb44ac0ed</id>
<content type='text'>
1. Remove special-casing of 0 as it just results in an extra function call.
This is clearly pessimal.
2. Drop the inline stuff. For the most part it is much better served with
__builtin_memset (coming later).
3. Move the declaration to systm.h to match other funcs.

Archs are encouraged to implement the variant for their own platform so that
this implementation can be dropped.
</content>
</entry>
<entry>
<title>Fix recent breakages of kernel profiling, mostly on i386 (high resolution</title>
<updated>2018-06-02T04:25:09Z</updated>
<author>
<name>Bruce Evans</name>
<email>bde@FreeBSD.org</email>
</author>
<published>2018-06-02T04:25:09Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=dbe3061729e3b1b0a56370d529b4a3f90543a0c3'/>
<id>urn:sha1:dbe3061729e3b1b0a56370d529b4a3f90543a0c3</id>
<content type='text'>
kernel profiling remains broken).

memmove() was broken using ALTENTRY().  ALTENTRY() is only different from
ENTRY() in the profiling case, and its use in that case was sort of
backwards.  The backwardness magically turned memmove() into memcpy()
instead of completely breaking it.  Only the high resolution parts of
profiling itself were broken.  Use ordinary ENTRY() for memmove().
Turn bcopy() into a tail call to memmove() to reduce complications.
This gives slightly different pessimizations and profiling lossage.
The pessimizations are minimized by not using a frame pointer() for
bcopy().

Calls to profiling functions from exception trampolines were not
relocated.  This caused crashes on the first exception.  Fix this using
function pointers.

Addresses of exception handlers in trampolines were not relocated.  This
caused unknown offsets in the profiling data.  Relocate by abusing
setidt_disp as for pmc although this is slower than necessary and
requires namespace pollution.  pmc seems to be missing some relocations.
Stack traces and lots of other things in debuggers need similar relocations.

Most user addresses were misclassified as unknown kernel addresses and
then ignored.  Treat all unknown addresses as user. Now only user
addresses in the kernel text range are significantly misclassified (as
known kernel addresses).

The ibrs functions didn't preserve enough registers.  This is the only
recent breakage on amd64.  Although these functions are written in
asm, in the profiling case they call profiling functions which are
mostly for the C ABI, so they only have to save call-used registers.
They also have to save arg and return registers in some cases and
actually save them in all cases to reduce complications.  They end up
saving all registers except %ecx on i386 and %r10 and %r11 on amd64.
Saving these is only needed for 1 caller on each of amd64 and i386.
Save them there.  This is slightly simpler.

Remove saving %ecx in handle_ibrs_exit on i386.  Both handle_ibrs_entry
and handle_ibrs_exit use %ecx, but only the latter needed to or did
save it.  But saving it there doesn't work for the profiling case.

amd64 has more automatic saving of the most common scratch registers
%rax, %rcx and %rdx (its complications for %r10 are from unusual use
of %r10 by SYSCALL).  Thus profiling of handle_ibrs_exit_rs() was not
broken, and I didn't simplify the saving by moving the saving of these
registers from it to the caller.
</content>
</entry>
<entry>
<title>Protect bzero call against macro expansion</title>
<updated>2018-05-24T23:20:10Z</updated>
<author>
<name>Warner Losh</name>
<email>imp@FreeBSD.org</email>
</author>
<published>2018-05-24T23:20:10Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=c6f7141fc0fc9449499ca75763602d851f2e8d46'/>
<id>urn:sha1:c6f7141fc0fc9449499ca75763602d851f2e8d46</id>
<content type='text'>
Shortly, we'll be moving to defining bzero and memset in terms of
__builting_memset. To do that, we can't have macro calls to bzero in
the fallback impelmentation of memset. Normal calls to bzero are fine.
All 4 architectures that use this have their own copies of bzero, so
there's no mutual recursion issue between memset and bcopy.
</content>
</entry>
<entry>
<title>This is no unreferenced, so retire it.</title>
<updated>2018-05-24T21:11:38Z</updated>
<author>
<name>Warner Losh</name>
<email>imp@FreeBSD.org</email>
</author>
<published>2018-05-24T21:11:38Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=509b94387ab8011705b31e805cdb57e89e7ad72b'/>
<id>urn:sha1:509b94387ab8011705b31e805cdb57e89e7ad72b</id>
<content type='text'>
Differential Revision: https://reviews.freebsd.org/D15374
</content>
</entry>
<entry>
<title>Remove "All rights reserved" from my files.</title>
<updated>2018-05-10T06:41:08Z</updated>
<author>
<name>Xin LI</name>
<email>delphij@FreeBSD.org</email>
</author>
<published>2018-05-10T06:41:08Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=b6f7731dba533ce4a5991c118e590b526a4c1208'/>
<id>urn:sha1:b6f7731dba533ce4a5991c118e590b526a4c1208</id>
<content type='text'>
See r333391 for the rationale.

MFC after:	1 week
</content>
</entry>
</feed>
