Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp3604141pxt; Tue, 10 Aug 2021 07:19:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyz4be47dAZw49GF6moWjMCshMmUGcR3eW/TXZ98Af9mg7F5o8eoU7r9fczghhBSo4c1pxO X-Received: by 2002:a17:906:4d94:: with SMTP id s20mr26960339eju.152.1628605144050; Tue, 10 Aug 2021 07:19:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628605144; cv=none; d=google.com; s=arc-20160816; b=SOp3WEw3kaKZ3yFJN+6n89dwsnHvj9MUEFzCxUNdNk46nzGyDEOtZUZRWWhCpaHwE1 uzW5gkU7ENGxD97LYSto+PZSl/Z4UNrzm3KefVKwEpCkoiC3odoDkXbJnNc5P/hIJAhj dlGKSoz7DDl4F7HKdJAvX97ZUGn/6UGcAhxAXU5Y9TNC0Im9T6DSSwGVZ2VPjxfhgBzm k7d1cydjiztwchv+aa76rY9QYICz71T1XUKtKcIvK60WHbtl6PX+xIWEHNpr7cHps19s VgFh5C1uOAR29b7UivyXWMtQBzdtQFaxOwqG+9Y85P0OlkAkiymdMEfCLyZpNSpSex3O IMaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=66KGVVLHGJOMxSHzgJj6VDCRB8/apj3sR/Ynuos6wU8=; b=T18HDhUZ/uKoJU4cTUPvdOQePANgF0Y0g87WopBOPb2iF8Mdv98vmq9M34E7TeICQM 1LhzKKdrJbNKFb6tp/9E4FSJYx8G4YX+wfi0bkk8VREF6pSxB65kAUQqczu4GB9GA0nx OkzdUH/Rhw1zNL/xz17d1Oi3gfCfkHdns/+LWJphMVOP9hcoWRXlqw49p9pDZ0DGAmy1 HCt8RuGM17imc5D+ei9FRPgG2irDNCpySLdwf4ODyFCZT3J1stJEcVbdeRFKWGUTrg6L NpimjnRxYJvcEQYtaRJ0J/oYNRpxi1zdrqeC0RnVbrft37ufmuO7B1Q40gXlmMN1DnLz FwNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=pt4Qw4Gt; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w18si18029357edd.285.2021.08.10.07.18.37; Tue, 10 Aug 2021 07:19:04 -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=@gmail.com header.s=20161025 header.b=pt4Qw4Gt; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240793AbhHJNJy (ORCPT + 99 others); Tue, 10 Aug 2021 09:09:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238793AbhHJNJx (ORCPT ); Tue, 10 Aug 2021 09:09:53 -0400 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B94DDC0613D3; Tue, 10 Aug 2021 06:09:31 -0700 (PDT) Received: by mail-pj1-x102e.google.com with SMTP id mq2-20020a17090b3802b0290178911d298bso5285565pjb.1; Tue, 10 Aug 2021 06:09:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=66KGVVLHGJOMxSHzgJj6VDCRB8/apj3sR/Ynuos6wU8=; b=pt4Qw4Gt2cFRP884fMrdBTfJzkwL2gx6Mo1qS6xvvDhfSdIustLAFX7++VkRY1h4um tTehujaFm9rbEjIEwB0Xu4QM2VZRfXhLGrMo8JNp/sDj6XoPD9WPfZ8v2F3qn2rH9A9d OGCnPFdaPpTRfjqukxIeWiIpd6XfYc4MZvSVh7tbwIwGO2vT6u6skC56ab4LGrfYsBku cbFUdZZjMM6VnimGAjkoLRcPks9PLwbJP0vFH3G0Hbv47WNqW4yslC4eCkDCDu113c9j ijT0klWyzKut4iQ2YBiKGjugVqCFd+8zcrAniUpAohoQSh6qC1V2Qr33L9WPJqBDjAdX IuxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=66KGVVLHGJOMxSHzgJj6VDCRB8/apj3sR/Ynuos6wU8=; b=frCKtQI1YS38Xm+X5OX3SvlTItm+3OFg53bIjvJol3QyTBtKAao5HDsf05rra10xEQ 3LhKLa+5kDdYs5rD482BLg0VjVRwc2LJREAVoertWp35Vjs/bF1bvOV99jACjCf6tQA0 rAsLeXQy3Ust2M+EdzDFZnSannd+fOtYzW/EHx2qrzVaHA9ATVEg9dC0BZG66IZ+l7rT 789gTMysdJz7yuPsNNQ/n7Ft3IJVvnA0Vq/gVKOKgHM4rE6hHZ0jbPzJrRKDfYjGuvya iMoV/SUgOZv+VWMmLQlY3KVPKgtK0pK26E0F7YqNzAO7ZCQ6G2Vb9c7p3Y4FhVcWBBwN ojTA== X-Gm-Message-State: AOAM530pX6KVNFGpGSsSsjx0Qv3es1RvOd0h8P5UcbcPtRHUvwcZlCS/ 9bhRKUw293Oa0hs/5RNSppk= X-Received: by 2002:aa7:8f05:0:b029:3b4:ff54:9a10 with SMTP id x5-20020aa78f050000b02903b4ff549a10mr29132627pfr.29.1628600971342; Tue, 10 Aug 2021 06:09:31 -0700 (PDT) Received: from ?IPv6:2404:f801:0:5:8000::4b1? ([2404:f801:9000:18:efec::4b1]) by smtp.gmail.com with ESMTPSA id c9sm22240121pgq.58.2021.08.10.06.09.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 10 Aug 2021 06:09:30 -0700 (PDT) Subject: Re: [PATCH V3 03/13] x86/HV: Add new hvcall guest address host visibility support To: Dave Hansen , kys@microsoft.com, haiyangz@microsoft.com, sthemmin@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, x86@kernel.org, hpa@zytor.com, dave.hansen@linux.intel.com, luto@kernel.org, peterz@infradead.org, konrad.wilk@oracle.com, boris.ostrovsky@oracle.com, jgross@suse.com, sstabellini@kernel.org, joro@8bytes.org, will@kernel.org, davem@davemloft.net, kuba@kernel.org, jejb@linux.ibm.com, martin.petersen@oracle.com, arnd@arndb.de, hch@lst.de, m.szyprowski@samsung.com, robin.murphy@arm.com, thomas.lendacky@amd.com, brijesh.singh@amd.com, ardb@kernel.org, Tianyu.Lan@microsoft.com, pgonda@google.com, martin.b.radev@gmail.com, akpm@linux-foundation.org, kirill.shutemov@linux.intel.com, rppt@kernel.org, sfr@canb.auug.org.au, saravanand@fb.com, krish.sadhukhan@oracle.com, aneesh.kumar@linux.ibm.com, xen-devel@lists.xenproject.org, rientjes@google.com, hannes@cmpxchg.org, tj@kernel.org, michael.h.kelley@microsoft.com Cc: iommu@lists.linux-foundation.org, linux-arch@vger.kernel.org, linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org, netdev@vger.kernel.org, vkuznets@redhat.com, parri.andrea@gmail.com References: <20210809175620.720923-1-ltykernel@gmail.com> <20210809175620.720923-4-ltykernel@gmail.com> From: Tianyu Lan Message-ID: <3f09c505-3e4d-3b06-e92a-db6fd3e50d0c@gmail.com> Date: Tue, 10 Aug 2021 21:09:16 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/10/2021 6:12 AM, Dave Hansen wrote: > On 8/9/21 10:56 AM, Tianyu Lan wrote: >> From: Tianyu Lan >> >> Add new hvcall guest address host visibility support to mark >> memory visible to host. Call it inside set_memory_decrypted >> /encrypted(). Add HYPERVISOR feature check in the >> hv_is_isolation_supported() to optimize in non-virtualization >> environment. > > From an x86/mm perspective: > > Acked-by: Dave Hansen > Thanks for your ACK. > A tiny nit: > >> diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c >> index 0bb4d9ca7a55..b3683083208a 100644 >> --- a/arch/x86/hyperv/hv_init.c >> +++ b/arch/x86/hyperv/hv_init.c >> @@ -607,6 +607,12 @@ EXPORT_SYMBOL_GPL(hv_get_isolation_type); >> >> bool hv_is_isolation_supported(void) >> { >> + if (!cpu_feature_enabled(X86_FEATURE_HYPERVISOR)) >> + return 0; >> + >> + if (!hypervisor_is_type(X86_HYPER_MS_HYPERV)) >> + return 0; >> + >> return hv_get_isolation_type() != HV_ISOLATION_TYPE_NONE; >> } > This might be worthwhile to move to a header. That ensures that > hv_is_isolation_supported() use can avoid even a function call. But, I > see this is used in modules and its use here is also in a slow path, so > it's not a big deal > I will move it to header in the following version. Thanks.