Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp432349iog; Fri, 24 Jun 2022 06:56:23 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tvAIHJ2fDFx8TR9Nw+pivmpHDEGAvooiRezEkmLWQCEelDEttcS1EUPWRSUzrkgcckL8jB X-Received: by 2002:a17:902:a9c7:b0:168:ec21:2e25 with SMTP id b7-20020a170902a9c700b00168ec212e25mr44034055plr.24.1656078983674; Fri, 24 Jun 2022 06:56:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656078983; cv=none; d=google.com; s=arc-20160816; b=Xt+JaVZbuUZLJVgjtHvgZozb8woOIURGc8D7num3KKDKdw1ygDmy82lQ7dLJbcifSC W+ajMJ89Fd8WZ3Wy8All5sh+82G3rqDi7VRD44eQGzzC+4bebd5/DaPRkJHeFroFMjxX gs9k/XHjqyTeo5MfkKxUtsX0L77kfH709hOc+MuxtwsTqEskNww99QGs82IGpWigsDJp b8Yr25zIviHBTMls1jG5TYn3LOAQ8TC8o7q8haY9LixO/oXwhlP068JGhLbW3F+MLzIg RD5BGYLIVJlqGMs8frSp18BA5uW4MWoPk77gay5E6MOKftf18RVfeC2nLclWNw1cML3d aaEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=wJ7ErS3OevIl7r5mCZy3UYLMtU+CJ7iQXxRN336ronM=; b=jCGI6vE0E6ckcBK+1fvOn3Q3f7hdhfP6x9hsu6dsXuPok0ORBi+bvWVRbQM798k6tw LNU0u0yws29Q5Z88doj6ClJamFBBPr/65ppQLlEFeeRmQazmiH2JlaDwQBRAp/kDcLzw 48MqvVEKIsDFjSwI4815gXRbFxgN+WmPjf0n0PQQIjqqPvm+DBKWndCsoEdW99UAgJjr XcItdRPWTbfDWsmrwVT+kGqgZ2YsrHAd6iSV8Ag6lDU619bv3M4xkBS0Tr+PL2gLVEj5 QIggf91xsZPwdh7KmyoQZOC7gc7F21PRgyF1JZnVrpzAc+Ndh9myutJQaRVNgjYKWoVZ WwVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=a9E1GH6R; 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 f4-20020a056a00238400b00525781f40f1si1614606pfc.103.2022.06.24.06.56.10; Fri, 24 Jun 2022 06:56:23 -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=a9E1GH6R; 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 S231757AbiFXNUA (ORCPT + 99 others); Fri, 24 Jun 2022 09:20:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231254AbiFXNT6 (ORCPT ); Fri, 24 Jun 2022 09:19:58 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25EF654FBD for ; Fri, 24 Jun 2022 06:19:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1656076797; x=1687612797; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=OP4OPqMU/aTprlJAWfXbs7y8fAZNP38GbVym8fpLFeo=; b=a9E1GH6R7YqOho9OZU6jh711qVLMZ6301JmVZa1nfC0YipdVUWRwQqbN R5Q2eTb4mEgZu89Tpg3zVQN+6BmY7DHUmt6NZt+ERV1Ird+X1zkphhHte 1Wtp1BFl309vS3/zFcYL7e9yc8BjkX11CweZaR3b9ngGz8Q1Whu07yLAR FU4jrGqIBEDvDOhep2jxrK1S28ha192agNb+kTYFYLfgh1U+HG63kmtma T8rd/GU0fhycnWOmssW/WqLi0A5dyKuZ1aLxgNWFUJ2r+1X5kzJHfrkVd vKQo8pe5XAdtUIb1hU0o9zYQ5mcHxguL1nsre6t0/B5Uu5OI3IqWnx/EI A==; X-IronPort-AV: E=McAfee;i="6400,9594,10387"; a="260813864" X-IronPort-AV: E=Sophos;i="5.92,218,1650956400"; d="scan'208";a="260813864" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jun 2022 06:19:56 -0700 X-IronPort-AV: E=Sophos;i="5.92,218,1650956400"; d="scan'208";a="586571033" Received: from mdedeogl-mobl.amr.corp.intel.com (HELO [10.209.126.186]) ([10.209.126.186]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jun 2022 06:19:56 -0700 Message-ID: Date: Fri, 24 Jun 2022 06:19:23 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH v8 4/5] x86/mm: Add noalias variants of set_memory_*crypted() functions Content-Language: en-US To: Kuppuswamy Sathyanarayanan , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org Cc: "H . Peter Anvin" , "Kirill A . Shutemov" , Tony Luck , Andi Kleen , Kai Huang , Wander Lairson Costa , Isaku Yamahata , marcelo.cerri@canonical.com, tim.gardner@canonical.com, khalid.elmously@canonical.com, philip.cox@canonical.com, linux-kernel@vger.kernel.org References: <20220609025220.2615197-1-sathyanarayanan.kuppuswamy@linux.intel.com> <20220609025220.2615197-5-sathyanarayanan.kuppuswamy@linux.intel.com> From: Dave Hansen In-Reply-To: <20220609025220.2615197-5-sathyanarayanan.kuppuswamy@linux.intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_PASS,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 6/8/22 19:52, Kuppuswamy Sathyanarayanan wrote: > set_memory_*crypted() functions are used to modify the "shared" page > attribute of the given memory. Using these APIs will modify the page > attributes of the aliased mappings (which also includes the direct > mapping). > > But such aliased mappings modification is not desirable in use cases > like TDX guest, where the requirement is to create the shared mapping > without touching the direct map. It is used when allocating VMM shared > buffers using alloc_pages()/vmap()/set_memory_*crypted() API > combinations. > > So to support such use cases, add support for noalias variants of > set_memory_*crypted() functions. This changelog has a lot of words, but doesn't tell us much. It basically says, we don't want to touch the direct map in use cases where we don't want to touch the direct map. Not helpful. The alias processing is there for a reason. What is it? Why don't you need alias processing for TDX? Sure, you decided you don't want to touch the direct map, but *WHY*? Why is it normally OK to touch the direct map, but not OK in this case? Even better, why is it *DESIRABLE* to leave the direct map alone? Lastly, why is this safe? If alias processing was to protect us from something, why is losing that protection OK here?