Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2140460iof; Tue, 7 Jun 2022 21:06:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz+OZmVd+M27Pb9S5SdjPJ7GM02pSXKJyX2yEQaA33GF6QuLvIgbWZpb3pFRZpydJuDumBy X-Received: by 2002:a17:90b:33c4:b0:1e8:6e2f:97a2 with SMTP id lk4-20020a17090b33c400b001e86e2f97a2mr18635473pjb.165.1654661167960; Tue, 07 Jun 2022 21:06:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654661167; cv=none; d=google.com; s=arc-20160816; b=X7m6BN1L3DprV5Wg8e76PlOuc4xMfSiLeHKexTTXcMcCeZFft1bpznbHowtPLbgEZ8 W5iRFNutISpL7+RwN9grPJoQMWsyNxTZG6PRnbywP8w0s6uxX7H3TyRQ/tsXTHVGzAtf l4psonFcgIgDLcrBkkdrqlnpwXhsbU/ah+uYW5n1iI8X0Q0y3NwVLmfA2gEiKt9ifiov 0Q7U/eVSOvccC4X4g0JIulChrmbwx2W7TicNHFsJU37r66Wn9ghRKus81IZJCQcn+t3r nqdn1tF8g4lvah16inqmZVcQEFkVi6ZeJnZlR8xPpKMemwuZRCH10oCgmnY7VP3kCrj3 uvCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Sc3Ch1jqOB9BC5taQLm2O4SFTYqzHvqz0cX/Pt86Ncs=; b=c+G6suwggbAWYCbkCiSs9fDfjLowhZtWRrKP7Ux++imV7d1i7xkh5vX7EEMfekJuL/ 5JSaUrQGzzN0edgdn9C60uNmEm77IKu5547JRzt4g3AtJ2cro/wGUVfNXhE+bydOck37 f7RdxRj60gLjwc8uU/c4xa5HZcM/l29fqZ+rIOiNL+m/9v2f8/r9DXU0r0v7M5APKmvk 3QlG/KA6yPCOLTON1kdo46FT+eVmAAPbRuHs99Y7PfSUbQaZ9mrKJy5tBdYo+zoDLkMH hVcHornsCiyhr8PaoGjGYSyXwEU+pWcZRvq7321E5VMhSU44HSjRx2RAwSb3bwufyBIB g4GA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fSITIXX7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id t20-20020a170902dcd400b0015ee6096fadsi23041277pll.69.2022.06.07.21.06.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 21:06:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fSITIXX7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 46EE018E469; Tue, 7 Jun 2022 20:32:18 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379478AbiFGVKE (ORCPT + 99 others); Tue, 7 Jun 2022 17:10:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359646AbiFGUMe (ORCPT ); Tue, 7 Jun 2022 16:12:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91FDF1C5921; Tue, 7 Jun 2022 11:27:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DA98F611B9; Tue, 7 Jun 2022 18:27:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E0865C34115; Tue, 7 Jun 2022 18:27:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654626476; bh=5zi0ii18pv0zr56W5a+6dxpkRvGeXuRNrtuobf/2g84=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fSITIXX7Z9BnzyHutVS8hKPhSNA1DABqnktpB+vh0vc/7anDGY2GAOwyj8a+o8Pjs Z3nk/esN3pnKj2OACBxFr1q+PfiHcnGMTqOexgKizx5qoibl4EMLFAbiipCd7qsNWN Nwc8OrQfC58Uqq2R+a/OPirYESRKdCc9SIF4pa+w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Rutland , Marc Zyngier , Thomas Gleixner , Will Deacon , Sasha Levin Subject: [PATCH 5.17 393/772] irqchip/gic-v3: Ensure pseudo-NMIs have an ISB between ack and handling Date: Tue, 7 Jun 2022 18:59:45 +0200 Message-Id: <20220607165000.592846383@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607164948.980838585@linuxfoundation.org> References: <20220607164948.980838585@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mark Rutland [ Upstream commit adf14453d2c037ab529040c1186ea32e277e783a ] There are cases where a context synchronization event is necessary between an IRQ being raised and being handled, and there are races such that we cannot rely upon the exception entry being subsequent to the interrupt being raised. We identified and fixes this for regular IRQs in commit: 39a06b67c2c1256b ("irqchip/gic: Ensure we have an ISB between ack and ->handle_irq") Unfortunately, we forgot to do the same for psuedo-NMIs when support for those was added in commit: f32c926651dcd168 ("irqchip/gic-v3: Handle pseudo-NMIs") Which means that when pseudo-NMIs are used for PMU support, we'll hit the same problem. Apply the same fix as for regular IRQs. Note that when EOI mode 1 is in use, the call to gic_write_eoir() will provide an ISB. Fixes: f32c926651dcd168 ("irqchip/gic-v3: Handle pseudo-NMIs") Signed-off-by: Mark Rutland Cc: Marc Zyngier Cc: Thomas Gleixner Cc: Will Deacon Signed-off-by: Marc Zyngier Link: https://lore.kernel.org/r/20220513133038.226182-2-mark.rutland@arm.com Signed-off-by: Sasha Levin --- drivers/irqchip/irq-gic-v3.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c index 907af63d1bba..3e3afb30de50 100644 --- a/drivers/irqchip/irq-gic-v3.c +++ b/drivers/irqchip/irq-gic-v3.c @@ -654,6 +654,9 @@ static inline void gic_handle_nmi(u32 irqnr, struct pt_regs *regs) if (static_branch_likely(&supports_deactivate_key)) gic_write_eoir(irqnr); + else + isb() + /* * Leave the PSR.I bit set to prevent other NMIs to be * received while handling this one. -- 2.35.1