[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87czoweu2d.ffs@tglx>
Date: Sat, 25 Sep 2021 14:08:42 +0200
From: Thomas Gleixner <tglx@...utronix.de>
To: Sohil Mehta <sohil.mehta@...el.com>, x86@...nel.org
Cc: Sohil Mehta <sohil.mehta@...el.com>,
Tony Luck <tony.luck@...el.com>,
Dave Hansen <dave.hansen@...el.com>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
"H . Peter Anvin" <hpa@...or.com>,
Andy Lutomirski <luto@...nel.org>,
Jens Axboe <axboe@...nel.dk>,
Christian Brauner <christian@...uner.io>,
Peter Zijlstra <peterz@...radead.org>,
Shuah Khan <shuah@...nel.org>, Arnd Bergmann <arnd@...db.de>,
Jonathan Corbet <corbet@....net>,
Ashok Raj <ashok.raj@...el.com>,
Jacob Pan <jacob.jun.pan@...ux.intel.com>,
Gayatri Kammela <gayatri.kammela@...el.com>,
Zeng Guang <guang.zeng@...el.com>,
Dan Williams <dan.j.williams@...el.com>,
Randy E Witt <randy.e.witt@...el.com>,
Ravi V Shankar <ravi.v.shankar@...el.com>,
Ramesh Thomas <ramesh.thomas@...el.com>,
linux-api@...r.kernel.org, linux-arch@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-kselftest@...r.kernel.org
Subject: Re: [RFC PATCH 11/13] x86/uintr: Introduce uintr_wait() syscall
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.
CPUX
switchto(tsk)
tsk->upid.ndst = apicid(smp_processor_id();
ret_to_user()
...
sys_uintr_wait()
...
schedule()
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.
Thanks,
tglx
Powered by blists - more mailing lists