Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp22398350rwd; Fri, 30 Jun 2023 07:34:31 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5zuSzXANFO26vVqsI6wzAEfYVgHdgzi/FA0jT2MoZgY0ymKfm/cckVyBIHeS4itE9pYgoh X-Received: by 2002:a05:6a20:9189:b0:125:699a:6d0a with SMTP id v9-20020a056a20918900b00125699a6d0amr3167950pzd.33.1688135670623; Fri, 30 Jun 2023 07:34:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688135670; cv=none; d=google.com; s=arc-20160816; b=zSXWRJSpLqrb6mi/TA4vlSjIOdFdlk40xjxVB8QK/9mfc3Vfgn4m9g/I6JGANo9PsO iChljfD2LY+mLWWBcdno3+8Q3m8Z1tGwChQyAGTzWsZ5XrDyCH7gVP4nZ3aEDF4IcOAn vMTKUIdvVd2HJci6lddgRjHJ58W5cRIHNyfNeukoetGThV5PloJBN9FNnxgzQgC4YyP/ GP0lMn/STt2G2t6xjBIfXVdAsghkBqa3O/AZ+nMOFOx23uqElYIpYi17FFfjMYTr8v52 C4ZuLabtztB4NrEPmM+f7lNSFsxArYmbtHU+twOxtx08BEgu76rSvLt4JYlo3gdSlZnd Y4Mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=FRMN0RaJzHYAyXMyga4ctoKFK0XbdFwKMcCpI/juWEU=; fh=TS2mxc8wESXTOKCDA58PXnuPWcD7HA1DAOoimABCKxQ=; b=SqPsu9XUL63UECfY90T7kNYJwq94E4UgLuYFqq1GsxJK4MDhDJ18JlRUzdX60hDYdJ LvhHC2If/XPTZKPXrheEXjBKKK3+MG+dfccnSASuB2O5kl1fPYh6liUGdQN+CnUN//Xx jAu//dQ0oSTZxz5SOM5MTufdMmkLmkim+8QzT9/3h3LjygLPGixYX51Mf5Rpb1DorxGJ U9LlX1zwerrFincbw+n0o4FpcKE1YuTy98urK5s0rm8mOYVh40bvP8t1D/Mt/CciOCbH HHgoFqrwvz5Xa0AZK19/kkks+eEjuWG5thb/zlpLbZc7leLf6v33+8lGrdZb1Q7HqC5i dBBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=am0dqL8t; 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 85-20020a630158000000b0054ffd92af2bsi13108979pgb.506.2023.06.30.07.34.14; Fri, 30 Jun 2023 07:34:30 -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=am0dqL8t; 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 S232347AbjF3O2f (ORCPT + 99 others); Fri, 30 Jun 2023 10:28:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230462AbjF3O2d (ORCPT ); Fri, 30 Jun 2023 10:28:33 -0400 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00CA13AAD for ; Fri, 30 Jun 2023 07:28:32 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-bfee66a6398so1660483276.3 for ; Fri, 30 Jun 2023 07:28:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1688135312; x=1690727312; h=to:from:subject:message-id:references:mime-version:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=FRMN0RaJzHYAyXMyga4ctoKFK0XbdFwKMcCpI/juWEU=; b=am0dqL8tuDa5C5eAHIW+joInjR/a055ifnjo+XJOjG+qcVcc7ILCAG4uVycrP+mFcK FAn7/4Eq65Dj34v0YTkD597Txnxmc+yQPxISjWUK0rVlT9d0BVlp9L1X8s3nUnCLaM5/ gouPMfh60JcbsvPSV6U19hQ1Yf139QyGWx9RbOfUmcfTgQVSrgUU6K2AbQpJnLu9iLO7 fJs1jOtYs29gobQ1SfpvZJE3vM8gac16O3IHANQE9D6y/hF72mLvpEzVgIxJRx/Kz32Q xEJ560pfJvDmiswQ/NIhDKt5VHKXP+GaRT/ApbOWVkNFq+RXhECgD5nn/0xPbotUDJsA nUFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688135312; x=1690727312; h=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=FRMN0RaJzHYAyXMyga4ctoKFK0XbdFwKMcCpI/juWEU=; b=Y/8PR6xx6ObDdROl7oVqIHPM0OcEM3LcrtkMeRKkChUHHBNDEdVjVhbNPgso88OvMW zzj0+0gav3z57yV39e6+HYSJrgBy2J8sFBuwC2Ppofcu1lbAeOW9yxKoWXQ8bx4whLdf BZ/Hvc3CdwiHB0ct8LQqlsJ0529ZiYnUBDpeWAnIaA8br06hPk6aqz5MFlMgNu2rZ28M uBhyWMmiUgM0mtwGVpCR8ElSWsb3bz0SLjZ2CRw8zTIj3mty4AO/AgEgrEY10q2dnu0R qpHoYuLPQstxJZpGjVzgh4+7IiojMQ3OKJBpccqBIuFFaKhx5egRtMVFbfkYtdtHrS0z LS5Q== X-Gm-Message-State: ABy/qLadakyoSrzBEKdWAupbmJmg+pWhHKeDtRXQRWGvUN1/pw/7gDLK obPYf8g4GBxWvt3Oe6TO5SOjGd+Zqvs= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a25:f602:0:b0:c11:bb8d:75f4 with SMTP id t2-20020a25f602000000b00c11bb8d75f4mr17391ybd.8.1688135312230; Fri, 30 Jun 2023 07:28:32 -0700 (PDT) Date: Fri, 30 Jun 2023 07:28:29 -0700 In-Reply-To: Mime-Version: 1.0 References: <20230504120042.785651-1-rkagan@amazon.de> Message-ID: Subject: Re: [PATCH] KVM: x86: vPMU: truncate counter value to allowed width From: Sean Christopherson To: Roman Kagan , Jim Mattson , Paolo Bonzini , Eric Hankland , kvm@vger.kernel.org, Dave Hansen , Like Xu , x86@kernel.org, Thomas Gleixner , linux-kernel@vger.kernel.org, "H. Peter Anvin" , Borislav Petkov , Ingo Molnar , Mingwei Zhang 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=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 On Fri, Jun 30, 2023, Roman Kagan wrote: > On Thu, Jun 29, 2023 at 05:11:06PM -0700, Sean Christopherson wrote: > > @@ -74,6 +74,14 @@ static inline u64 pmc_read_counter(struct kvm_pmc *pmc) > > return counter & pmc_bitmask(pmc); > > } > > > > +static inline void pmc_write_counter(struct kvm_pmc *pmc, u64 val) > > +{ > > + if (pmc->perf_event && !pmc->is_paused) > > + perf_event_set_count(pmc->perf_event, val); > > + > > + pmc->counter = val; > > Doesn't this still have the original problem of storing wider value than > allowed? Yes, this was just to fix the counter offset weirdness. My plan is to apply your patch on top. Sorry for not making that clear.