Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp699809pxb; Thu, 30 Sep 2021 15:24:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwMf+Swb71EGw8k/QJFucrXQ41Sxqm5F1VyIM+CrhSdk8K0RWDH0HLUqAG9ixvO1+4PzT5d X-Received: by 2002:a62:15c3:0:b0:43d:e6be:156a with SMTP id 186-20020a6215c3000000b0043de6be156amr6721585pfv.1.1633040695783; Thu, 30 Sep 2021 15:24:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633040695; cv=none; d=google.com; s=arc-20160816; b=i+zQWlIJ/wzEpPznNmMdTnMsj8wRpuG88MxwCXseqlmRlNlIvdA4/AnMffrTe16bwj QAW+zxegHDM5mqCPbsM067At8l5eAh2IwkvjP8xkmrZrnTnyvwL61z6zc1Naha3Xr2gr BtfJIfMO/oaSUEzgZbw40kfQct6JXTBxVKJtu4B+BUpb0vgqlN60LCzbDHFy6mZP9toM TV4xMpL3pX5YR+HCAbPHHZI1+K8yrBJaiVQHVky0k6Oh5Jx8piwvAbtV7sdVwUHEqryK PQ0m9PVAYozClNdRKCiGNQ/rHO6QDSDV8fQF+9nDOOxh78FFc2dC9+nC4SOA5YulOROr NCsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:subject:cc:to:from :date:references:in-reply-to:message-id:mime-version:user-agent :dkim-signature; bh=wiyqKZMp4FTWIDd+TCX3nwcftkzpqHC1XQtYFKwDCcQ=; b=qRKwBc6ISA7Vpxe/bQ6fNezO+JQtep1gkDMiA2AQsOSKouKc+c8oqHKHkYAQdYy6Ea /Ky5+TitBXcEv9n92ifpCwjqvlXp3brxBST0Skh/dPfv9OjJUopQuMlS+chiwCMoNift qK1282gkjf33GeKUJ141qslMasOMJelWRoHDHrSc06HPKXEyduitS38zyDPLTMhZK70K XMGYcc6zeFiPKGwRojrcZwVjN51tRsM6b9gTRLPMjCUBWhVhjIoKVOfE9DeS/G9DHr0A xzFkhrT0Gji1QSZ4HV812pJrcowXRPralu7DsoaiaLrX8C19YUyk2sW8LoTWPuuyAWJ0 8Alw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DoX0Ovxq; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u16si6769539ple.272.2021.09.30.15.24.42; Thu, 30 Sep 2021 15:24:55 -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=@kernel.org header.s=k20201202 header.b=DoX0Ovxq; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245683AbhI3WDw (ORCPT + 99 others); Thu, 30 Sep 2021 18:03:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:55350 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229644AbhI3WDv (ORCPT ); Thu, 30 Sep 2021 18:03:51 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5E349619F5; Thu, 30 Sep 2021 22:02:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1633039328; bh=2lX2HS9p7h6jVhzTp+A/c8lOWnTkxK3BWpjUhjVAspk=; h=In-Reply-To:References:Date:From:To:Cc:Subject:From; b=DoX0OvxqWP+fcmhRSZwVxN4k+1r5YBC1wRi8pniTKlxH3tACBGX4+E1i+yVjntK4b 0iWtOlCOdWHpEAn3J3bL3IlchzExStZ5E2auAtQpd7bF8WyG8bw7F2s0CP5APPTDTo 0m3wwZ4U+BrL5+4//yR5l1VxJDd8Ti3ELWDMrfuGilQP4e0dGIJnOGwzhlTY69oB13 GKVmw4+PEamDDsv1AIqh0mnH4w1g+7W4XlKyD2Nhyfyj0WgzXCXQ4sPK5MOl1pEJmZ 18m+YIc09tm+G4oVB3Sbgh3Q3juJMrICckMfzuRVUFhaCWVruZDmxzvFPgnCsmIQnl GvnUP3JDGUo6A== Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailauth.nyi.internal (Postfix) with ESMTP id 7EFF227C0054; Thu, 30 Sep 2021 18:02:05 -0400 (EDT) Received: from imap48 ([10.202.2.98]) by compute6.internal (MEProxy); Thu, 30 Sep 2021 18:02:05 -0400 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrudekhedgtdegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgfgsehtqhertderreejnecuhfhrohhmpedftehn ugihucfnuhhtohhmihhrshhkihdfuceolhhuthhosehkvghrnhgvlhdrohhrgheqnecugg ftrfgrthhtvghrnhepvdelheejjeevhfdutdeggefftdejtdffgeevteehvdfgjeeiveei ueefveeuvdetnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh homheprghnugihodhmvghsmhhtphgruhhthhhpvghrshhonhgrlhhithihqdduudeiudek heeifedvqddvieefudeiiedtkedqlhhuthhopeepkhgvrhhnvghlrdhorhhgsehlihhnuh igrdhluhhtohdruhhs X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 689F621E0062; Thu, 30 Sep 2021 18:02:04 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-1322-g921842b88a-fm-20210929.001-g921842b8 Mime-Version: 1.0 Message-Id: In-Reply-To: <877dex7tgj.ffs@tglx> References: <20210913200132.3396598-1-sohil.mehta@intel.com> <20210913200132.3396598-12-sohil.mehta@intel.com> <877dex7tgj.ffs@tglx> Date: Thu, 30 Sep 2021 15:01:44 -0700 From: "Andy Lutomirski" To: "Thomas Gleixner" , "Sohil Mehta" , "the arch/x86 maintainers" Cc: "Tony Luck" , "Dave Hansen" , "Ingo Molnar" , "Borislav Petkov" , "H. Peter Anvin" , "Jens Axboe" , "Christian Brauner" , "Peter Zijlstra (Intel)" , "Shuah Khan" , "Arnd Bergmann" , "Jonathan Corbet" , "Raj Ashok" , "Jacob Pan" , "Gayatri Kammela" , "Zeng Guang" , "Williams, Dan J" , "Randy E Witt" , "Shankar, Ravi V" , "Ramesh Thomas" , "Linux API" , linux-arch@vger.kernel.org, "Linux Kernel Mailing List" , linux-kselftest@vger.kernel.org Subject: Re: [RFC PATCH 11/13] x86/uintr: Introduce uintr_wait() syscall Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 30, 2021, at 12:29 PM, Thomas Gleixner wrote: > On Thu, Sep 30 2021 at 11:08, Andy Lutomirski wrote: >> On Tue, Sep 28, 2021, at 9:56 PM, Sohil Mehta wrote: >> I think we have three choices: >> >> Use a fancy wrapper around SENDUIPI. This is probably a bad idea. >> >> Treat the NV-2 as a real interrupt and honor affinity settings. This >> will be annoying and slow, I think, if it's even workable at all. > > We can make it a real interrupt in form of a per CPU interrupt, but > affinity settings are not really feasible because the affinity is in t= he > UPID.ndst field. So, yes we can target it to some CPU, but that's racy. > >> Handle this case with faults instead of interrupts. We could set a >> reserved bit in UPID so that SENDUIPI results in #GP, decode it, and >> process it. This puts the onus on the actual task causing trouble, >> which is nice, and it lets us find the UPID and target directly >> instead of walking all of them. I don't know how well it would play >> with hypothetical future hardware-initiated uintrs, though. > > I thought about that as well and dismissed it due to the hardware > initiated ones but thinking more about it, those need some translation > unit (e.g. irq remapping) anyway, so it might be doable to catch those > as well. So we could just ignore them for now and go for the #GP trick > and deal with the device initiated ones later when they come around :) Sounds good to me. In the long run, if Intel wants device initiated fanc= y interrupts to work well, they need a new design. > > But even with that we still need to keep track of the armed ones per C= PU > so we can handle CPU hotunplug correctly. Sigh... I don=E2=80=99t think any real work is needed. We will only ever have ar= med UPIDs (with notification interrupts enabled) for running tasks, and = hot-unplugged CPUs don=E2=80=99t have running tasks. We do need a way t= o drain pending IPIs before we offline a CPU, but that=E2=80=99s a separ= ate problem and may be unsolvable for all I know. Is there a magic APIC = operation to wait until all initiated IPIs targeting the local CPU arriv= e? I guess we can also just mask the notification vector so that it won= =E2=80=99t crash us if we get a stale IPI after going offline. > > Thanks, > > tglx