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 X-Spam-Level: X-Spam-Status: No, score=-6.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6F2DC433E0 for ; Mon, 25 May 2020 15:22:19 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6E71E20870 for ; Mon, 25 May 2020 15:22:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="L44pvBpl" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6E71E20870 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id D8BD180047; Mon, 25 May 2020 11:22:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D3C398E0008; Mon, 25 May 2020 11:22:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C51A980047; Mon, 25 May 2020 11:22:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0143.hostedemail.com [216.40.44.143]) by kanga.kvack.org (Postfix) with ESMTP id AB5DD8E0008 for ; Mon, 25 May 2020 11:22:18 -0400 (EDT) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 6E12E181AC9CC for ; Mon, 25 May 2020 15:22:18 +0000 (UTC) X-FDA: 76855607556.23.wind23_14161f7ede23a X-HE-Tag: wind23_14161f7ede23a X-Filterd-Recvd-Size: 5315 Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by imf23.hostedemail.com (Postfix) with ESMTP for ; Mon, 25 May 2020 15:22:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1590420137; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=3TJhizQZw710Ykbd4e66mhSmTv6uHiaL8SGhqXCINH4=; b=L44pvBplcr4AAVgpRQ3EnYJCjz7W4bu57RJ2jSgi5+DyERQaqY5c3Eb9DMlM7tqfrRc1mQ Uwdc+YIHSF/PrLXnuj11rR06QLBGaK928vv0aywoW8aOTdOACJZhClx7dIt5Q43CqWZj/L b18xU4Y6wqDV+PO9sxWgBqSVkvUYK9I= Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-287-vexE90LuM4S8fXQoLGjXGg-1; Mon, 25 May 2020 11:22:13 -0400 X-MC-Unique: vexE90LuM4S8fXQoLGjXGg-1 Received: by mail-ej1-f72.google.com with SMTP id pj20so6458932ejb.3 for ; Mon, 25 May 2020 08:22:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=3TJhizQZw710Ykbd4e66mhSmTv6uHiaL8SGhqXCINH4=; b=m6YuqzjSQnZtT84ho/LckWfk4IZgiiSuFNSqOVzBc4T7asNNjtvyzpZ7bvShwYdvWL 2M7iXRSQSi9Pb35KQWFAO861oxEC6OhDZBJDvhJ58aEgrVLY3ImZU/ZAFkgLmc6lPCVo VTabK5oH/FIoSlddV/0CJcC40CW9K+IlkGwlc07M8lbvfgMqmMmh1BMPOveDSlFoI6Xm BWK6IuxowhlHyhRmmAWbVkgH/opOK6ata3LpL213WuyrUxz/g4qh5fvCIeOvBInbfAoG EUp2+sM3bO5mr6dotAeLfrDF6K+BOVwxcDhOkjgKRDHXgp0Ej5AxQdlPR4wYv/0ISQbq bmBA== X-Gm-Message-State: AOAM5325cbKagfAnrCNVgkAYiHzo1P57ufCqT9kd2Utnca2i48VhVZh8 r7F5MLLbEQJtqv80WDvkssQDauWh57jBb633WQ1680CK+QcxeMiAftH8VFojhtljTdlE2kUf/Mm G2MZ35r2hXA0= X-Received: by 2002:a17:907:392:: with SMTP id ss18mr20203735ejb.156.1590420132121; Mon, 25 May 2020 08:22:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyHlp16CRg1vF1duz4SE4yZIQh96KMOz7B1Iv5p6TQx/Ia7dapZMBxC7JxsIRul4uyMhi9igw== X-Received: by 2002:a17:907:392:: with SMTP id ss18mr20203709ejb.156.1590420131831; Mon, 25 May 2020 08:22:11 -0700 (PDT) Received: from vitty.brq.redhat.com (g-server-2.ign.cz. [91.219.240.2]) by smtp.gmail.com with ESMTPSA id cd12sm16045340ejb.95.2020.05.25.08.22.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 May 2020 08:22:11 -0700 (PDT) From: Vitaly Kuznetsov To: "Kirill A. Shutemov" Cc: David Rientjes , Andrea Arcangeli , Kees Cook , Will Drewry , "Edgecombe\, Rick P" , "Kleen\, Andi" , x86@kernel.org, kvm@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Kirill A. Shutemov" , Dave Hansen , Andy Lutomirski , Peter Zijlstra , Paolo Bonzini , Sean Christopherson , Wanpeng Li , Jim Mattson , Joerg Roedel Subject: Re: [RFC 13/16] x86/kvmclock: Share hvclock memory with the host In-Reply-To: <20200522125214.31348-14-kirill.shutemov@linux.intel.com> References: <20200522125214.31348-1-kirill.shutemov@linux.intel.com> <20200522125214.31348-14-kirill.shutemov@linux.intel.com> Date: Mon, 25 May 2020 17:22:10 +0200 Message-ID: <875zck82fx.fsf@vitty.brq.redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: "Kirill A. Shutemov" writes: > hvclock is shared between the guest and the hypervisor. It has to be > accessible by host. > > Signed-off-by: Kirill A. Shutemov > --- > arch/x86/kernel/kvmclock.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c > index 34b18f6eeb2c..ac6c2abe0d0f 100644 > --- a/arch/x86/kernel/kvmclock.c > +++ b/arch/x86/kernel/kvmclock.c > @@ -253,7 +253,7 @@ static void __init kvmclock_init_mem(void) > * hvclock is shared between the guest and the hypervisor, must > * be mapped decrypted. > */ > - if (sev_active()) { > + if (sev_active() || kvm_mem_protected()) { > r = set_memory_decrypted((unsigned long) hvclock_mem, > 1UL << order); > if (r) { Sorry if I missed something but we have other structures which KVM guest share with the host, sev_map_percpu_data(): ... for_each_possible_cpu(cpu) { __set_percpu_decrypted(&per_cpu(apf_reason, cpu), sizeof(apf_reason)); __set_percpu_decrypted(&per_cpu(steal_time, cpu), sizeof(steal_time)); __set_percpu_decrypted(&per_cpu(kvm_apic_eoi, cpu), sizeof(kvm_apic_eoi)); } ... Do you handle them somehow in the patchset? (I'm probably just blind failing to see how 'early_set_memory_decrypted()' is wired up) -- Vitaly