Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1358473rwd; Thu, 25 May 2023 11:22:08 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ63GhZoS/jyXWuwEL4wCOk0YNg+ayTKXdyP8MpuHNmYTNp45ABk6Zkp93VB0fiPRLdu6pwD X-Received: by 2002:a17:902:e848:b0:1ac:8cd6:9323 with SMTP id t8-20020a170902e84800b001ac8cd69323mr2964593plg.22.1685038928013; Thu, 25 May 2023 11:22:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685038927; cv=none; d=google.com; s=arc-20160816; b=I9ZLvsyUHsgn5LPC8ofCmh1ecHfWeOcUFNe3DYJjwy1nJdD4xBybSTfacEupc+kugK RwN0hDNLP7NLx3y8MAIY1YPtNqTMDEnC1dx6lQ3Bny6nAjokYtV2v7G75mVRUnRXEwCM CaDmYL5E99whm+sD1syTEmtwM3PDqmY7txPTRCZPdI6Fm86+hAwkVddltBeiz9FojKyP 1U6DidzFRyivm2TmV4TcYpmTOdEbVM4YaxO+g7oXq/fZhjJZNP4CzBZdx/fBl5/K5KMZ tK4NZliPg/l0JS9jA+KarEiygvQQb/M8gFTwPsh7nG/+jSENajT+Y/59ZwUJzO/SBrvd SJDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=3+IxoBoebOsPjsV+diUVwrxPrkn1mNdsKoZUJH//gMM=; b=mMVq+QJsiI1QFKjZieD3KTRRf12KlqT4g7UDebpqgwM+7/gqajO0yK5SSy5e1E1oC6 /mV92LUT03uLR0JmxbDLrZWabHM9WJlquJ7Z46UfrLwhA/QuqHVKDcUZn/ubACtOir3f IbFnSpr2hNzGGiQIBqWR5bxAM8Oi/FSjAY+Rk4LPgZmatHkZhkOj1eG5tsXQRNjayu/E XRn1JyEqejv+Y96Z/UPMllYldfxx+xKacuvJmF/WqfoZMzDw70Z8BomAwR0zRT/KDQjz fEST8nILJYGuz2qkv1rhQxxxbQtX0w3tQT/msRV1NU6u9/lzYz0N6EvxeoNrxrf5VQow iNGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=asq73AO5; 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 n11-20020a170902e54b00b001acb03ca5aasi2198484plf.612.2023.05.25.11.21.51; Thu, 25 May 2023 11:22:07 -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=20221208 header.b=asq73AO5; 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 S232203AbjEYSMj (ORCPT + 99 others); Thu, 25 May 2023 14:12:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229832AbjEYSMi (ORCPT ); Thu, 25 May 2023 14:12:38 -0400 Received: from mail-pg1-x54a.google.com (mail-pg1-x54a.google.com [IPv6:2607:f8b0:4864:20::54a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DBED5D9 for ; Thu, 25 May 2023 11:12:36 -0700 (PDT) Received: by mail-pg1-x54a.google.com with SMTP id 41be03b00d2f7-5340957c397so1272932a12.2 for ; Thu, 25 May 2023 11:12:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1685038356; x=1687630356; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=3+IxoBoebOsPjsV+diUVwrxPrkn1mNdsKoZUJH//gMM=; b=asq73AO5EW4oiv2rz/cLLjTKTOMfwul5iEyKEl8XBvFpZk1slUgRJeAxEZiuyOH1il u6vWzpiV/+J0VP2thxrbC0sqUAY8L6T1NcUDmCBfLxl6d4IEhC0+Bjuld2ZOJpvagjNb L0xcP0fnuRpHSql/df5vWdxhu0Td5JGTOmuAxT8GCskaoktlIhL8NaZwrJ53m1zmSJr8 MJnhsoTOl8hUPUXSB0Kkd+Ve89P/BiBAft9a1eXs7qZSCwL7jQbkiQIf3EGHP2Qv93he vM1Br6nOaSA/7+oc7SgfBTLePi7DLwbUGNSJ95gGLU8ytW/gI9SPrOsgpeGiuJTdA0cg jMTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685038356; x=1687630356; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=3+IxoBoebOsPjsV+diUVwrxPrkn1mNdsKoZUJH//gMM=; b=hy81wEf41HTgvhlYLkGZaJoFTmd2+lt2VYOyKgD9/+dtSDMN5arZxIU+fDw1IaFh1z ZZEgVTHiaB/mx1of3K8iMNfPy+pDWphylDb+5zOw3iPKB9TwHaqUuOBgzi50dXGfWn6j 2+gzlAsFpqyzzJWxiUHdQS29hBQpV1MZpojCSyRECMlGHpJlkcgWVRBF712BQ0TWTBg0 aEXNL1IdqhBwrjtoPnmFvfDCx5K+NAMV9Dx6CYRr0V2gTBFTd9WX8HRmpEPhedy0/sbH 5HGARw1gDesuBBVOLB2+i/p6lTVj/0LDl9X6HN0AjOAJeYPyXlKsdkGFHr3YrxHVJR/2 5Q8A== X-Gm-Message-State: AC+VfDx5pu0U4eaAhivFNh78RxNoPbMWtnGzrdYoa3XB3iR2RPfzzbBp i95jTzinvlvc0yUsR6yNioIl8Kk/7KQ= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a65:5b45:0:b0:53f:265a:a662 with SMTP id y5-20020a655b45000000b0053f265aa662mr691222pgr.4.1685038356418; Thu, 25 May 2023 11:12:36 -0700 (PDT) Date: Thu, 25 May 2023 11:12:34 -0700 In-Reply-To: <20230420104622.12504-7-ljrcore@126.com> Mime-Version: 1.0 References: <20230420104622.12504-1-ljrcore@126.com> <20230420104622.12504-7-ljrcore@126.com> Message-ID: Subject: Re: [PATCH v2 6/7] KVM: selftests: Check gp event filters without affecting fixed event filters From: Sean Christopherson To: Jinrong Liang Cc: Like Xu , Paolo Bonzini , Jonathan Corbet , Shuah Khan , Aaron Lewis , David Matlack , Vishal Annapurve , Wanpeng Li , Bagas Sanjaya , Jinrong Liang , linux-kselftest@vger.kernel.org, linux-doc@vger.kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="us-ascii" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL autolearn=ham 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 On Thu, Apr 20, 2023, Jinrong Liang wrote: > From: Jinrong Liang > > From: Jinrong Liang > > Add a test to ensure that setting both generic and fixed performance > event filters does not affect the consistency of the fixed performance > filter behavior in KVM. This test helps to ensure that the fixed > performance filter works as expected even when generic performance > event filters are also set. > > Signed-off-by: Jinrong Liang > --- > .../selftests/kvm/x86_64/pmu_event_filter_test.c | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/tools/testing/selftests/kvm/x86_64/pmu_event_filter_test.c b/tools/testing/selftests/kvm/x86_64/pmu_event_filter_test.c > index 0f54c53d7fff..9be4c6f8fb7e 100644 > --- a/tools/testing/selftests/kvm/x86_64/pmu_event_filter_test.c > +++ b/tools/testing/selftests/kvm/x86_64/pmu_event_filter_test.c > @@ -889,6 +889,7 @@ static void test_fixed_ctr_action_and_bitmap(struct kvm_vcpu *vcpu, > uint32_t bitmap; > uint64_t count; > bool expected; > + struct kvm_pmu_event_filter *f; > > /* > * Check the fixed performance counter can count normally works when > @@ -902,6 +903,19 @@ static void test_fixed_ctr_action_and_bitmap(struct kvm_vcpu *vcpu, > expected = fixed_ctr_is_allowed(fixed_ctr_idx, actions[i], bitmap); > count = test_fixed_ctr_with_filter(vcpu, actions[i], bitmap); > > + TEST_ASSERT(expected == !!count, > + "Fixed event filter does not work as expected."); > + > + /* > + * Check that setting both events[] and fixed_counter_bitmap > + * does not affect the consistency of the fixed ctrs' behaviour. > + * > + * Note, the fixed_counter_bitmap rule has high priority. "high" is ambiguous without a baseline. I believe what you want to say is "the fixed_counter_bitmap has higher priority than the events list". > + */ > + f = event_filter(actions[i]); > + f->fixed_counter_bitmap = bitmap; > + count = test_with_filter(vcpu, f); > + > TEST_ASSERT(expected == !!count, > "Fixed event filter does not work as expected."); > } > -- > 2.31.1 >