From nobody Mon Jul 4 18:09:21 2022 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 162A71C3EF51; Mon, 4 Jul 2022 18:09:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LcDN20b7Hz4k61; Mon, 4 Jul 2022 18:09:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656958162; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=sNCh8t9mvjOahC1P1GmCCTJ1X8c+sUQDd8y/4QniFjY=; b=Mi77FImkRmmVbgeX6KNhYaABscipCRMD3gYRcFwfeEcSjJKj0Zu2v8K0hoRTvH9wkmN8Wy PlU25ipAeqRtdEUYZV6HY773kiYXHZ/QL3j1IsTm25Z3bTUv5VZ3duUEv64ihSwLJdFei1 emuysIOVwTWRLCZ89EFaXbInWpt8fYAstbiH/7eQeux30OTFGGeABwsrhjMs5niG62rItN X4dkgfA3WbJVBRMPPKFIdR25cssY9DlqaBNNrNAGxQny6WiwfJjSttFMImJ0O/wqJ9iCTa wJid2TIA0v4sQY33kUeLGWDdqqFYUZ4v0EAtttI8oWdxXn+68GImcBZjXdIvVw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A681116094; Mon, 4 Jul 2022 18:09:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 264I9LTs064379; Mon, 4 Jul 2022 18:09:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 264I9LVA064378; Mon, 4 Jul 2022 18:09:21 GMT (envelope-from git) Date: Mon, 4 Jul 2022 18:09:21 GMT Message-Id: <202207041809.264I9LVA064378@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: e7b63a7c6d62 - stable/13 - hwpmc: Update Intel's programmable counters restrictions. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e7b63a7c6d62b4628373577792f842d71611b53a Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656958162; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=sNCh8t9mvjOahC1P1GmCCTJ1X8c+sUQDd8y/4QniFjY=; b=lcQuEcz5cjWKgVUez0BE/4h56OYsFSO4/avdtb8URDN1SfFMcWdRu6UEGF3d4dY21WIAgE kN6MlM9lh15Bsfm4wtFqAqBzeKdKHVzZLWUAzrTUWybqzRcDI7/VwUDAFwgIMqE+JhLXVg MfIDypHTgyeG5yvPygtxJzJBVwYxFc1oy0KNkq2jk/qgrdAe38SKq6Pdf67ZItAgFgbq5u k/rjKzShj/d34qspfU4ZJhT3TvKD48DGTuZbNYp9WTjn5lCgHDq9+1zXF8QlIF/p5xKx8g 0nRm62bV5H3p2Y8Kw5sHtbtl28H2YcdH5t71O5a75Gl2p3JsS6Mu55j0EASbFA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1656958162; a=rsa-sha256; cv=none; b=cXl+s1kHM6QlTFrTyr6CJ2aLsJDIAxs+T93M/fFL8y9VzKbwtmlg6EiQwtCUCU++U678C7 W8QDal/snHja3vIn4DdrmIWQOuyxEeZO8EYpQqCqcJ3vBr5BvZDvheIUSZByM1rITB+A9L NX8F2q6VaILiwMO0nb4fSZ/qOMX+Ihtw6lD/jFdI+P1raODYh4TSehNPLBOozLPiEvyUfr TrNCQKi58LI+x926zTLRv1i0IMkvTmk81o1DElFbECgxyKDuF7yMlYcwuHDzsSJWBy76a/ OyTkRcBZyjY6f/fuqrgJflWadkEb/9Sl4tW+K+UBWgy1ezVcRh1mo8baoDmnRQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=e7b63a7c6d62b4628373577792f842d71611b53a commit e7b63a7c6d62b4628373577792f842d71611b53a Author: Alexander Motin AuthorDate: 2022-05-31 02:51:00 +0000 Commit: Alexander Motin CommitDate: 2022-07-04 17:48:09 +0000 hwpmc: Update Intel's programmable counters restrictions. Primarily remove unneeded restrictions from later CPUs. MFC after: 1 month (cherry picked from commit ae57fbc7ec65fcc75575a55c911e0da32ea9c20d) --- sys/dev/hwpmc/hwpmc_core.c | 101 ++++++++++++++++++++++++--------------------- 1 file changed, 54 insertions(+), 47 deletions(-) diff --git a/sys/dev/hwpmc/hwpmc_core.c b/sys/dev/hwpmc/hwpmc_core.c index 7d359e732291..2ec6ac794f62 100644 --- a/sys/dev/hwpmc/hwpmc_core.c +++ b/sys/dev/hwpmc/hwpmc_core.c @@ -615,20 +615,22 @@ iap_event_corei7_ok_on_counter(uint8_t evsel, int ri) uint32_t mask; switch (evsel) { - /* - * Events valid only on counter 0, 1. - */ - case 0x40: - case 0x41: - case 0x42: - case 0x43: - case 0x51: - case 0x63: - mask = 0x3; + /* Events valid only on counter 0, 1. */ + case 0x40: + case 0x41: + case 0x42: + case 0x43: + case 0x4C: + case 0x4E: + case 0x51: + case 0x52: + case 0x53: + case 0x63: + mask = 0x3; break; - - default: - mask = ~0; /* Any row index is ok. */ + /* Any row index is ok. */ + default: + mask = ~0; } return (mask & (1 << ri)); @@ -640,26 +642,23 @@ iap_event_westmere_ok_on_counter(uint8_t evsel, int ri) uint32_t mask; switch (evsel) { - /* - * Events valid only on counter 0. - */ - case 0x60: - case 0xB3: + /* Events valid only on counter 0. */ + case 0x60: + case 0xB3: mask = 0x1; break; - /* - * Events valid only on counter 0, 1. - */ - case 0x4C: - case 0x4E: - case 0x51: - case 0x63: + /* Events valid only on counter 0, 1. */ + case 0x4C: + case 0x4E: + case 0x51: + case 0x52: + case 0x63: mask = 0x3; break; - + /* Any row index is ok. */ default: - mask = ~0; /* Any row index is ok. */ + mask = ~0; } return (mask & (1 << ri)); @@ -671,34 +670,35 @@ iap_event_sb_sbx_ib_ibx_ok_on_counter(uint8_t evsel, int ri) uint32_t mask; switch (evsel) { - /* Events valid only on counter 0. */ - case 0xB7: + /* Events valid only on counter 0. */ + case 0xB7: mask = 0x1; break; - /* Events valid only on counter 1. */ + /* Events valid only on counter 1. */ case 0xC0: mask = 0x2; break; - /* Events valid only on counter 2. */ + /* Events valid only on counter 2. */ case 0x48: case 0xA2: case 0xA3: mask = 0x4; break; - /* Events valid only on counter 3. */ + /* Events valid only on counter 3. */ case 0xBB: case 0xCD: mask = 0x8; break; + /* Any row index is ok. */ default: - mask = ~0; /* Any row index is ok. */ + mask = ~0; } return (mask & (1 << ri)); } static int -iap_event_ok_on_counter(uint8_t evsel, int ri) +iap_event_core_ok_on_counter(uint8_t evsel, int ri) { uint32_t mask; @@ -752,34 +752,41 @@ iap_allocate_pmc(int cpu, int ri, struct pmc *pm, ev = IAP_EVSEL_GET(iap->pm_iap_config); switch (core_cputype) { + case PMC_CPU_INTEL_CORE: + case PMC_CPU_INTEL_CORE2: + case PMC_CPU_INTEL_CORE2EXTREME: + if (iap_event_core_ok_on_counter(ev, ri) == 0) + return (EINVAL); case PMC_CPU_INTEL_COREI7: case PMC_CPU_INTEL_NEHALEM_EX: if (iap_event_corei7_ok_on_counter(ev, ri) == 0) return (EINVAL); break; - case PMC_CPU_INTEL_SKYLAKE: - case PMC_CPU_INTEL_SKYLAKE_XEON: - case PMC_CPU_INTEL_ICELAKE: - case PMC_CPU_INTEL_ICELAKE_XEON: - case PMC_CPU_INTEL_BROADWELL: - case PMC_CPU_INTEL_BROADWELL_XEON: + case PMC_CPU_INTEL_WESTMERE: + case PMC_CPU_INTEL_WESTMERE_EX: + if (iap_event_westmere_ok_on_counter(ev, ri) == 0) + return (EINVAL); + break; case PMC_CPU_INTEL_SANDYBRIDGE: case PMC_CPU_INTEL_SANDYBRIDGE_XEON: case PMC_CPU_INTEL_IVYBRIDGE: case PMC_CPU_INTEL_IVYBRIDGE_XEON: case PMC_CPU_INTEL_HASWELL: case PMC_CPU_INTEL_HASWELL_XEON: + case PMC_CPU_INTEL_BROADWELL: + case PMC_CPU_INTEL_BROADWELL_XEON: if (iap_event_sb_sbx_ib_ibx_ok_on_counter(ev, ri) == 0) return (EINVAL); break; - case PMC_CPU_INTEL_WESTMERE: - case PMC_CPU_INTEL_WESTMERE_EX: - if (iap_event_westmere_ok_on_counter(ev, ri) == 0) - return (EINVAL); - break; + case PMC_CPU_INTEL_ATOM: + case PMC_CPU_INTEL_ATOM_SILVERMONT: + case PMC_CPU_INTEL_ATOM_GOLDMONT: + case PMC_CPU_INTEL_SKYLAKE: + case PMC_CPU_INTEL_SKYLAKE_XEON: + case PMC_CPU_INTEL_ICELAKE: + case PMC_CPU_INTEL_ICELAKE_XEON: default: - if (iap_event_ok_on_counter(ev, ri) == 0) - return (EINVAL); + break; } pm->pm_md.pm_iap.pm_iap_evsel = iap->pm_iap_config;