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.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, 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 CD851C433E0 for ; Mon, 25 May 2020 15:25:29 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8BA102071C for ; Mon, 25 May 2020 15:25:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=shutemov-name.20150623.gappssmtp.com header.i=@shutemov-name.20150623.gappssmtp.com header.b="XKLT64/L" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8BA102071C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=shutemov.name Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 304DC80049; Mon, 25 May 2020 11:25:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2B4358E0008; Mon, 25 May 2020 11:25:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1A39A80049; Mon, 25 May 2020 11:25:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0175.hostedemail.com [216.40.44.175]) by kanga.kvack.org (Postfix) with ESMTP id F382B8E0008 for ; Mon, 25 May 2020 11:25:28 -0400 (EDT) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id BB646181AC9CC for ; Mon, 25 May 2020 15:25:28 +0000 (UTC) X-FDA: 76855615536.06.tub11_2fcade9948254 X-HE-Tag: tub11_2fcade9948254 X-Filterd-Recvd-Size: 5506 Received: from mail-lj1-f195.google.com (mail-lj1-f195.google.com [209.85.208.195]) by imf34.hostedemail.com (Postfix) with ESMTP for ; Mon, 25 May 2020 15:25:28 +0000 (UTC) Received: by mail-lj1-f195.google.com with SMTP id q2so21115736ljm.10 for ; Mon, 25 May 2020 08:25:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov-name.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=8td81KCvxI/2OEeh9Ticm0bkE2svquaArM6q3f8IXmc=; b=XKLT64/LoBo+2JIIl8QkJUlGd+R1rZ4tPpmndC6EsNsrmAYZkJme9ja7XOzbKQuAjI DtpeLj7Uwu2ur5UuVF0+qw0Hzyrm6BStK7r5dhGafeH+m6ie5MbyhPzq8bbRlSx/Zrs9 XM91Q282XZynEXJH8uxRSKIjefQa6CinKOcSygOpjeU+MSKFjjsZCfG2ZxZeKG+y7A2g hqhzE/+9gzLMwa/uTH3Z6o6JyDar/fj9L9QqWRe1fu1vZgd3rnzddgVk7ShggIBN5o0B px2nWL7O1qPc7ug9j389cU1DPjCFFVctI3emZkhkLWmm5h/xEbjFPxgNy7P+KXtiquUF QlDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=8td81KCvxI/2OEeh9Ticm0bkE2svquaArM6q3f8IXmc=; b=D+Fvlme8epN3kCYHgtTMOVd5nQmcC9yckj2dz+/7ZKFzTH7EMU5tXTZHTqJ7Iptl39 D8aVbQvyf3o6oPyXJL8kl9Se3VStiK4TZKVVxwttYKRiYoOn6EnT6vGgQCDacg0+y9x0 Krfw3c5Ub5EieP+Fqp40qlUls//OjZiqb5lqPZqXHlwSgrFEa92tmSR4ZxO0ALPUZS+z 9eCnWMMIV+GBb2f2Tr1T8vzvEzbAmuUh+VHgf8/nrp3kpzQewHBxQbmnfagtfH8tMZGE dVbmJZ77/G1ZwbD+Z/Uf9mua29RU8RZZJD3ZOaVb+C89J4pTepsIlGwnnhUDMqlQGqgw 6qCA== X-Gm-Message-State: AOAM533ePovqBJFRlZ/GJEGCwzRQDYQ0Xtj9SL9h6kd5Tk+TVhxSILra qbFTdT2/qb+a9teyccva5Mgypw== X-Google-Smtp-Source: ABdhPJzf6qWm+gQ1VnQeyksSzu7xA/fy4Zz0Mxz50VNuHIpl3XYpEr226uIZ1ropjN/mf8I4AeBFKg== X-Received: by 2002:a05:651c:2c6:: with SMTP id f6mr11628565ljo.371.1590420326879; Mon, 25 May 2020 08:25:26 -0700 (PDT) Received: from box.localdomain ([86.57.175.117]) by smtp.gmail.com with ESMTPSA id i8sm5664708lfl.72.2020.05.25.08.25.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 May 2020 08:25:26 -0700 (PDT) Received: by box.localdomain (Postfix, from userid 1000) id 6C23C10230F; Mon, 25 May 2020 18:25:27 +0300 (+03) Date: Mon, 25 May 2020 18:25:27 +0300 From: "Kirill A. Shutemov" To: Vitaly Kuznetsov 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 Message-ID: <20200525152527.7g57us6imlh62x7i@box> References: <20200522125214.31348-1-kirill.shutemov@linux.intel.com> <20200522125214.31348-14-kirill.shutemov@linux.intel.com> <875zck82fx.fsf@vitty.brq.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <875zck82fx.fsf@vitty.brq.redhat.com> 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: On Mon, May 25, 2020 at 05:22:10PM +0200, Vitaly Kuznetsov wrote: > "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) I don't handle them yet: I've seen the function, but have not modified it. I want to understand first why it doesn't blow up for me without the change. Any clues? -- Kirill A. Shutemov