From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 094F83AD525; Fri, 7 Aug 2026 08:39:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786091966; cv=none; b=MqvwvQJFjpDG0vAOTIU5tOTnVGRptKWLFeSKz5hu/HsMBIyNPt8TeLj5zbCUvu82L5gkKD/aNIwWIhGSXwN99s+66HmZPYUkL/k/GJQAiHizWcrflVhJisINK7RmUYKIKRfZVAc1E6+ou5DExUn2eCyUkYHzesWnVd/6rzPCqGg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786091966; c=relaxed/simple; bh=ORNhnNa1yrlk5BbvInAyuwic6oBEUIZYee628yn+fRg=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=BydkJEVdd/HNEL75Cy2kz7orSS1sMOjEfd8YcsSP3Pdu5geYsMPjmPbGRlO924Z89ASHT22D1qsc1bNsiucm7iJrC4o2FqYPkFQ95CBHvbkdzgHHcoY5qRhau9lvo2NnPEJ8SVWL/wN3cd/0LcthUU7nigM4xB3ebBp9gdVG4x4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=bjSjnGpp; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="bjSjnGpp" Received: from pps.filterd (m0356517.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6770Hqcc4161784; Fri, 7 Aug 2026 08:39:24 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:message-id:mime-version :subject:to; s=pp1; bh=DDTYCSbomh/XQqRXAaHio1dGVQcBmAnmIX9JzDzNl /Q=; b=bjSjnGppJ3TiHB2vTkYUpR4Qw46xaUJdWfdF+R5IEAcJV6QNLqnefRPBL 9LcJuxLyoy/zYtSUImMFtkYGXlkpZEPNb+ESynmwYIL7+ZA7t9S5B/iDyIteF3KT mti3gjA0KyLAtUySbM/vtKkEyxcJ6dDlCeyM1zwiiY4v6nUURmAznAzMvwXVZ53Q Gnxd6ciqJpK5rndowg5eW9MSjakLGFCPcQfIdAWGHN8Wv5worduy0Tra1f9p+7ro XKFerf1MLY6AMyaeagvPsq4tFi2JylW/ltYNYbnN4QQQChNrYcHpZoEeDfXUWHqL 8+XZavxaWdVNjuW44VYFKMVmv9bzQ== Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4fvxyyu25u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 07 Aug 2026 08:39:24 +0000 (GMT) Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 6778QKZi015385; Fri, 7 Aug 2026 08:39:23 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4fsv4kf03r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 07 Aug 2026 08:39:18 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 6778dEGv42729734 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 7 Aug 2026 08:39:14 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AF8D22004E; Fri, 7 Aug 2026 08:39:14 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 976522004D; Fri, 7 Aug 2026 08:39:14 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.87.85.9]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 7 Aug 2026 08:39:14 +0000 (GMT) From: Thomas Richter To: linux-s390@vger.kernel.org Cc: Thomas Richter , stable@vger.kernel.org Subject: [PATCH 1/2] s390/pai: Use PAI PMU index as parameter replacing event Date: Fri, 7 Aug 2026 10:39:08 +0200 Message-ID: <20260807083910.3771502-1-tmricht@linux.ibm.com> X-Mailer: git-send-email 2.53.0 Precedence: bulk X-Mailing-List: linux-s390@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Authority-Analysis: v=2.4 cv=SYrHsPRu c=1 sm=1 tr=0 ts=6a7599bc cx=c_pps a=GFwsV6G8L6GxiO2Y/PsHdQ==:117 a=GFwsV6G8L6GxiO2Y/PsHdQ==:17 a=Sv0fKeRqtYgA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=U7nrCbtTmkRpXpFmAIza:22 a=VwQbUJbxAAAA:8 a=VnNF1IyMAAAA:8 a=JMlX-6JAepFCzwN66roA:9 X-Proofpoint-Spam-Info: AW1haW4tMjYwODA3MDA2MSBTYWx0ZWRfX5VIg24OX1Gy2 E+khhdXTGcFDL4cs1UZ66wCqaGtfqlT4I2a635tWHuvwcLmEdrk1LoMEnUcryi9P+n99hyKWtoy vEETzPc4CnS27NbGrq++741KfePPb4A= X-Proofpoint-ORIG-GUID: q_VsW9AVVuoKOxGiN-bY4K--hjEz-c5F X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwODA3MDA2MSBTYWx0ZWRfX/qT8MxuiVopO uSlSUov0OemQQCx94x92HdE+LQCml8vfYAfLK6Sn95SPjgs1lnJ72d7kGE7Cbzmtfy8+vTZYcLc B3asthACWsmmxfA7Th4KB1yvz6/mV/29tR89vgc7j9mPdKtl+bXU16IKo8DaV8gQEMSDdZ5fPi6 n7V+iJJidKFIAfu0gdV0+Xis1BgtfXcz2OjsI9dLN3Uq1OzXnNOgAeXvxK8Z6yx4dtjysP3isL4 H+E3tJXBfvB7U6CGVJPRsJFjDCT3mZ80z9pEJ/dRr2YS727BY/SS0vUAxtpMn4GQ3TZNCipYdr6 AL7gQRE/dErb5AFZbITK9zbZANgc4e+vSpCWfiTb1cpMGrWtlbmvmgwFRz64LAIFEUPn98is5Z/ CRKlm9aUU1+WHQ6XScHwROgIg5tTZ/8QvslTVB1JDuIs2uojvHDVk6lcyIDoyDOEfaCLjFAgyY3 1tiNKQYDmTlQ7byWvng== X-Proofpoint-GUID: q_VsW9AVVuoKOxGiN-bY4K--hjEz-c5F X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-08-07_01,2026-08-06_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1011 malwarescore=0 priorityscore=1501 lowpriorityscore=0 suspectscore=0 bulkscore=0 impostorscore=0 phishscore=0 spamscore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2608070061 Use PAI PMU index value as function argument instead of pointer to struct perf_event. Only that index value is used inside functions pai_alloc_cpu() and pai_event_destroy_cpu(). No functional change. Cc: stable@vger.kernel.org Signed-off-by: Thomas Richter --- arch/s390/kernel/perf_pai.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/arch/s390/kernel/perf_pai.c b/arch/s390/kernel/perf_pai.c index cdb8006220ca..7c13f5586c79 100644 --- a/arch/s390/kernel/perf_pai.c +++ b/arch/s390/kernel/perf_pai.c @@ -140,16 +140,14 @@ static void pai_free(struct pai_mapptr *mp) /* Adjust usage counters and remove allocated memory when all users are * gone. */ -static void pai_event_destroy_cpu(struct perf_event *event, int cpu) +static void pai_event_destroy_cpu(int idx, int cpu) { - int idx = PAI_PMU_IDX(event); struct pai_mapptr *mp = per_cpu_ptr(pai_root[idx].mapptr, cpu); struct pai_map *cpump = mp->mapptr; mutex_lock(&pai_reserve_mutex); - debug_sprintf_event(paidbg, 5, "%s event %#llx idx %d cpu %d users %d " - "refcnt %u\n", __func__, event->attr.config, idx, - event->cpu, cpump->active_events, + debug_sprintf_event(paidbg, 5, "%s users %d refcnt %u\n", + __func__, cpump->active_events, refcount_read(&cpump->refcnt)); if (refcount_dec_and_test(&cpump->refcnt)) pai_free(mp); @@ -159,17 +157,17 @@ static void pai_event_destroy_cpu(struct perf_event *event, int cpu) static void pai_event_destroy(struct perf_event *event) { - int cpu; + int cpu = 0, idx = PAI_PMU_IDX(event); free_page(PAI_SAVE_AREA(event)); if (event->cpu == -1) { struct cpumask *mask = PAI_CPU_MASK(event); for_each_cpu(cpu, mask) - pai_event_destroy_cpu(event, cpu); + pai_event_destroy_cpu(idx, cpu); kfree(mask); } else { - pai_event_destroy_cpu(event, event->cpu); + pai_event_destroy_cpu(idx, event->cpu); } } @@ -241,12 +239,12 @@ static u64 paicrypt_getall(struct perf_event *event) * * Allocate the memory for the event. */ -static int pai_alloc_cpu(struct perf_event *event, int cpu) +static int pai_alloc_cpu(int idx, int cpu) { - int rc, idx = PAI_PMU_IDX(event); struct pai_map *cpump = NULL; bool need_paiext_cb = false; struct pai_mapptr *mp; + int rc; mutex_lock(&pai_reserve_mutex); /* Allocate root node */ @@ -318,6 +316,7 @@ static int pai_alloc_cpu(struct perf_event *event, int cpu) static int pai_alloc(struct perf_event *event) { + int idx = PAI_PMU_IDX(event); struct cpumask *maskptr; int cpu, rc = -ENOMEM; @@ -326,10 +325,10 @@ static int pai_alloc(struct perf_event *event) goto out; for_each_online_cpu(cpu) { - rc = pai_alloc_cpu(event, cpu); + rc = pai_alloc_cpu(idx, cpu); if (rc) { for_each_cpu(cpu, maskptr) - pai_event_destroy_cpu(event, cpu); + pai_event_destroy_cpu(idx, cpu); kfree(maskptr); goto out; } @@ -392,7 +391,7 @@ static int pai_event_init(struct perf_event *event, int idx) } if (event->cpu >= 0) - rc = pai_alloc_cpu(event, event->cpu); + rc = pai_alloc_cpu(idx, event->cpu); else rc = pai_alloc(event); if (rc) { -- 2.55.0