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=-18.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable 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 5F01EC433ED for ; Fri, 7 May 2021 07:50:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2CAAF613C2 for ; Fri, 7 May 2021 07:50:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235776AbhEGHvi (ORCPT ); Fri, 7 May 2021 03:51:38 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:50939 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230015AbhEGHvf (ORCPT ); Fri, 7 May 2021 03:51:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620373835; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/MLkuRSzZa79r/jh4LUnA9iSS0QIvpenC9jHadUk+SM=; b=UiYYN/AZ4eQijG+I/X6hBXeTiO2u0/NcPmBRSvsKoBC1RJSzdfdVAawxM7MfvWPwfX4yhB b12Y0sxXbUF/PDzHs1O/BYoS1IFYD6ZvTBifA5p5BQxZWTtaQtl7AiuYvFj3jCc1cCSKZD vRXo3cAGwAVJ352gELlBtOooqE9CQVk= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-63-JJjFtE-wMsCB9ekMWElucQ-1; Fri, 07 May 2021 03:50:34 -0400 X-MC-Unique: JJjFtE-wMsCB9ekMWElucQ-1 Received: by mail-wm1-f72.google.com with SMTP id 7-20020a05600c2307b02901432673350dso1946306wmo.9 for ; Fri, 07 May 2021 00:50:33 -0700 (PDT) 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:organization :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=/MLkuRSzZa79r/jh4LUnA9iSS0QIvpenC9jHadUk+SM=; b=LCUYKLCwtIrjuEu2mw/MaE0jN0GMHXVjnoWtguBjt/GRPC77Up+BON213/ioAlzViT 8Dsf8ED2/6SEUM+1ToA1QIPvzkif3CjRvhjtEc4Z5GVQLBJsEIdpMkKNg0dW169jhN0I nrQKmSH2xhGyGTxJVl50mfGLoPt7CM+tEPGl+MUj6iCe9LTWCeoh5mHcEkcR9q4Rc/84 D3r+sUYn2NGBW8CBBOL8xN2YsMhYCzBiqztRRiwoUZazz+tkv09m30NIhdlMoF84/X+2 ti4ttDKwSnMTL/jlqpLo7hqQZixqodv8CVl/PWNtqGAVZ/Xg9TTa71lJdGngnZICDRPK rZbg== X-Gm-Message-State: AOAM533CMUza4lYn1B2CA41HME/NMgpajj1Kc5NF5kxEE3Mmnls+rFYQ D7gIH+8Jkak/6W2txCC2RuCKDNgYaq46XqiRcjcIiXSkIjrRfRMWPWWOHhBuyqtsEDooh1T2BjG EnJS93arTcOTbPFRfEVtYJAXs X-Received: by 2002:a1c:55ca:: with SMTP id j193mr19277938wmb.58.1620373832864; Fri, 07 May 2021 00:50:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwxCnRshAj7tpewpbmOreXpvpcKBTwP6IHiJ0n2zPF8T3D2mFujI//9V2uu4vWU/BzHkuhqZg== X-Received: by 2002:a1c:55ca:: with SMTP id j193mr19277904wmb.58.1620373832595; Fri, 07 May 2021 00:50:32 -0700 (PDT) Received: from [192.168.3.132] (p5b0c63c0.dip0.t-ipconnect.de. [91.12.99.192]) by smtp.gmail.com with ESMTPSA id i11sm7271122wrp.56.2021.05.07.00.50.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 07 May 2021 00:50:32 -0700 (PDT) Subject: Re: [PATCH v3 5/8] KVM: x86/mmu: Add a field to control memslot rmap allocation To: Ben Gardon , LKML , kvm Cc: Paolo Bonzini , Peter Xu , Sean Christopherson , Peter Shier , Yulei Zhang , Wanpeng Li , Xiao Guangrong , Kai Huang , Keqian Zhu References: <20210506184241.618958-1-bgardon@google.com> <20210506184241.618958-6-bgardon@google.com> From: David Hildenbrand Organization: Red Hat Message-ID: <67c6af98-4e3b-fec5-9521-5288a10dce58@redhat.com> Date: Fri, 7 May 2021 09:50:31 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 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 07.05.21 01:44, Ben Gardon wrote: > On Thu, May 6, 2021 at 11:43 AM Ben Gardon wrote: >> >> Add a field to control whether new memslots should have rmaps allocated >> for them. As of this change, it's not safe to skip allocating rmaps, so >> the field is always set to allocate rmaps. Future changes will make it >> safe to operate without rmaps, using the TDP MMU. Then further changes >> will allow the rmaps to be allocated lazily when needed for nested >> oprtation. >> >> No functional change expected. >> >> Signed-off-by: Ben Gardon >> --- >> arch/x86/include/asm/kvm_host.h | 8 ++++++++ >> arch/x86/kvm/mmu/mmu.c | 2 ++ >> arch/x86/kvm/x86.c | 18 +++++++++++++----- >> 3 files changed, 23 insertions(+), 5 deletions(-) >> >> diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h >> index ad22d4839bcc..00065f9bbc5e 100644 >> --- a/arch/x86/include/asm/kvm_host.h >> +++ b/arch/x86/include/asm/kvm_host.h >> @@ -1122,6 +1122,12 @@ struct kvm_arch { >> */ >> spinlock_t tdp_mmu_pages_lock; >> #endif /* CONFIG_X86_64 */ >> + >> + /* >> + * If set, rmaps have been allocated for all memslots and should be >> + * allocated for any newly created or modified memslots. >> + */ >> + bool memslots_have_rmaps; >> }; >> >> struct kvm_vm_stat { >> @@ -1853,4 +1859,6 @@ static inline int kvm_cpu_get_apicid(int mps_cpu) >> >> int kvm_cpu_dirty_log_size(void); >> >> +inline bool kvm_memslots_have_rmaps(struct kvm *kvm); > > Woops, this shouldn't be marked inline as it creates build problems > for the next patch with some configs. With that fixed Reviewed-by: David Hildenbrand -- Thanks, David / dhildenb