Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2358379pxb; Sat, 25 Sep 2021 05:13:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVAAsD0CggnXYiNPsw1Ewk9F/fk78uoxzJL29BtiOXH2E8b5g7XkgeUCOCg9UjVokq9rzw X-Received: by 2002:a17:906:3383:: with SMTP id v3mr17105578eja.213.1632572038335; Sat, 25 Sep 2021 05:13:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632572038; cv=none; d=google.com; s=arc-20160816; b=n4Qw0/8rKwcsRwg46N6Kcz/Ch0pBgYSULEx0r6xuk826hlR199/KiaMek0pLCSZhrM TK3o0rQIVdGkRnYAuPe4wo7ejd54L1PIpZQeIc5+MZFFjBeQTP+yNsfrAz65KjLu43n3 bRHTIW48XcYp8U+tYZ2Vhuk8KzAEeTefkfyCjV1OK2ERHZfYiOguZwr+8vPAl5bSws/y sYgi6BmYzXKT2/GaWYUra1DyPsvnkt/tpsAzje0cXmaoBa3SNcB79wmcVoatjZvImnZQ WrlX+YnFq9AcjtqHdQ+NWOyXZlg8Wa/V62giadiAFgkGCHXgwowPrs6Brzme7gSgEzpw yd2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=e2B/DnmBtUTdcjfM1I8ybzwGAyOjG6d7ZfGM/cv0fB8=; b=C4fiAPR29n5swJad8FaYHYKmnXusLUWpxt/BfY/I8GM9dwa6BC2m8ct3OGlRdI34IY BLvrcDnO7cjblxyJGHxKO6qHRJFF4S8/PDET59qw6WizxDJVUn9oQn5kK2a7TSbOsoYr AvsGXcmW61/zJjzpPCNcBgA8tBkJEUscak9EkTbnqkWenn/+twe6J0vTgwEqfMEUz8jO d0LTN158REHrags8+pWf848sjsrz4RbbrBCJ691fN/lpOTyPuhR2D1EQiQkOdcUvY0A2 U6Gk3Snk/GBKjRgZt0AbGiTPwslO5jBiPZHo98ehNCYwJj2h1Bb97f+xZCZ2eGZS1jVV LpDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=3xSA4uJr; dkim=neutral (no key) header.i=@linutronix.de header.b=GiWhD8ee; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d12si11371150edx.464.2021.09.25.05.13.33; Sat, 25 Sep 2021 05:13:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=3xSA4uJr; dkim=neutral (no key) header.i=@linutronix.de header.b=GiWhD8ee; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244545AbhIYMKU (ORCPT + 99 others); Sat, 25 Sep 2021 08:10:20 -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-kernel@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