Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp5201267rwb; Tue, 6 Sep 2022 21:38:11 -0700 (PDT) X-Google-Smtp-Source: AA6agR7cpQs9ncFvcFQwWpKkXXd91EwPjnh/b+poBBnKryqFG1v9L1J8fFhmooaAlY1DGxEUKgh5 X-Received: by 2002:a63:a1f:0:b0:434:dd36:c639 with SMTP id 31-20020a630a1f000000b00434dd36c639mr1741497pgk.165.1662525490873; Tue, 06 Sep 2022 21:38:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662525490; cv=none; d=google.com; s=arc-20160816; b=SnQ6J6vWQv2xEePcqLKOzUwOUSzIR3cFAlaEtGWgeoBqFjcOIz2zszOGOOMNPJhWsv C71B5uCdPXzQoaWa8YhWOGCDxcZ4l5XNPRaBxKe5Mr6mk6l4Rr+UdnDfNxEx44CqEqPb NgSQkIlFLnN7rdPSyfD3xqRo77CauuuQCWbRc4OjiOZKumX8M4vRlOhGi1mnqDExYbNl x23yjXTEsTolaqPRC9JPBaoHBeea0uXlYgUmpiO7/IbP2RbUDeMQlV6ed/LEcdFB2/v0 +2njLL+IQaLtBJLaH2HKjAl00xEiLVKKem5R4DiizoMXhsKf81VOGB3b0BWJLClfH3en vOXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=Xk596ZpOvHHkq2UiD2w1TnlOJagQ1pzq8bsWaxJ5evc=; b=x42CXTmaxp6KTzAzGN5gEppjEuiK3c4hadqWYD8gk9VGPfAhf2en2EEqvlWpcB4mkM RpaXSXj5YPkpMOcrOdlFvW5nxr+JtEt+mVHpY1Imn9j4pqj3QLiCAAk1AWZZ9D3e0CX6 leOvwcC4szdWYRxWQjzMjVfkUv67PGrF79B8O4dXpkpxa5QzuCLJ3+JfTPcK2/fggIy1 0uKsQYjiaUn9G1lOiodSPgE6KjogJ8KPrHVrO2tGZxGOVw0rpYoEqc2N5tbH1ClCir5F XakuWR7jxIZaFpp7Gu2E8lNn5y7JXCSQXPZEU3OL/aWRYSQU8MZSf0I5gGJXzERnzLVI 47Rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=VbR6vuGn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 30-20020a630e5e000000b0041b8f2bd530si14294573pgo.217.2022.09.06.21.37.59; Tue, 06 Sep 2022 21:38:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=VbR6vuGn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229436AbiIGE0s (ORCPT + 99 others); Wed, 7 Sep 2022 00:26:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229513AbiIGE0q (ORCPT ); Wed, 7 Sep 2022 00:26:46 -0400 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 674CE857DD for ; Tue, 6 Sep 2022 21:26:45 -0700 (PDT) Received: by mail-pj1-x1029.google.com with SMTP id fv3so7216580pjb.0 for ; Tue, 06 Sep 2022 21:26:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=Xk596ZpOvHHkq2UiD2w1TnlOJagQ1pzq8bsWaxJ5evc=; b=VbR6vuGnznGRwapx4XKG8MzL2UPiYiuvGWBZahrJX3pQG7wZK3QEGvBHy05Q9XSrFX Gqku4FyamLpTWKoxpRWTkimb8j1+ztDOoZuhTOOV9zI5lku4AIreHrpGAABm0Sx3AtQd i61If1vZrlrtZd2t+kq/kKZqMG6tiyVIEo+m9J27nMv8o0RSB29DLnn6qe2nSQzCrujL k/YP098v2Rs3EySkVJQbZuDeP3ZB8CRSw/lKqBRgomPHommMZKIw0C8HBkkHUTiTWuaN 7hkm3gSV57EHXRiuZyCh1gMHuOshbR/rwIm20WNJZ9Pib9I/IT8AmL4FAX/n/jhe0khm JBtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=Xk596ZpOvHHkq2UiD2w1TnlOJagQ1pzq8bsWaxJ5evc=; b=ym8AA6Vo8OU49R4OZjXm9ldcuNm9YRr79KKjdg0npQzicYGTZ5jlfqorz7Ux4AF0IK tH0Z/E4KbSvj0y+MTFrA/W36tWSmUN7VgVHWZC9S4kA2sREIQHQjPilt+VVj+h/tMmIS FK1ZX7FDUFYH+5eCGL/mkRjWBjMO68rULCXIXhTRdGuByd1IuzNiHSC+4i6jo16S6QaT U6+IW5qSafSRDqNGtLeCU5QBsN5iyeOU98A2jGLJ7EZFGvphg9HAcVgQT1mKkMeWFA6Z NhSNW6anvc4XdFSfw4Iba7LNsdIOEC20aaoZwb0Aml/Hh8mcIUot7BbsC+VF8I56ySB6 FyMQ== X-Gm-Message-State: ACgBeo3TY6w8+nvXyp/TYeVEczKCXKeEjoZ+Tch/IyJ9Ebx6pHLVYHoq vyZroROx4nbIYuIuvn8mkvE6RVbRqaiOnbdxV1ERnw== X-Received: by 2002:a17:90b:384f:b0:1f4:ee87:9523 with SMTP id nl15-20020a17090b384f00b001f4ee879523mr1873078pjb.100.1662524804735; Tue, 06 Sep 2022 21:26:44 -0700 (PDT) MIME-Version: 1.0 References: <20220828222544.1964917-1-mizhang@google.com> <20220828222544.1964917-2-mizhang@google.com> <20220907025042.hvfww56wskwhsjwk@yy-desk-7060> In-Reply-To: <20220907025042.hvfww56wskwhsjwk@yy-desk-7060> From: Mingwei Zhang Date: Tue, 6 Sep 2022 21:26:33 -0700 Message-ID: Subject: Re: [PATCH v2 1/4] KVM: x86: move the event handling of KVM_REQ_GET_VMCS12_PAGES into a common function To: Yuan Yao Cc: Sean Christopherson , Paolo Bonzini , kvm , LKML , Maxim Levitsky , Vitaly Kuznetsov , Oliver Upton , Jim Mattson Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > @@ -10700,6 +10706,12 @@ static int vcpu_run(struct kvm_vcpu *vcpu) > > if (kvm_cpu_has_pending_timer(vcpu)) > > kvm_inject_pending_timer_irqs(vcpu); > > > > + if (vcpu->arch.nested_get_pages_pending) { > > + r = kvm_get_nested_state_pages(vcpu); > > + if (r <= 0) > > + break; > > + } > > + > > Will this leads to skip the get_nested_state_pages for L2 first time > vmentry in every L2 running iteration ? Because with above changes > KVM_REQ_GET_NESTED_STATE_PAGES is not set in > nested_vmx_enter_non_root_mode() and > vcpu->arch.nested_get_pages_pending is not checked in > vcpu_enter_guest(). > Good catch. I think the diff won't work when vcpu is runnable. It only tries to catch the vcpu block case. Even for the vcpu block case, the check of KVM_REQ_UNBLOCK is way too late. Ah, kvm_vcpu_check_block() is called by kvm_vcpu_block() which is called by vcpu_block(). The warning is triggered at the very beginning of vcpu_block(), i.e., within kvm_arch_vcpu_runnable(). So, please ignore the trace in my previous email. In addition, my minor push back for that is vcpu->arch.nested_get_pages_pending seems to be another KVM_REQ_GET_NESTED_STATE_PAGES. Thanks. -Mingwei -Mingwei