[PATCH v5 3/4] um: add a UML specific futex implementation

Anton Ivanov anton.ivanov at cambridgegreys.com
Tue Dec 15 04:56:28 EST 2020


On 15/12/2020 09:46, Richard Weinberger wrote:
> Anton,
>
> ----- Ursprüngliche Mail -----
>> Von: "anton ivanov" <anton.ivanov at cambridgegreys.com>
>> An: "linux-um" <linux-um at lists.infradead.org>
>> CC: "richard" <richard at nod.at>
>> Gesendet: Dienstag, 15. Dezember 2020 10:43:48
>> Betreff: Re: [PATCH v5 3/4] um: add a UML specific futex implementation
>> On 14/12/2020 18:14, anton.ivanov at cambridgegreys.com wrote:
>>> From: Anton Ivanov <anton.ivanov at cambridgegreys.com>
>>>
>>> The generic asm futex implementation emulates atomic access to
>>> memory by doing a get_user followed by put_user. These translate
>>> to two mapping operations on UML with paging enabled in the
>>> meantime. This, in turn may end up changing interrupts,
>>> invoking the signal loop, etc.
>>>
>>> This replaces the generic implementation by a mapping followed
>>> by an operation on the mapped segment.
>>>
>>> Signed-off-by: Anton Ivanov <anton.ivanov at cambridgegreys.com>
>>> ---
>>>    arch/um/include/asm/Kbuild    |   1 -
>>>    arch/um/include/asm/futex.h   |  14 ++++
>>>    arch/um/kernel/skas/uaccess.c | 130 ++++++++++++++++++++++++++++++++++
>>>    3 files changed, 144 insertions(+), 1 deletion(-)
>>>    create mode 100644 arch/um/include/asm/futex.h
>>>
>>> diff --git a/arch/um/include/asm/Kbuild b/arch/um/include/asm/Kbuild
>>> index 1c63b260ecc4..873e6815bc50 100644
>>> --- a/arch/um/include/asm/Kbuild
>>> +++ b/arch/um/include/asm/Kbuild
>>> @@ -8,7 +8,6 @@ generic-y += emergency-restart.h
>>>    generic-y += exec.h
>>>    generic-y += extable.h
>>>    generic-y += ftrace.h
>>> -generic-y += futex.h
>>>    generic-y += hw_irq.h
>>>    generic-y += irq_regs.h
>>>    generic-y += irq_work.h
>>> diff --git a/arch/um/include/asm/futex.h b/arch/um/include/asm/futex.h
>>> new file mode 100644
>>> index 000000000000..0a01f1f60de0
>>> --- /dev/null
>>> +++ b/arch/um/include/asm/futex.h
>>> @@ -0,0 +1,14 @@
>>> +/* SPDX-License-Identifier: GPL-2.0 */
>>> +#ifndef _ASM_GENERIC_FUTEX_H
>>> +#define _ASM_GENERIC_FUTEX_H
>> ^^^^ Uggghhh
>>
>>> +
>>> +#include <linux/futex.h>
>>> +#include <linux/uaccess.h>
>>> +#include <asm/errno.h>
>>> +
>>> +
>>> +extern int arch_futex_atomic_op_inuser(int op, u32 oparg, int *oval, u32 __user
>>> *uaddr);
>>> +extern int futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr,
>>> +			      u32 oldval, u32 newval);
>> ^^^^ Did not address Johannes comments, will do in v6
> No need to hurry. This has to wait anyway for 5.12. :-)

That's fine :)

I wanted to get it out of the way and get back to eBPF.

I am trying to get my head around on how to reuse as much as possible from the vector code to build an AF_XDP multi-port netdev and a switchdev on top of that. Some of it is like pulling teeth without anesthetic. The documentation leaves a lot to be desired :)

Compared to that some performance polishing was a nice (and fairly pleasant) distraction.

I think it is close to where it should be now. It passes all benchmarks including multi-threaded userspace ones on both 32 and 64.

One thing which we should probably consider is on/off-ing the display of the CPU flags acquired from the host via a kernel command line switch. At present they are reflected 1:1 into the UML instance.

>
> Thanks,
> //richard
>
-- 
Anton R. Ivanov
Cambridgegreys Limited. Registered in England. Company Number 10273661
https://www.cambridgegreys.com/




More information about the linux-um mailing list