Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2670981pxb; Tue, 23 Feb 2021 12:32:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJy9f6x4jTKiqUoqcADfvXL0xXmpRXtszaZQOCF/S9RgbD4AtpN5QQNIEOcT/VUNpgGOCd8J X-Received: by 2002:a05:6402:216:: with SMTP id t22mr29795806edv.168.1614112356746; Tue, 23 Feb 2021 12:32:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614112356; cv=none; d=google.com; s=arc-20160816; b=jAC25Kd2aUkW6jMram3T5Lht2B2jgejaDb76qYGNzeTtYF/dlOrVS/YdGPN88n3D4J y/JekOoacpiI0W76FL8uKQ77g7fPO4w1wGWDQIpJCaWDdWNYP9gITec8J7QCfA1R048f KpBdHPohRaOn97vp3vshbmikeThTo+obnaWaUh0u5gYQb3uhScPA0qvIOYaJYmkNwslc aQGnlmW4vTwBqDYV8j+wBG++K5vh48ok2kSI1vFXT5VS+snls3kHlumTnYtfhDcTqAyT oaRRP2EcbBSRHCe38CcsCvlGnPu+bljpRQ0SoxNJDQ0YclxUbgg9VNL16dJqKGNfJ5B9 lIUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=aMCIQJKY2gv1PvwEvAbWVmJle6/ioi4+zRFYF65GoXo=; b=XzIWsJyRwrK16bLD61X7oVfonBTtWJRI6GQ2nV4WS6opb3xBJV3pL84W4BwbyWFUl0 +RHih53HViamPt1aNDvxZHzLtrwCNDA44NaZoxpj+BPfJeM+yDoNOsh0yCFBGw1wGxjl A3FHkpu7tUeuD4oqydhBZMoycy0823Iue39F+uj7UD0RDTQ6OQUBPtULdDIxIpOHCVSU L9fBW07GJLWvHx95sg1g/RYg5iEeYKNqdj1Xz3tMlqQ/WqO7uxpjpuoaxRvBF+qutVvi N5968BKNScc2Zw6JaIwEwRasK2PN4Vz0LXj/9F1WiRODirLVMVxgO7Rl1IrWDlaGr/mB kxeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=OQgiX8FK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c20si6184161edv.165.2021.02.23.12.32.10; Tue, 23 Feb 2021 12:32:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=OQgiX8FK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233629AbhBWRIb (ORCPT + 99 others); Tue, 23 Feb 2021 12:08:31 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:20704 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232920AbhBWRI3 (ORCPT ); Tue, 23 Feb 2021 12:08:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614100022; 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=aMCIQJKY2gv1PvwEvAbWVmJle6/ioi4+zRFYF65GoXo=; b=OQgiX8FKt+C4CnteMrptKQUnMRPdE5wYYAvEEfOZYI1rW6tiS1hGpcTYwPTZTLlA/oXbnO HbOgLS9HPX00kh0XDdhdZR6MBzN3GriK/NZxzQ7JMulB3Gr8YQYJ9i+kxG+x3ryZBLayhg JxyaY+tDRbXnocCwa0FD+B2HKY5qCgE= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-584-XKUz2DZZMYCHsQf50K2rJA-1; Tue, 23 Feb 2021 12:06:30 -0500 X-MC-Unique: XKUz2DZZMYCHsQf50K2rJA-1 Received: by mail-ed1-f72.google.com with SMTP id f11so8996130edk.13 for ; Tue, 23 Feb 2021 09:06:30 -0800 (PST) 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=aMCIQJKY2gv1PvwEvAbWVmJle6/ioi4+zRFYF65GoXo=; b=Gi5CSBYHq9ILGQ6oHJi++UWPN4xrBlnxxNbMVPp7rirM6t7V46gU1YBA53S0vD6W7I WpvihXEcTCmlSkZLJWmpty+sbZ/ImTn3W+OxWPsLtJ/sYhkwpc3KMo3aCUsDjakX/tds 4d+qJjHtJ4HrNRxgeZfv3M+hFm9jT95EJBXND+fvMr9xk0UGnkXUYl6Icr8GJFRyQQMB 5UpkOObVqNNN/66RYuz1W+a4m/1Lg7mQhzEg8378z0OAKDvKDp8ck52X4DXI5HcBVhPw 8/2Bz6iWswMQkm20r2lsnX7likC81XvVJRSVE9GiYf+YptMtf9EphLEdO8SzU1U/0idY EJSw== X-Gm-Message-State: AOAM533JTgWTlxzNSKEdGCngN47mCHsrXcEDaj2bbaRHy0kWUeH/p/Bk 883mOR6VTH2E2BS2zk/2b2d0CeONKKuVYtHpgCF0OL1p/KduJAoWWKQ+/9jZB8x5H15G2LZcCFY puHgZfDyjIJ9Y4p7fnM71oCpPXteG+ciB+p8tdwh/ZYwkrikFvJXL55eHE/CnTk2P9RuI+f0Ju6 QX X-Received: by 2002:a17:906:380c:: with SMTP id v12mr26752103ejc.65.1614099988462; Tue, 23 Feb 2021 09:06:28 -0800 (PST) X-Received: by 2002:a17:906:380c:: with SMTP id v12mr26752078ejc.65.1614099988306; Tue, 23 Feb 2021 09:06:28 -0800 (PST) Received: from ?IPv6:2001:b07:add:ec09:c399:bc87:7b6c:fb2a? ([2001:b07:add:ec09:c399:bc87:7b6c:fb2a]) by smtp.gmail.com with ESMTPSA id r10sm3264536edd.49.2021.02.23.09.06.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 23 Feb 2021 09:06:27 -0800 (PST) Subject: Re: [PATCH 1/2] KVM: vmx/pmu: Fix dummy check if lbr_desc->event is created To: Like Xu , Sean Christopherson Cc: Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org References: <20210223013958.1280444-1-like.xu@linux.intel.com> From: Paolo Bonzini Message-ID: <34fa477b-f630-43ee-1df5-f64bd57d90f1@redhat.com> Date: Tue, 23 Feb 2021 18:06:26 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 MIME-Version: 1.0 In-Reply-To: <20210223013958.1280444-1-like.xu@linux.intel.com> 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 23/02/21 02:39, Like Xu wrote: > If lbr_desc->event is successfully created, the intel_pmu_create_ > guest_lbr_event() will return 0, otherwise it will return -ENOENT, > and then jump to LBR msrs dummy handling. > > Fixes: 1b5ac3226a1a ("KVM: vmx/pmu: Pass-through LBR msrs when the guest LBR event is ACTIVE") > Signed-off-by: Like Xu > --- > arch/x86/kvm/vmx/pmu_intel.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/x86/kvm/vmx/pmu_intel.c b/arch/x86/kvm/vmx/pmu_intel.c > index d1df618cb7de..d6a5fe19ff09 100644 > --- a/arch/x86/kvm/vmx/pmu_intel.c > +++ b/arch/x86/kvm/vmx/pmu_intel.c > @@ -320,7 +320,7 @@ static bool intel_pmu_handle_lbr_msrs_access(struct kvm_vcpu *vcpu, > if (!intel_pmu_is_valid_lbr_msr(vcpu, index)) > return false; > > - if (!lbr_desc->event && !intel_pmu_create_guest_lbr_event(vcpu)) > + if (!lbr_desc->event && intel_pmu_create_guest_lbr_event(vcpu)) > goto dummy; Queued, adding a "< 0" to clarify the semantics of the function. Paolo