History log of /freebsd-14.2/sys/compat/linuxkpi/common/src/linux_current.c (Results 1 – 23 of 23)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: release/13.4.0-p5, release/13.5.0-p1, release/14.2.0-p3, release/13.5.0, release/14.2.0-p2, release/14.1.0-p8, release/13.4.0-p4, release/14.1.0-p7, release/14.2.0-p1, release/13.4.0-p3, release/14.2.0, release/13.4.0, release/14.1.0, release/13.3.0
# 0a586a7d 14-Jan-2024 Konstantin Belousov <[email protected]>

linuxkpi: correct zone item size for linux_mm_zone

(cherry picked from commit 4958df5dabce62ef4e9e96b0d1bf62f3a6cce689)


Revision tags: release/14.0.0
# 685dc743 16-Aug-2023 Warner Losh <[email protected]>

sys: Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


Revision tags: release/13.2.0, release/12.4.0
# c3707bd3 17-Sep-2022 Mateusz Guzik <[email protected]>

linuxkpi: use SI_SUB_EVENTHANDLER + 1, like other consumers

Otherwise it may try to initialize before eventhandler subsystem.


Revision tags: release/13.1.0, release/12.3.0
# fdc18947 01-May-2021 Tijl Coosemans <[email protected]>

linuxkpi: on i386 only use first_msi_irq if apic is in kernel config


# d96f55bc 20-May-2021 Konstantin Belousov <[email protected]>

linuxkpi: remove global atomic counter of the task allocations

Use thread_reap_barrier() to ensure that no threads are kept in the
zombies list which could have the linuxkpi task allocated.

Also fi

linuxkpi: remove global atomic counter of the task allocations

Use thread_reap_barrier() to ensure that no threads are kept in the
zombies list which could have the linuxkpi task allocated.

Also fix order of initialization and teardown for current task
allocation hooks and resources. Register current task allocator after
zones are initialized. Deregister allocator before cycling over threads
and zeroing task pointer.

Reviewed by: hselasky, markj
Sponsored by: Mellanox Technologies/NVidia Networking
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D30468

show more ...


# b764a426 21-May-2021 Hans Petter Selasky <[email protected]>

There is a window where threads are removed from the process list and where
the thread destructor is invoked. Catch that window by waiting for all
task_struct allocations to be returned before freein

There is a window where threads are removed from the process list and where
the thread destructor is invoked. Catch that window by waiting for all
task_struct allocations to be returned before freeing the UMA zone in the
LinuxKPI. Else UMA may fail to release the zone due to concurrent access
and panic:

panic() - Bad link element prev->next != elm
zone_release()
bucket_drain()
bucket_free()
zone_dtor()
zone_free_item()
uma_zdestroy()
linux_current_uninit()

This failure can be triggered by loading and unloading the LinuxKPI module
in a loop:

while true
do
kldload linuxkpi
kldunload linuxkpi
done

Discussed with: kib@
MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

show more ...


Revision tags: release/13.0.0
# fad437ba 11-Mar-2021 Konstantin Belousov <[email protected]>

linuxkpi: reduce number of stray mm_struct allocations

Only allocate struct_mm after we checked that other threads do not carry
useful mm_struct. If they don't, drop process lock, allocate, and rec

linuxkpi: reduce number of stray mm_struct allocations

Only allocate struct_mm after we checked that other threads do not carry
useful mm_struct. If they don't, drop process lock, allocate, and recheck.

Note that for M_NOWAIT allocations we could avoid dropping process lock,
but I do not think that this increased complexity is useful.

Reviewed by: hselasky
Sponsored by: Mellanox Technologies/NVidia Networking
MFC after: 1 week

show more ...


# 165ba13f 11-Mar-2021 Konstantin Belousov <[email protected]>

linuxkpi: guarantee allocations of task and mm for interrupt threads

Create and use zones for task and mm. Reserve items in zones based on the
estimation of the max number of interrupts in the syst

linuxkpi: guarantee allocations of task and mm for interrupt threads

Create and use zones for task and mm. Reserve items in zones based on the
estimation of the max number of interrupts in the system. Use M_USE_RESERVE
to allow to take reserved items when allocation occurs from the interrupt
thread context.

Of course, this would only work first time we allocate the task for
interrupt thread. If interrupt is deallocated and allocated anew,
creating a new thread, it might be that zone is depleted. It still
should be good enough for practical uses.

