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=-7.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 B8A3DC433ED for ; Thu, 20 May 2021 12:31:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9A90961184 for ; Thu, 20 May 2021 12:31:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232714AbhETMc4 (ORCPT ); Thu, 20 May 2021 08:32:56 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:34403 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232117AbhETMck (ORCPT ); Thu, 20 May 2021 08:32:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621513877; 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=aoSgvFFKVMc3G/pczWgV02L96fZbMJsKlQ5JwPhLQOM=; b=M6Y1xeNtzo4IDPx80lPmbzt46lVkJkkyrwUUbi267faXvsJCyKV6okTw6tizSxEC5zD4og QoAwsNxQyeXAAjMSyHqFTbEloGlXBSFArnf/CaaRk8m6nqCzvjApyvWFG7ePhbAuK+MgE+ IWFjHeHyHh7iGqUAGhTSzoCXxu9b1r4= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-476-Fv-Bd3MpMDipPwNMvMMHpQ-1; Thu, 20 May 2021 08:31:16 -0400 X-MC-Unique: Fv-Bd3MpMDipPwNMvMMHpQ-1 Received: by mail-wr1-f69.google.com with SMTP id a5-20020a5d6ca50000b029011035a261adso8547168wra.17 for ; Thu, 20 May 2021 05:31:15 -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:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=aoSgvFFKVMc3G/pczWgV02L96fZbMJsKlQ5JwPhLQOM=; b=boZwb67+pEVrpC+e0NltpNAOSCyBuymT5JsxvzXAzybiIFEuE1trB0dHdf/Cr2BfTq izsbZgO11z2bg7vMUQEwMo8IQ2JpDh+n//gMpa8bYCGyrAMNvirsGZmkho6b+VvnpzYL 5YQFHecjggaavgGyDdjstZbd6BAt3U6aAyhl9oAQGzmCjERnQZTa6J3M4z6J6KoUglc6 5ftpPa9N4MATwl8x34jAVvyR8ZJg1RQHBXCEE2UX1kuFeBM/y+6RLLgWAoA/ygZyoggJ C9506ttc56l7R1qE9QdfugLwc4Vx7B5GwIF8pUmbc1UOyfTqOIIgMdUWJAfk/R01T+m6 NHxA== X-Gm-Message-State: AOAM533ifWnrPfuagqd5z/CdqL2q7cmvUYOaZ9C3GoaGAH3oRmiVRO97 aWdQ4eNDJQmt6v1wFVwLmwUQgrmORdCy/gma/bw3/dz0dRBCEIyTqwRUzeMPDFgKfxO7gYj9MvN 66Naxu0NLnBqzPkEHX6rxXHZe1PuL/Nwz7CmrVRdgpaK8lUHtAUV1d+KZkJ6pckJY70khYDhnB3 qa X-Received: by 2002:a05:600c:49a2:: with SMTP id h34mr3904567wmp.64.1621513874139; Thu, 20 May 2021 05:31:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwRyVKUDco1XFJtBSF08deqU/vZWKPY1GiHaPpbP6ydk/mHwxQJrYLGMqxtartHHXDv+KRgjA== X-Received: by 2002:a05:600c:49a2:: with SMTP id h34mr3904538wmp.64.1621513873934; Thu, 20 May 2021 05:31:13 -0700 (PDT) Received: from ?IPv6:2001:b07:6468:f312:c8dd:75d4:99ab:290a? ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id g5sm2734192wmi.8.2021.05.20.05.31.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 20 May 2021 05:31:12 -0700 (PDT) Subject: Re: [PATCH] kvm: x86: move srcu lock out of kvm_vcpu_check_block To: Sean Christopherson , Jon Kohler Cc: Bijan Mottahedeh , Raphael Norwitz , Junaid Shahid , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "x86@kernel.org" , "H. Peter Anvin" , "kvm@vger.kernel.org" , "linux-kernel@vger.kernel.org" References: <20210428173820.13051-1-jon@nutanix.com> <9040b3d8-f83f-beb5-a703-42202d78fabb@redhat.com> <70B34A15-C4A1-4227-B037-7B26B40EDBFE@nutanix.com> From: Paolo Bonzini Message-ID: <3d3622c0-7c7a-3d24-d0f5-3204c5d105f9@redhat.com> Date: Thu, 20 May 2021 14:31:11 +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 19/05/21 23:53, Sean Christopherson wrote: > 1. Refactor check_nested_events() to split out a has_events() helper. > 2. Move the has_events() call from kvm_vcpu_running() into kvm_vcpu_has_events() > 3. Drop the explicit hv_timer_pending() in inject_pending_event(). It should > be dead code since it's just a pointer to nested_vmx_preemption_timer_pending(), > which is handled by vmx_check_nested_events() and called earlier. > 4. Drop the explicit hv_timer_pending() in kvm_vcpu_has_events() for the same > reasons as (3). This can also drop hv_timer_pending() entirely. Sounds good except that I would do (3) first, since if I understand correctly it's a valid cleanup in the current code as well, and do (2) and (4) at the same time since you're basically enlarging the scope of the existing hv_timer_pending call to include all nested events. Paolo