From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BC68EC433FE for ; Sat, 25 Sep 2021 12:08:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 864B26128C for ; Sat, 25 Sep 2021 12:08:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237275AbhIYMKT (ORCPT ); Sat, 25 Sep 2021 08:10:19 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:46738 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236977AbhIYMKT (ORCPT ); Sat, 25 Sep 2021 08:10:19 -0400 From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1632571723; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=e2B/DnmBtUTdcjfM1I8ybzwGAyOjG6d7ZfGM/cv0fB8=; b=3xSA4uJrcj05si1FtYNZ2gjHPgD+iZ3ZzFnVsR+SgUx5njX7sbDGiyw+ocIZ4L4EsWmfjU GeoM4tBxBbSdGX6VPKH1EsY7i3KapzZsFJD/izk92L1dba9MaRgYGfSnxuSN3Oi5Ie3NSL vBk0DyeW9hsAY1KhfdnwqE7TXATl3UPBUg69UFlCAcWphH3z1hqrefcDATSz8mxK25BqcG UNod0jc26wnkW0zfKnAhdtpw6RMG6XE2KVyVOHVD+W75zSnB37J1LwlbnjQ1+DBbSil1iV YPUokMNf8pAIjVjOMek6F/dR0Dd+K+MtyjrD2Ua0+B/W3kmZa47D0L1+09LZfg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1632571723; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=e2B/DnmBtUTdcjfM1I8ybzwGAyOjG6d7ZfGM/cv0fB8=; b=GiWhD8eeRtvuZCs7HMXPcrsK+5wD7DWsSVEj54dK3+H3KTnPYjd58ntmrhReVT9hByTGvZ QabEZ4Ka3zSyrFDA== To: Sohil Mehta , x86@kernel.org Cc: Sohil Mehta , Tony Luck , Dave Hansen , Ingo Molnar , Borislav Petkov , "H . Peter Anvin" , Andy Lutomirski , Jens Axboe , Christian Brauner , Peter Zijlstra , Shuah Khan , Arnd Bergmann , Jonathan Corbet , Ashok Raj , Jacob Pan , Gayatri Kammela , Zeng Guang , Dan Williams , Randy E Witt , Ravi V Shankar , Ramesh Thomas , linux-api@vger.kernel.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: Re: [RFC PATCH 11/13] x86/uintr: Introduce uintr_wait() syscall In-Reply-To: <87r1dedykm.ffs@tglx> References: <20210913200132.3396598-1-sohil.mehta@intel.com> <20210913200132.3396598-12-sohil.mehta@intel.com> <87r1dedykm.ffs@tglx> Date: Sat, 25 Sep 2021 14:08:42 +0200 Message-ID: <87czoweu2d.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-arch@vger.kernel.org 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