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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4CF72C433F5 for ; Thu, 24 Feb 2022 14:23:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235513AbiBXOYX (ORCPT ); Thu, 24 Feb 2022 09:24:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232883AbiBXOYS (ORCPT ); Thu, 24 Feb 2022 09:24:18 -0500 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 068651637EC; Thu, 24 Feb 2022 06:23:49 -0800 (PST) Received: by mail-ej1-x633.google.com with SMTP id p14so4649483ejf.11; Thu, 24 Feb 2022 06:23:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=5JGNf6R+a4FEuW/ji5APSj/Q79D/fkN75qzklV7FvH4=; b=ZBGEBTFHNMUajRMJJjvqdUjh5iq8V84lSTRqwpuHGonlCbH1JWx56BLlCxbuwBnU4V 3rRTnO/lKVHMf81GYjl3cGgHJhjnHvuWSM6HigTBgsBRFc5drLxCHOdFcyZ5ofeOayca UwgFJKncS3gat2G/p7XRXnQdLjX8LslPwHnIkTIU4pbMdQkzJ9UYrO5/g66XoxZXU6ta K1RhwezAqIvD2cHIDYsRazZ/6SuQLa2599PhM7t1u5qQoTE0BUfr5NB/7lmK+lyPaxkP tprkCo30QmxLisCXiPmOeEBFKVFHCrj7/yTrdBFl9moGgmAk/js3gITFxoF9f4XWTEx2 eX4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:message-id:date:mime-version:user-agent :subject:content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=5JGNf6R+a4FEuW/ji5APSj/Q79D/fkN75qzklV7FvH4=; b=iAb54/OUV2o8E1smbMJ2U1+myz3AJURIhWtw3vHCYYlEKd2aE781t4wv1A+po8JNGz ZyL//KnedBV8+hbKylydMiQZY8irUISPYPEjiz5qtzp+eVesB7SMy/0PmuOdaVffuFl5 zRo8mXTDViAYOAR5Gjlic78YCuG4G6Xvh1THfdnTwcmh7D4H1P3qvZNNqzvJ3OIj5UTa OVl326Lj6QBdI50pvK0SQg1BsaekJOI+Nbf+1xna8DYeEiuFsjGrYsNujpzJtGXhqIFP fY31y8xMqkaDvG59jvFCSxz9f0Nlxs4a54GxDy8niKp4w9vfUdJVnBsCx599rKKTWYTQ uFmA== X-Gm-Message-State: AOAM531EO6q92wMFEhdt+naMxPPD9Y49LvSd+ObEWRke9NnpZ4T8LS/e N7g0F5P+QpE6TjuP2gyFQNs= X-Google-Smtp-Source: ABdhPJwGN4xiUcoXTD/FQvJ2bStNWBAE/ICRfkmV2/p1JQBTRb1PsXZeTnDslyeNkUZYvmeWUQkjSw== X-Received: by 2002:a17:906:b052:b0:6ce:88a5:e42a with SMTP id bj18-20020a170906b05200b006ce88a5e42amr2495431ejb.237.1645712627596; Thu, 24 Feb 2022 06:23:47 -0800 (PST) Received: from ?IPV6:2001:b07:6468:f312:c8dd:75d4:99ab:290a? ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.googlemail.com with ESMTPSA id n25sm1443342eds.89.2022.02.24.06.23.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 24 Feb 2022 06:23:47 -0800 (PST) Sender: Paolo Bonzini Message-ID: <3896e3b5-0e6c-858a-8e4f-732ab03b7286@redhat.com> Date: Thu, 24 Feb 2022 15:23:43 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH v2] KVM:nVMX: Make setup/unsetup under the same conditions Content-Language: en-US To: Peng Hao , seanjc@google.com Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org References: <20220222104054.70286-1-flyingpeng@tencent.com> From: Paolo Bonzini In-Reply-To: <20220222104054.70286-1-flyingpeng@tencent.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/22/22 11:40, Peng Hao wrote: > From: Peng Hao > > Make sure nested_vmx_hardware_setup/unsetup() are called in pairs under > the same conditions. Calling nested_vmx_hardware_unsetup() when nested > is false "works" right now because it only calls free_page() on zero- > initialized pointers, but it's possible that more code will be added to > nested_vmx_hardware_unsetup() in the future. > > Reviewed-by: Sean Christopherson > Signed-off-by: Peng Hao > --- > arch/x86/kvm/vmx/vmx.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c > index 75ed7d6f35cc..9fad3c73395a 100644 > --- a/arch/x86/kvm/vmx/vmx.c > +++ b/arch/x86/kvm/vmx/vmx.c > @@ -7852,7 +7852,7 @@ static __init int hardware_setup(void) > vmx_set_cpu_caps(); > > r = alloc_kvm_area(); > - if (r) > + if (r && nested) > nested_vmx_hardware_unsetup(); > > kvm_set_posted_intr_wakeup_handler(pi_wakeup_handler); Queued, thanks. Paolo