Received: by 2002:ab2:7407:0:b0:1f4:b336:87c4 with SMTP id e7csp121449lqn; Thu, 11 Apr 2024 16:26:56 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUBKZ2OTkFeC9uUSZS67WfUWRwVxOoR71rQiwUDiDU5KKn4wwf9aA1kpTni2oKGzCsOA1+lTN+rUOHE8ltqudDGqZMDmWFvvq2mO60g3w== X-Google-Smtp-Source: AGHT+IGPiob+Wk6Jtrf/MZiY5SzTuH0c6ub5HRZGpdjd9+t4eikP5AvH9weMqgY+qXxVTWPUBRqm X-Received: by 2002:a05:6e02:12e5:b0:36a:b4f3:7731 with SMTP id l5-20020a056e0212e500b0036ab4f37731mr1137446iln.7.1712878015930; Thu, 11 Apr 2024 16:26:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712878015; cv=pass; d=google.com; s=arc-20160816; b=KIeu2Tqn/hmv9czJQihMHPswOAjLLD8AZcIjv+Qg6orGDX3VScR+FAxeyNM8rgO2Md OFfGpqC6GvN6zLqd3nbZcLWtvloWA3nWMbBPHjf55jsyJmvMyNCSD2EKZ32VOrA+CTcp deNeR8SGaBmeikQyMMOqwx2pQ5u+9P9mk9lSaLgsRzW5BryA5i0kPUJwWSczz9uPVwFr gSl5PW0XRTteDOZiIpYr5hXl2ZzM+Ty8t7piCISpLT5MF+2eqHDcC/MPe6A++UnAvnIs IADQ9C8YMWCDa6G80TOqWQ7cJYdK3aFvzTe7I3tzbPeRQCe0gPsvZdpU02jd/LRpVBA2 nhKA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:references:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:in-reply-to:date :dkim-signature; bh=ZaEKPQTfggD2ocO67Q/mDYf6kXhBuyVqa9iBD72w+wg=; fh=E4U7sCvx7P2U4G/OjSnuKyV6ngwMOXtMEmKCY8AvAyQ=; b=F/HDaR2OM4iwlEB9Pln3Q7NMmi+UiAIonleN7f2KXcZpEC6BNdmwDOtMUWAaU6Z8KU Uw8GhKA/Y1J7wnFk1Ir/9FA3dJTU4Kzo6MYuY6dxd6n19Zs7v+GRXobA8C0uhW6d2zW0 b3TpfpmXpvYRYHdOB8ikNWRD4QyoSTXWNULdAmgia6ioOWGyVv366wGBqqLrS/WOJjwQ 7o8kkcYAvn0uJu9ERFdoy2/a5kGZjEUSKiDhQ56Z84bhJwJ8uYUTzjvoAuynxhCbIGzy jriQVdNLxU/7wYtwfGZjxWdDQidljlHBMzsx9GWwRrojoR2+FYXrZk5kMRvKYUagPF/8 89/w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=aWZcZKLB; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-141703-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-141703-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id j22-20020a63fc16000000b005d4fdff9a2csi1999097pgi.328.2024.04.11.16.26.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 16:26:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-141703-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=aWZcZKLB; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-141703-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-141703-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id B79BC28669B for ; Thu, 11 Apr 2024 23:17:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 72E0B481BF; Thu, 11 Apr 2024 23:17:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="aWZcZKLB" Received: from mail-pl1-f201.google.com (mail-pl1-f201.google.com [209.85.214.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8AAD8D53C for ; Thu, 11 Apr 2024 23:17:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712877428; cv=none; b=LVae5uF1xJ5rIv+oYqz6SPZQuBkllvdCSfGazH78Eezf+k8OcZ62hKZ5qG2fen76HGVoXhZd02NUrSAYxffyC8jIUk0Cfk5+Ccrl1z9xYkrJammy0UkJG23Ow+a+Z95M1QAkYp+UfK+XmTQM7ihCMiJY8ZOwXL36zbdXoV+I4BI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712877428; c=relaxed/simple; bh=BpVlVa98Ld8N5k9yDGC7wHjA38fX++HWC68Q50KplEE=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=dLZ+4DIvfIODL4qWl7lFyfdZuM5DG/xx3h1W5hLpWTbIgO29MGfHAzNxXJrxUybaUwpGMt/VTWqmzs7pyiMMXjB6oXAWbD7/AK3cvAYVR+x/H+Q+CFIfG3IdGafs7leHXEFKEbCy1yg/YYuWrlHlGRCjoO/W2pygGK/Iwzjov4Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=aWZcZKLB; arc=none smtp.client-ip=209.85.214.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Received: by mail-pl1-f201.google.com with SMTP id d9443c01a7336-1e2be2a866aso3945815ad.3 for ; Thu, 11 Apr 2024 16:17:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1712877427; x=1713482227; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=ZaEKPQTfggD2ocO67Q/mDYf6kXhBuyVqa9iBD72w+wg=; b=aWZcZKLBn1y7sJMp2f7AVhsDaHqe2pAuwnpUz5r+6NnTbjbgIHxYS69qzAWbC9NnVR aGSVHYPL7GJsy2r0edzuB35fazSSSKkL/xU7n4eTfSJ7p4vb94xzOKJkKeFe/2iLq3Fq P3dhqhLNh7cJVPcKfwCX+PmD7UoogEgF1sr1/bo1k0oYfJbdMSxdsXdsnZ84EIBmdVj4 XUbgzPfEhpdXrH2pG89w4v5WS1HRVvA1nmDFHYYtUhvSHTq7soWeSRsAPOXxZBbUXMHa GN9FOwSvBPFqZMRXvYDnG20QhEc2Sl+EVD5lSWVrENqxFbQNkmm9h9g3FnhJhrYnB1gr x4fQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712877427; x=1713482227; 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=ZaEKPQTfggD2ocO67Q/mDYf6kXhBuyVqa9iBD72w+wg=; b=DLj9mYj0kIzlynyByfuIvCp2e3EoDiZzQRYyDVimx/Kin+gqoXfIkgtn48m7h4gY5K 1T71JB+6P3iJT6UPOzDsd/AIhgr5751m8uZqo+JCa7/7FiHBcxim1pNfcisSkoTk48xu /kA7CZHtNL1bGJu/h+6rfkZOOO59Dsb98L17zFEYyMw4j4AYtjDmOBAoqsaEhEwPcWib CR+Dd7GM0UvV+X92JkOK2Pr7BY0utFKlqJTXx0Z/4XEC/CnrsDMoP4Tzte8+fCb4NQVI JFF5lmrKSLLa+PNr8RbkQ8mgozOMWMpw62RTRxnzl9nSnOBDmV2KpjYUfn5JLR6kiy3p Ph+g== X-Forwarded-Encrypted: i=1; AJvYcCWDCkzd40PABbumjhrrH0Q5qiljlZGW1vpK4jTjgr0N+M3ClBbz6ejts4b9G+GyE1CLpNJXKR4CFJqvS73Js8dbgza4xrvohdpczZ2E X-Gm-Message-State: AOJu0Ywqs5jWgFzDv3GGmEIaGEAjQFqZPCwCpwIF3anI77ZQzh59Z/Sy DdQ1hsKeC8FNgIDiobJNbIiAz2P8nVbqBIbXvZPjg72P2NUsjoOFlxDBSidshNugwkpcjzfAVtg Utw== X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a17:903:2444:b0:1e3:cf18:7336 with SMTP id l4-20020a170903244400b001e3cf187336mr3032pls.2.1712877426911; Thu, 11 Apr 2024 16:17:06 -0700 (PDT) Date: Thu, 11 Apr 2024 16:17:05 -0700 In-Reply-To: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240126085444.324918-1-xiong.y.zhang@linux.intel.com> <20240126085444.324918-40-xiong.y.zhang@linux.intel.com> Message-ID: Subject: Re: [RFC PATCH 39/41] KVM: x86/pmu: Implement emulated counter increment for passthrough PMU From: Sean Christopherson To: Xiong Zhang Cc: pbonzini@redhat.com, peterz@infradead.org, mizhang@google.com, kan.liang@intel.com, zhenyuw@linux.intel.com, dapeng1.mi@linux.intel.com, jmattson@google.com, kvm@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, zhiyuan.lv@intel.com, eranian@google.com, irogers@google.com, samantha.alt@intel.com, like.xu.linux@gmail.com, chao.gao@intel.com Content-Type: text/plain; charset="us-ascii" On Thu, Apr 11, 2024, Sean Christopherson wrote: > > + struct kvm_pmu *pmu = vcpu_to_pmu(vcpu); > > + int bit; > > + > > + for_each_set_bit(bit, pmu->incremented_pmc_idx, X86_PMC_IDX_MAX) { > > I don't love the "incremented_pmc_idx" name. It's specifically for emulated > events, that should ideally be clear in the name. > > And does the tracking the emulated counters actually buy anything? Iterating > over all PMCs and checking emulated_counter doesn't seem like it'd be measurably > slow, especially not when this path is likely writing multiple MSRs. > > Wait, why use that and not reprogram_pmi? If the name is a sticking point, just rename it to something generic, e.g. dirty_pmcs or something.