Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5450346rwd; Mon, 12 Jun 2023 05:27:16 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5TDQ+Xms6ogEVZGlY+MYDjuJldeUr5A4BI76Z0xrGFVb+peI1bGWyVIiz7vBeRhEZlF/MQ X-Received: by 2002:a17:907:1b1c:b0:966:5730:c3fe with SMTP id mp28-20020a1709071b1c00b009665730c3femr9203995ejc.52.1686572836580; Mon, 12 Jun 2023 05:27:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686572836; cv=none; d=google.com; s=arc-20160816; b=q7XuwJb/9MyBXAEZgYEHxno7L8aLfDmv/tTMLB/X6igKwZDT/7TJ2h44OalmescN2N OGfz9wJXJMCxtVacT0PvALlkc8PS/n5sb8etR2U9Kcchn6O9FAYDWiX0w0NFkppxu0UB FVrUCTZB1oQiTaKZ+NZM4LIJHokW+zawVAaC1ePRfNwjjtq9N3RQADihL/kAarDVrbed 2wLSW80aM1NpPQ2Xeae2aPscmlixy39+Ie3TBgdgoM6tHlDHxnAV553ENuOqfVp+6WiV rymCMCkC65kAnBmwBuJNWli7lYvUcy5HxcFPlx0NKP2CTwO9IikI3GW4lqsM299ECjcC 87DA== 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=QFaajNnXPhInv7U70SG508yb0nOxeuCjpJIt9D3uNqE=; b=OE1fsz4QnWxxJ07EZy+R2KvP5lF4clBuqbGdWI0667u8NgmkZeD96IpxnEbVNwV+67 BadgFX7iX9uEIvKmpYI6PpPVKWQS7QcQhKFdjY1IYehNrY01gedW6yhKgPMqESWWdsQ3 iC/c1JVRNzM7Xel+x3ANNdL+JYEdOTAouFcc7zl9R0WHlu3MLPkxoKofeMeNGMjL7sAq DPav4OKn5w5PzYCibTSLXbyFaCihQH5bdxxkU1E0cqDAZlJFoEDnp9zhM/QXfBN9m6il t1cJLn4MSiF6yRgiAxfSwwxXeKqxglsIyVXcX/lmicXHm3B8pM4fiN4FC2D5WCraydrl QMVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="YiV/3bOP"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g5-20020a170906594500b00977cb4cca9bsi5462051ejr.363.2023.06.12.05.26.51; Mon, 12 Jun 2023 05:27:16 -0700 (PDT) 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=@intel.com header.s=Intel header.b="YiV/3bOP"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234136AbjFLLwY (ORCPT + 99 others); Mon, 12 Jun 2023 07:52:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229718AbjFLLwH (ORCPT ); Mon, 12 Jun 2023 07:52:07 -0400 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 834D410F3; Mon, 12 Jun 2023 04:48:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686570532; x=1718106532; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=+22Jf0EMHFPnCqknPTx9ZddJNhv2p1ffZekjkOO7nn4=; b=YiV/3bOPs0pkrntYdJieKyPSpH3Jjo8IXP6LxHKbnhB0rFMDavZo6wXo tA8I94qCnB2jhrJ0N4WLA/sK1CIccZ2nE3TeqxYTD57wlpXac4BrZWgqP klUdPq79oPz7HYQ5cS7TZoo9qRSA5lwmZSIHbHxDcL88wstkpZJQGsuCJ 5iXYwfF1sjpoGuUfpo3+rf7iCYhpkr2sPZya7yEcUvzP5+2HJQiJihPLW 0bP6J0eJZc7S4v/iMFCQ5CyeviurnU9qzVlYYRjNiM8AXCuXcw7t9FY9T ih2ITg+4voHD9d+xKFVETSkupf7NJe0/WLDaG0iPEnugYF3EdC1UnB/kV g==; X-IronPort-AV: E=McAfee;i="6600,9927,10738"; a="360501371" X-IronPort-AV: E=Sophos;i="6.00,236,1681196400"; d="scan'208";a="360501371" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2023 04:48:51 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10738"; a="740998332" X-IronPort-AV: E=Sophos;i="6.00,236,1681196400"; d="scan'208";a="740998332" Received: from smizr3x-mobl3.ger.corp.intel.com (HELO box.shutemov.name) ([10.249.43.127]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2023 04:48:46 -0700 Received: by box.shutemov.name (Postfix, from userid 1000) id 4FE6610CC1C; Mon, 12 Jun 2023 14:48:43 +0300 (+03) Date: Mon, 12 Jun 2023 14:48:43 +0300 From: "kirill.shutemov@linux.intel.com" To: "Huang, Kai" Cc: "kvm@vger.kernel.org" , "Hansen, Dave" , "david@redhat.com" , "bagasdotme@gmail.com" , "ak@linux.intel.com" , "Wysocki, Rafael J" , "Luck, Tony" , "Chatre, Reinette" , "Christopherson,, Sean" , "pbonzini@redhat.com" , "tglx@linutronix.de" , "Yamahata, Isaku" , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" , "Shahar, Sagi" , "peterz@infradead.org" , "imammedo@redhat.com" , "Gao, Chao" , "Brown, Len" , "sathyanarayanan.kuppuswamy@linux.intel.com" , "Huang, Ying" , "Williams, Dan J" Subject: Re: [PATCH v11 18/20] x86: Handle TDX erratum to reset TDX private memory during kexec() and reboot Message-ID: <20230612114843.n7vvoh7m2rk4la56@box.shutemov.name> References: <5aa7506d4fedbf625e3fe8ceeb88af3be1ce97ea.1685887183.git.kai.huang@intel.com> <20230609132301.uvvp27yr5kpenl6f@box.shutemov.name> <58f34b4b81b6d6b37d3386dec0f073e6eb7a97ff.camel@intel.com> <20230612075830.jbrdd6ysz4qq7wdf@box.shutemov.name> <4c7effc3abe71aa1cbee41f3bd46b97aed40be26.camel@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4c7effc3abe71aa1cbee41f3bd46b97aed40be26.camel@intel.com> X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE 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 Mon, Jun 12, 2023 at 10:27:44AM +0000, Huang, Kai wrote: > Does it make sense? I understand your logic. AFAICS, it is correct (smp_mb() instead of __mb() would be better), but it is not justified from complexity PoV. This lockless exercise gave me a pause to understand. Lockless doesn't buy you anything here, only increases complexity. Just take a lock. Kernel is big. I'm sure you'll find a better opportunity to be clever about serialization :P -- Kiryl Shutsemau / Kirill A. Shutemov