From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (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 6082E3515E6 for ; Mon, 3 Aug 2026 22:46:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785797182; cv=none; b=JlP1+ZBPlAfp5Q9K0AU/Vic1G8wcVpolmMWNZw6cWMhFUaGRPHlscIsUoeG5GDejVe7tbFKH0cALg/JmnB8bnbUpotXtIEMfDXzZZD8x1aV1EsUmV84mEhBEVi5n1e7DMOBsLwOAE7vQuHjUbSw30vpvPa8ZB25ncFXVTvKDzLs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785797182; c=relaxed/simple; bh=pBNhm+7IJVXQdUQNd8MXW9Q7j9q1JS9Bk3hiwcP/hdM=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=E7Jc2Adc/aJM+B5Tk50HILTMkgJ9drFxTOrWcJxr/ADXRy7cUSzYGipT43ajitnDPjFrVdfFsLTBXf8eBzzXa9xsx8xQt1bmXFM1KXbtgWdzzwFIIG/YO88dobe6ZBGVmyJwcEt78pvQXHOy883d/a4lW95qaNPQ8gqDSgfxaTE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=dPncHTob; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=N1RAKzgV; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="dPncHTob"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="N1RAKzgV" Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 673JkpQC1580977 for ; Mon, 3 Aug 2026 22:46:18 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= ld7zw7w+D26Vm9Xh7U9t1auGYWtusnRjK8Wbc8/K4cM=; b=dPncHTobnieZCTIS aV2nCorCPU64e2QR3wyF39PfwkyWWfPb5p1zCOfcFPdEsnO5o5Fmh6j+XqtBcNBB YAuFwaBl85EaD9AJo71YhJksIrSNUj62+N55Sfav8/oqPLcPu8lqwa/ZXJM6lg6J rLI95LirSEwldK8H1vI9H9U/VMyLYigYLR2HpxThX4d199tRxmcmnubk+MwIaaPl DmbYDYZdZYu+tom7JapFKeE98l7JpdefnrortprWgcGh6p7spAI9TAVeHL3QLMeJ 7QrVT+o84Yj0iX+pAxomt0ltWQs+rFUQBjNYYoxdo3G2/Abbg3qxPfmF0i1csJZb kybqWA== Received: from mail-pg1-f199.google.com (mail-pg1-f199.google.com [209.85.215.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4fty5s99by-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 03 Aug 2026 22:46:17 +0000 (GMT) Received: by mail-pg1-f199.google.com with SMTP id 41be03b00d2f7-cbb6433e9d4so5203135a12.3 for ; Mon, 03 Aug 2026 15:46:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1785797177; x=1786401977; darn=vger.kernel.org; h=content-transfer-encoding:content-type:mime-version:organization :references:in-reply-to:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to:content-type; bh=ld7zw7w+D26Vm9Xh7U9t1auGYWtusnRjK8Wbc8/K4cM=; b=N1RAKzgVeGnWc8RpomNTpi6lQ3RD7Ix7e5HiS/esX8Et/yw6E42/SlCe3VM3XUfE8M vIZYev26xs9JJADBjacwzuR9qtyV8Sws5ZuD3fsBOBoaXpTjHJlpCbcbdg31R0ZhQyw4 SOBDcddNDCzmd6asNWLzuAWTM6MHgOhAML2Id+SzDKP0t41PkMFY86bWnRGG7p/MiiUy QKX1RrNc34XKLawD1KO8pzZ+HJ4ojMiLdM/3+ZguLWG/uOMVqrx+t4JCmvkMjN1JGBPw Vzu9A5Gv/SNOhSifoTvIH0uR/kqJCUbgA14YQw8NXvGqAHrcfkj109/FAL6wmJT98jm5 l78A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785797177; x=1786401977; h=content-transfer-encoding:content-type:mime-version:organization :references:in-reply-to:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=ld7zw7w+D26Vm9Xh7U9t1auGYWtusnRjK8Wbc8/K4cM=; b=bHtB0og8YQgdWrvHyxUETnPpbY5Pj+q9zKbzQBfyxZYSwj9z2fVdQ46lM30//lg59Y MCwfu5V2G709ngbYiK/JFaneMbM4jWFl3LF2tAhp4P45u45vLb0w2gbZyYve7LrY0C5s RWZN/j2v46GV4Kq8ju07EKEomh7Cg2dJssvDFp1BCuYkFWvyrzgEdhWYRWPpZWgtlXLE M6mg7mX03jg1hPZQGXVnfliOCZkJmYZzRuy9i1VaLWqtpRV9BHOC6D3SWvgtKgK1rC/4 7zXbPvIJwfHYhDg80CG11Fhj6qukJ1ApHI4ShLd6MW6u2eU+M/QDs/dQqR+LiDiOIU4x 585Q== X-Forwarded-Encrypted: i=1; AHgh+Rq45CVbtZSzgMyXNG5ko6Mmch7xUweZ36YNwNN8hU9OoCYdVZnpujBW0TtUt3y/5ejXAGslRDwthyLijiE=@vger.kernel.org X-Gm-Message-State: AOJu0Ywhk7Rbxf7KUnFZcglyHNHXs5UGkceuQZCAL+wzHzmY1cncIWQG WfWvEYKXdHVZwObcO6ghuW/pcgWBDJbHcmuUJjSqieCYU0SznYnjS3kjTas/OHimojIgpQ+uuYi zME2SWFI+UpqYGUlSLz3KEFCNznJYgUPrP4VBERqCxBlGS9HuYzbK2pp/ObsxHRrpQ/E= X-Gm-Gg: AR+sD101rwimSuIs4piNNLwTRszbQNx7qhEt1/sifDjaoCjiFxhyUYYne7iG5Pfmr6K ZOd+iRpvgkh6fcJ3lAkihciRNmf3PrcDTyej5/HUuCdOkvFFuvXfFvce1WYMwKouQBAbk8FOrAW 0q2HrPgCPqQ/cA27IGTK5A2QrvXteV+MiWm7pK98gBP5RI+eqP/nWx5IQmWU0+I5eWdaPpfpI/W ysE/t9MvlK9w1QiHnCbNk/9UkH5HzMeQHaTQg7SNUcIr7KpzretbBXbeUO1ZYxLC1fpOW7igKRX OjFl+BwMr/0vy+8qqswA9n5cMPoqY7nSuh9UfE7rZ6JatCodesKewtvJvUOMnwpxzxNY5t6lUMh V+vFLeL3BE6SGk51m1fANu7zBlg== X-Received: by 2002:a05:6a21:9f10:b0:3b4:931c:3c7c with SMTP id adf61e73a8af0-3c92a7bb452mr11971745637.44.1785797176781; Mon, 03 Aug 2026 15:46:16 -0700 (PDT) X-Received: by 2002:a05:6a21:9f10:b0:3b4:931c:3c7c with SMTP id adf61e73a8af0-3c92a7bb452mr11971714637.44.1785797176358; Mon, 03 Aug 2026 15:46:16 -0700 (PDT) Received: from localhost ([50.35.46.84]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-13fab2530c0sm34545273c88.8.2026.08.03.15.46.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Aug 2026 15:46:16 -0700 (PDT) Date: Mon, 3 Aug 2026 15:46:11 -0700 From: Jonathan Cameron To: Andre Przywara Cc: Lorenzo Pieralisi , Hanjun Guo , Sudeep Holla , Catalin Marinas , Will Deacon , "Rafael J . Wysocki" , Len Brown , James Morse , Ben Horgan , Reinette Chatre , Fenghua Yu , Jonathan Cameron , Srivathsa L Rao , Ganapatrao Kulkarni , Trilok Soni , Srinivas Ramana , Niyas Sait , Lee Trager , Ritwick Sharma , linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v7 10/11] arm_mpam: change MPAM-Fb error IRQ to use a threaded IRQ handler Message-ID: <20260803154611.00007d6d@oss.qualcomm.com> In-Reply-To: <20260731170324.2927758-11-andre.przywara@arm.com> References: <20260731170324.2927758-1-andre.przywara@arm.com> <20260731170324.2927758-11-andre.przywara@arm.com> Organization: Qualcomm X-Mailer: Claws Mail 4.4.0 (GTK 3.24.51; x86_64-w64-mingw32) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Authority-Analysis: v=2.4 cv=SPJykuvH c=1 sm=1 tr=0 ts=6a711a39 cx=c_pps a=Oh5Dbbf/trHjhBongsHeRQ==:117 a=qC1CW/w66vtJz1P9yTJxNA==:17 a=kj9zAlcOel0A:10 a=Sv0fKeRqtYgA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=rJkE3RaqiGZ5pbrm-msn:22 a=7CQSdrXTAAAA:8 a=EUspDBNiAAAA:8 a=ePHNPm31KbGbtx5XAOQA:9 a=CjuIK1q_8ugA:10 a=_Vgx9l1VpLgwpw_dHYaR:22 a=a-qgeE7W1pNrGK8U0ZQC:22 X-Proofpoint-ORIG-GUID: io4elpwezACQJgTTDwwvMs2ey39x-9QQ X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwODAzMDE5OSBTYWx0ZWRfXxcWtZ1jvQV9y 9lKg5XPP2ZcPAcOKgxg1z7CKh4GUThPqr/K2nam2eZq4TCWgLK7F8lT2ni3I7BWv63d4SrUVyFk SIChJicCo5jfomQmZ345YjekmCYdMUXB11bzGLMjpNUoKa+urt6LXmhn0YcpgIifd8C53YiuLpU x0KnNM08ymS0Z092FlkDN/snJUfFrF3WBfFAlhzyROWxDhrv6ZpKJF9j7te+XQl9gPEOPQNeEBJ 4gmpf1Fp+z97blOd9ooL+ZxRUU1mm4u4Jk9djaMeonldLCODVniLDBr6tT273qIVB2WQ9DdG16V Gvc9eQeYmkSuuKa3KmKQ71Ib1SUicYG4COtNORPU8LV8ejynG2ZQ9/cYoWshOvDI7JXl2GgROUf niqRG4L+9isVgge+CDF8RSzkElRce7mH9SZmNZTg4L4/D2QNwigU+IvNRKpeb6RvHhkjPO/HGbf 4Urnz0eeI59qqj9OsJQ== X-Proofpoint-Spam-Info: AW1haW4tMjYwODAzMDE5OSBTYWx0ZWRfXx+2TpKdssaEv z9Ldv0n2nM7qJxAT3FiF34HYttxC2IkuOWo1bRIwMNkBcaIykcARbZAPysJcJvYIu0xh76/Ajw+ fWTI6dVymzwRawMjoQtaKlnuEw3/+RY= X-Proofpoint-GUID: io4elpwezACQJgTTDwwvMs2ey39x-9QQ 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-03_05,2026-08-03_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 impostorscore=0 spamscore=0 phishscore=0 adultscore=0 bulkscore=0 lowpriorityscore=0 malwarescore=0 suspectscore=0 priorityscore=1501 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2608030199 On Fri, 31 Jul 2026 19:03:23 +0200 Andre Przywara wrote: > When an MPAM MSC gets into an error condition, it can trigger an error > IRQ. We cannot really do much about those errors, but we at least query > and log the error, then disable MPAM functionality. > > This error report relies on reading the MSC's error status register > (ESR) in the current hard-IRQ handler, which is not possible for MPAM-Fb > based MSC accesses, since they involve mailbox routines that might sleep. > The same is true for clearing the interrupt at the source, which requires > an MSC access as well. > > When an MSC is using MPAM-Fb, change the error IRQ to use a threaded IRQ > handler, with an empty hard IRQ routine, and doing all the MSC accesses > (to access the status and disable the IRQ line) in the threaded part. > Also forbid per-CPU interrupts (PPIs) for MPAM-Fb, as we cannot use a > threaded IRQ here. > > The change in the actual IRQ handler is minimal, we just check for the > first MSC access error and bail out early. MMIO based MSCs keep using a > hard-IRQ handler, since they must be at least non-migrate-able when doing > MSC accesses, for the CPU affinity check to work. > > Signed-off-by: Andre Przywara A small thing inline about a refactor that I can't spot a reason for. May it's one of those cases where the code evolved into something that would benefit from another look. Either way I'm fine with this Reviewed-by: Jonathan Cameron > --- > drivers/resctrl/mpam_devices.c | 52 +++++++++++++++++++++++++--------- > 1 file changed, 39 insertions(+), 13 deletions(-) > > diff --git a/drivers/resctrl/mpam_devices.c b/drivers/resctrl/mpam_devices.c > index ea08c12f717a..b238feb559d4 100644 > --- a/drivers/resctrl/mpam_devices.c > +++ b/drivers/resctrl/mpam_devices.c > @@ -2741,19 +2755,19 @@ static irqreturn_t __mpam_irq_handler(int irq, struct mpam_msc *msc) > msc->id, mpam_errcode_names[errcode], partid, pmg, > ris); > > - /* Disable this interrupt. */ > +out_disable: > + /* Disable this interrupt. Ignore errors, we need to proceed anyway. */ > mpam_disable_msc_ecr(msc); > > - /* Are we racing with the thread disabling MPAM? */ > - if (!mpam_is_enabled()) > - return IRQ_HANDLED; > - > /* > - * Schedule the teardown work. Don't use a threaded IRQ as we can't > - * unregister the interrupt from the threaded part of the handler. > + * Schedule the teardown work. We have to defer it as we can't > + * unregister the interrupt from the threaded part of a handler. > + * Check whether we are racing with the thread disabling MPAM. > */ > - mpam_disable_reason = "hardware error interrupt"; > - schedule_work(&mpam_broken_work); > + if (mpam_is_enabled()) { > + mpam_disable_reason = "hardware error interrupt"; > + schedule_work(&mpam_broken_work); > + } Why the logic flip here? (!mpam_is_enabled() and early return vs if (mpam_is_enabled()) It seems to be doing exactly the same. Is it to couple the comment more tightly with the code? I don't mind it done this way but it is a reasonable amount of churn for no strong benefit that I can immediately spot. > > return IRQ_HANDLED; > }