Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp3186546pxb; Sun, 26 Sep 2021 07:43:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy6jJQ/3OG0RQvHh8rBc90stPAdaoZwuV7VMLH7IY6HU090xM+z6ircD1NnXbnLpg1X5ahO X-Received: by 2002:a17:906:940c:: with SMTP id q12mr3413235ejx.151.1632667384957; Sun, 26 Sep 2021 07:43:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632667384; cv=none; d=google.com; s=arc-20160816; b=fZjysgT++OAzH5PQp/sVrWqkjrO7xAkYH5FvztcaQeqYciZN6njS41S7wMAxPzvPN9 rZf06mKchGUEMxXJipM+BShJicFy9p6eiyWZcKkTkMMbSJKhild/ICQeWQoPb7UDCrDl NGZDpH3o8W1husS46KWTGDf2/b3iTTRbcQ6zubS5KgQxZSPSNzrqDAcZ9NrZoQEJnePe f4fzvjWPJp5DFD+NweGK9UZTiZQAmxJbiEH66/Ii/ueF/S3it8rAc4YWTMjbrW/D4gug Gyi5DV6Ygt3lYITQvN2dhUWKiuVDYdpQXbpDcg8NFwbsL2wTC4r7dQbCXntdIOTZ20zp YGQA== 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=hvxujl/WR9NE4z9yR3CG2NsuD0b1CscqQ9FonpyX/t8=; b=NqxpTnB+AE9i3WO1RFMjLG911oZeV42UVU50jVkc/kaP8s4dI/eU+RMgbavFkHQP5B rKfiQsBSectzk5iLVRL41uMYaUt4aXfNG0UjLmJMSuOyxz2Auxkw4TMr+RVzPc8g6Ya4 8Rmm5ckxOSnswJ7HWA8sKy0FOn10x4gPYgIv6LC58E1S5MFn6PconewbU9xfRkH+Iz+f QO8BDF3T0lEKVuTwd/H+C2Nqf0I0aY61zdskPRHCCeq17y6Kcqov4Jga980fjD5o63QN uUodj1KA1S6aS6e0bS4JgQuKk+lOmAcNw35o/izEc0oOa72bmGVOXJS60FAl88U3k03G RYQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=tO78wZ3O; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=tdgMfNN+; 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 r8si15168498edb.185.2021.09.26.07.42.41; Sun, 26 Sep 2021 07:43:04 -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=tO78wZ3O; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=tdgMfNN+; 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 S231869AbhIZOmr (ORCPT + 99 others); Sun, 26 Sep 2021 10:42:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231849AbhIZOmq (ORCPT ); Sun, 26 Sep 2021 10:42:46 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EF5BC061570; Sun, 26 Sep 2021 07:41:10 -0700 (PDT) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1632667266; 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=hvxujl/WR9NE4z9yR3CG2NsuD0b1CscqQ9FonpyX/t8=; b=tO78wZ3Oimkqfmo32SdwkVOF2u/4YvsMWW2EXJfAPODt9bSIgiRTcNErsZUgyFLIGVv/Cg Di1LV7baxeht89PKwwHXAbFVgWi5S4IPzVbrk5Z2i7HfxZJlm2ell/1R1y06Q+zSHs1T6m uE4gD1ECNgKECGHjZCQ8ip1ZtAnJLeEvg2bxcTIYTlgBMfjTQDg9fdZ49GPfsbCYaYUlOW xAs6yJth3Jvgt6Sqbfoap6j5qnvc1nHDaQmYbuUemVtsSqNsEXWUW8RoB0kRC4VAPNZJmp C4F+dcTMCSSeijZMlO4+mBM7HnIxNocVovtnxQAQByV9gLl7DVH+0x4Jc/NpDg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1632667266; 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=hvxujl/WR9NE4z9yR3CG2NsuD0b1CscqQ9FonpyX/t8=; b=tdgMfNN+QcT4fi/5uor+BX9eFf6MqMfFfSFACxG9tQhS5/lYAY9zYIxJTeRg9vtexB8PPb F2lwNbzM65TLgfDQ== 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: <20210913200132.3396598-12-sohil.mehta@intel.com> References: <20210913200132.3396598-1-sohil.mehta@intel.com> <20210913200132.3396598-12-sohil.mehta@intel.com> Date: Sun, 26 Sep 2021 16:41:05 +0200 Message-ID: <874ka7csce.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 13 2021 at 13:01, Sohil Mehta wrote: > Add a new system call to allow applications to block in the kernel and > wait for user interrupts. > > blocking system calls like sleep(), read(), epoll(), etc. > > uintr_wait() is a placeholder syscall while we decide on that > behaviour.> Which behaviour? You cannot integrate this into [clock_]nanosleep() by any means or wakeup something which is blocked in read(somefd) via SENDUIPI. What you can do is implement read() and poll() support for the uintrfd. Anything else is just not going to fly. Adding support for read/poll is pretty much a straight forward variant of a correctly implemented wait()/wakeup() mechanism. While poll()/read() support might be useful and poll() also provides a timeout, having an explicit (timed) wait mechanism might be interesting. But that brings me to an interesting question. There are two cases: 1) The task installed a user space interrupt handler. Now it want's to play nice and yield the CPU while waiting. So it needs to reinstall the UINV vector on return to user and update UIRR, but that'd be covered by the existing mechanism. Fine. 2) Task has no user space interrupt handler installed and just want's to use that wait mechanism. What is consuming the pending bit(s)? If that's not a valid use case, then the wait has to check for that and reject the syscall with EINVAL. If it is valid, then how are the pending bits consumed and relayed to user space? The same questions arise when you think about implementing poll/read support simply because the regular poll/read semantics are: poll waits for the event and read consumes the event which would be similar to #2 above, but with an installed user space interrupt handler the return from the poll system call would consume the event immediately (assumed that UIF is set). Thanks, tglx