Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp6332873rwb; Tue, 22 Nov 2022 11:49:46 -0800 (PST) X-Google-Smtp-Source: AA0mqf51KOqy/f4828HeXuQRpx2q+f+1vfyShXPO8kkiX1x2qXW3F54R7RL+AvmpudtCmX6btueO X-Received: by 2002:a05:6a00:d66:b0:56a:fd45:d054 with SMTP id n38-20020a056a000d6600b0056afd45d054mr11445617pfv.3.1669146585745; Tue, 22 Nov 2022 11:49:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669146585; cv=none; d=google.com; s=arc-20160816; b=oqxdn9OFSS80wTdmFDwY+bWz//nFMVaUisk4K6NI4b4wBMKb+/ONeuoxR+BB58KyVi Wp0oqO6ZuN5KaMTBfk4FOVF0Sspfq/vsuPB1vg9lwq2MKXYFBFi95f5YdtBQFJ03z1x3 +JM2FATlTAY75g/EqwF6p0Xabk+Ih0u3mGnASmJUmWnpNUmLSZoQCViPUSz7XZLLx/5u CH4/ND9/Fgd9eiJ45aqr6bJu17oFl08lJmaX0aKUhIVkX/F239rz5G9RQ9bCaCR7NFv9 JASco7+9+oGgflFOJzRJW2iibiUfMkimQx8QyQ1/YpJqfuBo1Uvxg3BCbSSA3KvcGRGk VkVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=iF4AjT0TuyMM/apGrDH02XmhOks7vs/u/bD1CuJwmjs=; b=Km57wGhn+fCXCLddLe+dRQqJpjLt7zHDXYhGdLTvvQ+fw/nzP0hWWbpLvlwxNZwukA uwZ6wghOIHk/Bi1utYIuU9m0yedO4XiSUbYa+W2cMeAMdJm9jg1TjlP1gSHhF3YhCaz6 60J97cNXNWaLt2mRY1/FBanAMSe61fnAokIiL6ToqaErLnOB07aThIuBUS9qUJ6hsdmW x06InCfDdg2t9U1F0T/2Ru4wzS+b/U8e1LIFOAfRxfBccO4F/30kn7LiQ4uSEhmdxYLZ RF+bEoyWZx3Lam8o3/ZnTcD/KTEwGJI/FRdxtdpf/djft1rZb0EDmlIFBcwv5jCq7mvi V1RQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=JsjL9CVQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t67-20020a635f46000000b00476e7bc209esi14794530pgb.641.2022.11.22.11.49.34; Tue, 22 Nov 2022 11:49:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=JsjL9CVQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234692AbiKVTHY (ORCPT + 90 others); Tue, 22 Nov 2022 14:07:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234800AbiKVTG6 (ORCPT ); Tue, 22 Nov 2022 14:06:58 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D73D8CFFB; Tue, 22 Nov 2022 11:06:56 -0800 (PST) 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> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.