Reviewed by: hselasky
Sponsored by: Mellanox Technologies/NVidia Networking
MFC after: 1 week

show more ...


# 4ce1f616 11-Mar-2021 Konstantin Belousov <[email protected]>

linuxkpi: some style, wrap too long lines

Reviewed by: hselasky
Sponsored by: Mellanox Technologies/NVidia Networking
MFC after: 1 week


Revision tags: release/12.2.0
# f334f212 02-Jul-2020 Konstantin Belousov <[email protected]>

linuxkpi: improvements for linux_pid_task() and linux_get_pid_task().

Unify functions bodies.
Do not call tdfind() if pid is passed, and do not call pfind() if tid
is supplied.

Reviewed by: hselask

linuxkpi: improvements for linux_pid_task() and linux_get_pid_task().

Unify functions bodies.
Do not call tdfind() if pid is passed, and do not call pfind() if tid
is supplied.

Reviewed by: hselasky
Sponsored by: Mellanox Technologies
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D25534

show more ...


# 9a4e535b 01-Jul-2020 Hans Petter Selasky <[email protected]>

The "pid" field in the LinuxKPI task struct is typically set to the thread ID
and not the process ID. Make sure the linux_task_exiting() function uses tdfind()
to lookup the BSD procedure structure p

The "pid" field in the LinuxKPI task struct is typically set to the thread ID
and not the process ID. Make sure the linux_task_exiting() function uses tdfind()
to lookup the BSD procedure structure pointer by the "pid" field, and only
fallback to pfind() when no match is found! This makes linux_task_exiting()
in line with the rest of the code.

Differential Revision: https://reviews.freebsd.org/D25509
Submitted by: Greg V <[email protected]>
MFC after: 1 week
Sponsored by: Mellanox Technologies

show more ...


Revision tags: release/11.4.0, release/12.1.0, release/11.3.0
# 07e0a3ca 16-May-2019 Johannes Lundberg <[email protected]>

LinuxKPI: Add group_leader member to struct task_struct.

Assign self as group leader at creation to act as the only member of a
new process group.
This patch is part of D19565

Reviewed by: hps
Appr

LinuxKPI: Add group_leader member to struct task_struct.

Assign self as group leader at creation to act as the only member of a
new process group.
This patch is part of D19565

Reviewed by: hps
Approved by: imp (mentor), hps
MFC after: 1 week

show more ...


# 638fa5a3 13-Mar-2019 Hans Petter Selasky <[email protected]>

Implement current_exiting() in the LinuxKPI.

Submitted by: Johannes Lundberg <[email protected]>
MFC after: 1 week
Sponsored by: Limelight Networks
Sponsored by: Mellanox Technologies


# 983ed4f9 22-Feb-2019 Matt Macy <[email protected]>

lkpi: allow late binding of linux_alloc_current

Some consumers may be loosely coupled with the lkpi.
This allows them to call linux_alloc_current without
having a static dependency.

Reviewed by: hp

lkpi: allow late binding of linux_alloc_current

Some consumers may be loosely coupled with the lkpi.
This allows them to call linux_alloc_current without
having a static dependency.

Reviewed by: hps@
MFC after: 1 week
Sponsored by: iX Systems
Differential Revision: https://reviews.freebsd.org/D19257

show more ...


Revision tags: release/12.0.0, release/11.2.0
# ef925749 11-Nov-2017 Hans Petter Selasky <[email protected]>

Remove release and acquire semantics when accessing the "state" field of the
LinuxKPI task struct. Change type of "state" variable from "int" to
"atomic_t" to simplify code and avoid unneccessary cas

Remove release and acquire semantics when accessing the "state" field of the
LinuxKPI task struct. Change type of "state" variable from "int" to
"atomic_t" to simplify code and avoid unneccessary casting.

MFC after: 1 week
Sponsored by: Mellanox Technologies

show more ...


Revision tags: release/10.4.0, release/11.1.0
# abf5c031 09-Jul-2017 Mark Johnston <[email protected]>

Free existing per-thread task structs when unloading linuxkpi.ko.

They are otherwise leaked.

Reported and tested by: ae
MFC after: 1 week


# 8504aa98 18-Jun-2017 Mark Johnston <[email protected]>

Add kthread parking support to the LinuxKPI.

