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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 71C52C433FE for ; Tue, 22 Nov 2022 19:06:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 129B46B0071; Tue, 22 Nov 2022 14:06:45 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0B2CD6B0073; Tue, 22 Nov 2022 14:06:45 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E6E9F6B0074; Tue, 22 Nov 2022 14:06:44 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id D341F6B0071 for ; Tue, 22 Nov 2022 14:06:44 -0500 (EST) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id A3363C02A4 for ; Tue, 22 Nov 2022 19:06:44 +0000 (UTC) X-FDA: 80162009928.19.5006A91 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf26.hostedemail.com (Postfix) with ESMTP id 466C214000E for ; Tue, 22 Nov 2022 19:06:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=iF4AjT0TuyMM/apGrDH02XmhOks7vs/u/bD1CuJwmjs=; b=JsjL9CVQC0ssTneONk7yiJiQHv 8Ju4QsHydkE0qUK6YSWkjRZq0BMdWkeDc6dOX05KhSPozfg5e3lI8NrmPG5mpwJ4Th1f0v08uW0EF 6Uhdr5k9kVRjh1ChA1XNL8mm/lzG1fW6jlO5amjqzoh8rvYh0wtTJYFu4Cg/mcIUH4iXRevpPQlr1 au50xKMuxYf5xVWYR7uHtatEP/9cku4SLFjutl3wGichdzd74EmBfG8JHROybK++7OKaKuIw9v1rI 5WfnKze9DA0Y+wZhTOolu+aRT47VzyIvCrBAJaISKd03cXp44gnW256bRK0vYqmQlwPEBdLZm2Klu 4NJmhfaA==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1oxYbS-006fYD-Oc; Tue, 22 Nov 2022 19:06:42 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 8C476300202; Tue, 22 Nov 2022 20:06:34 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 76A4A20B64111; Tue, 22 Nov 2022 20:06:34 +0100 (CET) Date: Tue, 22 Nov 2022 20:06:34 +0100 From: Peter Zijlstra To: Thomas Gleixner Cc: Kai Huang , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-mm@kvack.org, seanjc@google.com, pbonzini@redhat.com, dave.hansen@intel.com, dan.j.williams@intel.com, rafael.j.wysocki@intel.com, kirill.shutemov@linux.intel.com, ying.huang@intel.com, reinette.chatre@intel.com, len.brown@intel.com, tony.luck@intel.com, ak@linux.intel.com, isaku.yamahata@intel.com, chao.gao@intel.com, sathyanarayanan.kuppuswamy@linux.intel.com, bagasdotme@gmail.com, sagis@google.com, imammedo@redhat.com Subject: Re: [PATCH v7 06/20] x86/virt/tdx: Shut down TDX module in case of error Message-ID: References: <48505089b645019a734d85c2c29f3c8ae2dbd6bd.1668988357.git.kai.huang@intel.com> <87bkozgham.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87bkozgham.ffs@tglx> ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1669144003; a=rsa-sha256; cv=none; b=zQ5lFIgdlnmKs71Kky4PLzyrKT4iIY4Oe7sISDZ2l9W4x0MEtoHB8FZMFucpQmBIHxjjz4 MJ35Rehzam62vsp4ItrhODoVYf1rsbezpJRpRxmbnOiu6ZZSceYnM3Nw7tgCA+Qrf/fIrS KkTz4c4AMzEP5vxqm3d/HOPEj26MfSs= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=JsjL9CVQ; spf=none (imf26.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=peterz@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1669144003; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=iF4AjT0TuyMM/apGrDH02XmhOks7vs/u/bD1CuJwmjs=; b=AtW/CCbjKUF+gu1oqwqm4R/LMgQXHxERqV3QrL4rX9IFnjK8t/Zkt3rJwUjRfVZNeaI10c XvtUeuBFfX4f4JQuDYXSiYt/77us80OScdOETWkdKqIDJGxPIykIPCi7VMXHJWWPuvwEVr ntqcKmm6iJXXjXEloETTEH3H5nLClvQ= X-Stat-Signature: 63r5gqo99wpikeifxeeuaufmxe9znigm X-Rspamd-Queue-Id: 466C214000E X-Rspam-User: Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=JsjL9CVQ; spf=none (imf26.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=peterz@infradead.org; dmarc=none X-Rspamd-Server: rspam02 X-HE-Tag: 1669144003-643712 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, Nov 22, 2022 at 04:06:25PM +0100, Thomas Gleixner wrote: > On Tue, Nov 22 2022 at 10:20, Peter Zijlstra wrote: > > > On Mon, Nov 21, 2022 at 01:26:28PM +1300, Kai Huang wrote: > > > >> Shutting down the TDX module requires calling TDH.SYS.LP.SHUTDOWN on all > >> BIOS-enabled CPUs, and the SEMACALL can run concurrently on different > >> CPUs. Implement a mechanism to run SEAMCALL concurrently on all online > >> CPUs and use it to shut down the module. Later logical-cpu scope module > >> initialization will use it too. > > > > Uhh, those requirements ^ are not met by this: > > Can run concurrently != Must run concurrently > > The documentation clearly says "can run concurrently" as quoted above. The next sentense says: "Implement a mechanism to run SEAMCALL concurrently" -- it does not. Anyway, since we're all in agreement there is no such requirement at all, a schedule_on_each_cpu() might be more appropriate, there is no reason to use IPIs and spin-waiting for any of this. That said; perhaps we should grow: schedule_on_cpu(struct cpumask *cpus, work_func_t func); to only disturb a given mask of CPUs.