Re: [RFC PATCH 11/13] x86/uintr: Introduce uintr_wait() syscall
From: Thomas Gleixner
Date: Sat Sep 25 2021 - 08:10:21 EST
On Fri, Sep 24 2021 at 13:04, Thomas Gleixner wrote:
> On Mon, Sep 13 2021 at 13:01, Sohil Mehta wrote:
>> +int uintr_receiver_wait(void)
>> + struct uintr_upid_ctx *upid_ctx;
>> + unsigned long flags;
>> + if (!is_uintr_receiver(current))
>> + return -EOPNOTSUPP;
>> + upid_ctx = current->thread.ui_recv->upid_ctx;
>> + upid_ctx->upid->nc.nv = UINTR_KERNEL_VECTOR;
>> + upid_ctx->waiting = true;
>> + spin_lock_irqsave(&uintr_wait_lock, flags);
>> + list_add(&upid_ctx->node, &uintr_wait_list);
>> + spin_unlock_irqrestore(&uintr_wait_lock, flags);
>> + set_current_state(TASK_INTERRUPTIBLE);
> Because we have not enough properly implemented wait primitives you need
> to open code one which is blantantly wrong vs. a concurrent wake up?
>> + schedule();
> How is that correct vs. a spurious wakeup? What takes care that the
> entry is removed from the list?
> Again. We have proper wait primitives.
Aisde of that this is completely broken vs. CPU hotplug.
tsk->upid.ndst = apicid(smp_processor_id();
After that CPU X is unplugged which means the task won't be woken up by
an user IPI which is issued after CPU X went down.