Received: by 2002:a05:7412:f589:b0:e2:908c:2ebd with SMTP id eh9csp658763rdb; Tue, 31 Oct 2023 20:25:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEN2HkROojq6haAq62+9jcnmKxkQKmTv4B3spkWfNSGWXraPmjJyrdPwj5W/JQ/D6JqMPHO X-Received: by 2002:a05:6830:619:b0:6c4:897a:31d0 with SMTP id w25-20020a056830061900b006c4897a31d0mr14012619oti.24.1698809116496; Tue, 31 Oct 2023 20:25:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698809116; cv=none; d=google.com; s=arc-20160816; b=xiwZZrEKhA84ezVgSfBSqzaUYdD5hiTbDccDRGuInBsFgV1gcR/jDvrfjS1uvo7Ocv RycVlEvLzLmRc6xGVMIaW1Bs5vzseyey2UWdWYBEjBmmtMcqlvNr19afIDeo5RgfaMf1 Rlk1DcZuIxsDFOjYyu9WqcQl070zs1wTDn0f8ueDwOsutNA7+CIh5yJ4oXoM2Qkn3vw9 TSgCez6wBlnOgBzWgbyDem/HXA+8kWDSqZRKKP9AdCkYEwf02MS3T4Vcm74RZSiiIr3p JRYhFkDRszr7RMdSqE4xk91VhJh76cwZxK1v75QYCuSD7PnlkwdpuLQZhR5LNOB6byb1 0R3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=FxmahLRvzF8Eu+4ttjDu+9ikN6d1g8PIZEzX9Tgb1Kc=; fh=uHS0/9G41/xc7SfwaImOsh2CmuncZhRxHxVdkkWVxmc=; b=Rd87ntGR72SdM+ZY69Bj64nNBqUuirX1uob6MMWnSvWfxnxxwxUNhdraZrgFA1+pkF pintxGgZjBqk7EST9Stp5u65CN6phHi0oekil3A6/eRJZXe/d6cW1JXcy4BDcv3nrQBl pmdAWOcVqS6CBEQKqGtW4WfgLda/H7FiCDjiCK5C4GfH6rWUq8BIEktpt0gGy3Z2IKkF OKWBntB/ZOnHYzSLWSxePS5u5FsutcPdSksoYlVKxWBEl/HZGrJuOxJpazjzLAFbc15M me4QswlSrCHM1ifzVRG2BgcfcXhzvNCul6A1HherUsaXT7P6ZyXrE+l0lb30OJLYyjdX iLmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=ZQCD45NC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id c13-20020a17090a8d0d00b002773d013d02si2065906pjo.140.2023.10.31.20.25.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 20:25:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=ZQCD45NC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id C918780BB53B; Tue, 31 Oct 2023 20:25:13 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231924AbjKADZJ (ORCPT + 99 others); Tue, 31 Oct 2023 23:25:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231252AbjKADZH (ORCPT ); Tue, 31 Oct 2023 23:25:07 -0400 Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98663B4 for ; Tue, 31 Oct 2023 20:25:04 -0700 (PDT) Received: by mail-ed1-x52d.google.com with SMTP id 4fb4d7f45d1cf-54357417e81so7267a12.0 for ; Tue, 31 Oct 2023 20:25:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1698809103; x=1699413903; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=FxmahLRvzF8Eu+4ttjDu+9ikN6d1g8PIZEzX9Tgb1Kc=; b=ZQCD45NCIt/qiK5oFeXdqxXonrzrdyRfV0rJx0FS4pM5A1CDal1RcYQEqN6DVoqs3J 8EgXJYC5T/UM6a5BRc3fUpRmcmIpYw6f1Te0k3aTxGmKpXn8vc9WtyawOtv14mP45OoT gGR9gGfxjLezYppQ5L8ADBMTkjgVvQRZyj1np7fbFis0N0HVgnD8sH95xJlzRJT/h4aX BU0n4q3a78HKf8J6gwS25mM11KQDdpTMbCG7/sILhJ5AZ+L6QLCckUw1ZaFH6flMjjPs QO8vy7KqOu9OxZuT/HGIK1R83ihPSqn9ue/zpb3Q1gNJfqGyWWHkNiZjizJurKqiHsJI +vtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698809103; x=1699413903; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FxmahLRvzF8Eu+4ttjDu+9ikN6d1g8PIZEzX9Tgb1Kc=; b=Vw16IsIV/muckOz6DWIvCm6ITDDRiuVzvUUWCg2bhkcBo9Dgm4tpOWo0OboZ9YNUGG ZWorUqEbcnBy/XWEGHvWa3mC2ciITRCvgUZ2Vaen5cVLYlKOHvO9XHEUQ6ItSWuNNV+9 kVmp6Xa3rv3tiS5fNLp0T+nytBQSpvkdpRyr5J798aiPxhR8lv+Eiv+/uYYeoQ+QPOHS QLWoSwXyp6xFOQnN+Pz3MJiDjOIM+ctpkxWJH1CAvET9q2MHS5FT+B5hYFNVjvujonnC pwDFXSn5CpOIPElDX7aXtyIuCYN2poDAfOjXZ/dNdO76KPhoBoPwJByklwMMIi+t8OiQ Q7rg== X-Gm-Message-State: AOJu0YyP3bubLP3qegCncGouF46GaU3rerkapGXDHJACcLINMePvFG2v JUaQl3INpFwx8gKck0bhJb5cIsGPW8QkT5xOggRMQw== X-Received: by 2002:a50:f684:0:b0:540:e4c3:430 with SMTP id d4-20020a50f684000000b00540e4c30430mr222133edn.6.1698809102922; Tue, 31 Oct 2023 20:25:02 -0700 (PDT) MIME-Version: 1.0 References: <20231031092921.2885109-1-dapeng1.mi@linux.intel.com> <20231031092921.2885109-5-dapeng1.mi@linux.intel.com> <28796dd3-ac4e-4a38-b9e1-f79533b2a798@linux.intel.com> In-Reply-To: From: Jim Mattson Date: Tue, 31 Oct 2023 20:24:51 -0700 Message-ID: Subject: Re: [kvm-unit-tests Patch v2 4/5] x86: pmu: Support validation for Intel PMU fixed counter 3 To: "Mi, Dapeng" Cc: Sean Christopherson , Paolo Bonzini , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Zhenyu Wang , Zhang Xiong , Mingwei Zhang , Like Xu , Dapeng Mi Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Tue, 31 Oct 2023 20:25:13 -0700 (PDT) On Tue, Oct 31, 2023 at 8:16=E2=80=AFPM Mi, Dapeng wrote: > > > On 11/1/2023 10:47 AM, Jim Mattson wrote: > > On Tue, Oct 31, 2023 at 7:33=E2=80=AFPM Mi, Dapeng wrote: > >> > >> On 11/1/2023 2:47 AM, Jim Mattson wrote: > >>> On Tue, Oct 31, 2023 at 2:22=E2=80=AFAM Dapeng Mi wrote: > >>>> Intel CPUs, like Sapphire Rapids, introduces a new fixed counter > >>>> (fixed counter 3) to counter/sample topdown.slots event, but current > >>>> code still doesn't cover this new fixed counter. > >>>> > >>>> So this patch adds code to validate this new fixed counter can count > >>>> slots event correctly. > >>> I'm not convinced that this actually validates anything. > >>> > >>> Suppose, for example, that KVM used fixed counter 1 when the guest > >>> asked for fixed counter 3. Wouldn't this test still pass? > >> > >> Per my understanding, as long as the KVM returns a valid count in the > >> reasonable count range, we can think KVM works correctly. We don't nee= d > >> to entangle on how KVM really uses the HW, it could be impossible and > >> unnecessary. > > Now, I see how the Pentium FDIV bug escaped notice. Hey, the numbers > > are in a reasonable range. What's everyone upset about? > > > >> Yeah, currently the predefined valid count range may be some kind of > >> loose since I want to cover as much as hardwares and avoid to cause > >> regression. Especially after introducing the random jump and clflush > >> instructions, the cycles and slots become much more hard to predict. > >> Maybe we can have a comparable restricted count range in the initial > >> change, and we can loosen the restriction then if we encounter a failu= re > >> on some specific hardware. do you think it's better? Thanks. > > I think the test is essentially useless, and should probably just be > > deleted, so that it doesn't give a false sense of confidence. > > IMO, I can't say the tests are totally useless. Yes, passing the tests > doesn't mean the KVM vPMU must work correctly, but we can say there is > something probably wrong if it fails to pass these tests. Considering > the hardware differences, it's impossible to set an exact value for > these events in advance and it seems there is no better method to verify > the PMC count as well. I still prefer to keep these tests until we have > a better method to verify the accuracy of the PMC count. If it's impossible to set an exact value for these events in advance, how does Intel validate the hardware PMU?