From patchwork Thu Aug 1 10:53:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Heimes X-Patchwork-Id: 1967616 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WZQnh5Z70z1ybX for ; Thu, 1 Aug 2024 20:54:16 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1sZTRa-0001ge-Kh; Thu, 01 Aug 2024 10:54:02 +0000 Received: from smtp-relay-canonical-0.internal ([10.131.114.83] helo=smtp-relay-canonical-0.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1sZTRY-0001fy-HA for kernel-team@lists.ubuntu.com; Thu, 01 Aug 2024 10:54:00 +0000 Received: from T570.fritz.box (2.general.fheimes.us.vpn [10.172.66.67]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-0.canonical.com (Postfix) with ESMTPSA id 7E9F941006 for ; Thu, 1 Aug 2024 10:53:59 +0000 (UTC) From: frank.heimes@canonical.com To: kernel-team@lists.ubuntu.com Subject: [SRU][N][J][PATCH 0/1] s390/cpum_cf: make crypto counters upward compatible (LP: 2074380) Date: Thu, 1 Aug 2024 12:53:53 +0200 Message-Id: <20240801105355.547635-1-frank.heimes@canonical.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" BugLink: https://bugs.launchpad.net/bugs/2074380 SRU Justification: [ Impact ] * The CPU Measurement Facility (CPU MF) crypto counter set is not listed in the device sysfs tree - it's not exported in the sysfs directory /sys/devices/cpum_cf/events. * The attribute files for each CPU-MF counter defined in the crypto counter set is missing. * This is caused by the counter second version number of CPU MF hardware being incremented on new machines. * This causes a sanity check to fail, but the counters are supported by hardware. * The solution is to remove the upper limit in counter second version number check. [ Fix ] * f10933cbd2df f10933cbd2dfddf6273698a45f76db9bafd8150f "s390/cpum_cf: make crypto counters upward compatible across machine types" * The fix was upstream accepted with kernel v6.10(-rc1). * Upstream commit applies cleanly on noble master-next, but needed to be backported to jammy master-next due to different code and context in kernel 5.15. [ Test Plan ] * Run the following commands on a new machine generation: (hence only doable by IBM) # ls -l /sys/devices/cpum_cf/events/ | grep AES * If the output is empty than this patch is required. * With a patched kernel the output should be like: # ls /sys/devices/cpum_cf/events/ | grep AES AES_BLOCKED_CYCLES AES_BLOCKED_FUNCTIONS AES_CYCLES AES_FUNCTIONS [ Where problems could occur ] * This affects s390x only - CPU MF is s390-specific, and only s390 specific code is modified. * And it furthermore is limited to the crypto counter set of CPU MF. * So any impact is likely limited to hardware crypto counters on s390x only. * In s390/kernel/perf_cpum_cf.c the else if case got changed from explicitly checking for 6 or 7 to >= 6 which seems to require attention for future 8 and more cases. * In s390/kernel/perf_cpum_cf_events.c the switch (ci.csvn) statement was changed to an if / else if with similar logic. Again attentioin for any potential future cases >= 8. * It does not look like currently used cases (1..5 and 6..7) are affected by the modification, just >7. * Test build of patched jammy and noble s390x kernels were build and are avaiable here: https://launchpad.net/~fheimes/+archive/ubuntu/lp2074380 [ Other Info ] * Since the code/fix was upstream accepted with kernel v6.10(-rc1) it does not affect the current development release oracular. * This SRU can also be seen under the umbrella of new hardware enablement. * Since it requires special hw, the verification needs to be done by IBM. Thomas Richter (1): s390/cpum_cf: make crypto counters upward compatible across machine types arch/s390/kernel/perf_cpum_cf.c | 2 +- arch/s390/kernel/perf_cpum_cf_events.c | 11 +++-------- 2 files changed, 4 insertions(+), 9 deletions(-) Acked-by: Kevin Becker Acked-by: Manuel Diewald Acked-by: Andrei Gherzan