Submitted by: kmacy (original version)
Reviewed by: hselasky
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D11264


# 68b9f2f0 31-May-2017 Hans Petter Selasky <[email protected]>

Don't acquire a reference on the VM-space when allocating the LinuxKPI
task structure to avoid deadlock when tearing down the VM object
during a process exit.

Found by: markj @
MFC after: 1 week
S

Don't acquire a reference on the VM-space when allocating the LinuxKPI
task structure to avoid deadlock when tearing down the VM object
during a process exit.

Found by: markj @
MFC after: 1 week
Sponsored by: Mellanox Technologies

show more ...


# 8402f058 06-Apr-2017 Hans Petter Selasky <[email protected]>

Fix implementation of task_pid_group_leader() in the LinuxKPI.

In FreeBSD thread IDs and procedure IDs have distinct number
spaces. When asking for the group leader task ID in the LinuxKPI,
return t

Fix implementation of task_pid_group_leader() in the LinuxKPI.

In FreeBSD thread IDs and procedure IDs have distinct number
spaces. When asking for the group leader task ID in the LinuxKPI,
return the procedure ID and let this resolve to the first task in the
procedure having a valid LinuxKPI task structure pointer.

MFC after: 1 week
Sponsored by: Mellanox Technologies

show more ...


# e54b103e 06-Apr-2017 Hans Petter Selasky <[email protected]>

Before registering a new mm_struct in the LinuxKPI check if other
tasks in the belonging procedure already have a valid mm_struct and
reference that instead.

The mm_struct in the LinuxKPI should be

Before registering a new mm_struct in the LinuxKPI check if other
tasks in the belonging procedure already have a valid mm_struct and
reference that instead.

The mm_struct in the LinuxKPI should be shared among all tasks
belonging to the same procedure. This has to do with with the mmap_sem
semaphore which should serialize all VM operations inside a given
procedure. Linux based drivers depend on this behaviour.

MFC after: 1 week
Sponsored by: Mellanox Technologies

show more ...


# a0699ebf 17-Mar-2017 Hans Petter Selasky <[email protected]>

Implement get_pid_task(), pid_task() and some other PID helper
functions in the LinuxKPI. Add a usage atomic to the task_struct
structure to facilitate refcounting the task structure when returned
fr

Implement get_pid_task(), pid_task() and some other PID helper
functions in the LinuxKPI. Add a usage atomic to the task_struct
structure to facilitate refcounting the task structure when returned
from get_pid_task(). The get_task_struct() and put_task_struct()
function is used to manage atomic refcounting. After this change the
task_struct should only be freed through put_task_struct().

Obtained from: kmacy @
MFC after: 1 week
Sponsored by: Mellanox Technologies

show more ...


# 05d4f501 17-Mar-2017 Hans Petter Selasky <[email protected]>

Implement minimalistic memory mapping structure, struct mm_struct, and
some associated helper functions in the LinuxKPI. Let the existing
linux_alloc_current() function allocate and initialize the ne

Implement minimalistic memory mapping structure, struct mm_struct, and
some associated helper functions in the LinuxKPI. Let the existing
linux_alloc_current() function allocate and initialize the new
structure and let linux_free_current() drop the refcount on the memory
mapping structure. When the mm_struct's refcount reaches zero, the
structure is freed.

Obtained from: kmacy @
MFC after: 1 week
Sponsored by: Mellanox Technologies

show more ...


# 1e3db1de 21-Feb-2017 Hans Petter Selasky <[email protected]>

Make the LinuxKPI task struct persistent accross system calls.

A set of helper functions have been added to manage the life of the
LinuxKPI task struct. When an external system call or task is invok

Make the LinuxKPI task struct persistent accross system calls.

A set of helper functions have been added to manage the life of the
LinuxKPI task struct. When an external system call or task is invoked,
a check is made to create the task struct by demand. A thread
destructor callback is registered to free the task struct when a
thread exits to avoid memory leaks.

This change lays the ground for emulating the Linux kernel more
closely which is a dependency by the code using the LinuxKPI APIs.

Add new dedicated td_lkpi_task field has been added to struct thread
instead of abusing td_retval[1].

Fix some header file inclusions to make LINT kernel build properly
after this change.

Bump the __FreeBSD_version to force a rebuild of all kernel modules.

MFC after: 1 week
Sponsored by: Mellanox Technologies

show more ...