From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9E335C6FD18 for ; Wed, 29 Mar 2023 12:37:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Content-ID:In-Reply-To: References:Message-ID:Date:Subject:CC:To:From:Reply-To:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=lohKG0ux0EGOflYgQDa7EMnnDqfy42dI+p5sNWEzh/E=; b=3NG96wAjFtEZHF 4UF44zkxa7TOgSISmjTcGYnjmz58zF+13ZXeXherW7Gh1XcpLYrB4f3ESjdOgGV1WT2sPQapjztak Qc3KyRi9tWrkrU0qpL9OOmrYvtjy/tSMsolzYeusOcwfeaky9nasIeYFZkMJQXdqQlLec3nDbJT1K c6IuB/xwn//JVsnVroAKMoFEDfAZorJ/lqE23M8FfgbnCky4Z1INxLk986PeH0cjKPS7JbkH9qhbh 2rdIEqJwGTGEniy5+QP9tBHNRfgM/ol+4zW5/puf2uXoXVzg6f0FnpSZu1bUwZIls4TL/0h7L+GPo xWoj9AXGT5EJy+2wxGaA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1phV2g-000Cgi-02; Wed, 29 Mar 2023 12:36:42 +0000 Received: from smtp-fw-9103.amazon.com ([207.171.188.200]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1phV2d-000Cf0-0B for linux-arm-kernel@lists.infradead.org; Wed, 29 Mar 2023 12:36:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.de; i=@amazon.de; q=dns/txt; s=amazon201209; t=1680093399; x=1711629399; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:mime-version: content-transfer-encoding; bh=9BIVQAV7qt8Ug8zbs5YPptmgYpUt2pDKa6KaSVzh8Lo=; b=ZLMhLBK2TXqp1wYqoTSywf5ul24KOKI1IaQF6PK0BH8LwICo/Oejwyqq MGPO9ecnK6KsOKg/Q61A8B9fCHqT4FkA+5Or6YqGJ1gRb0GwnG1WMRZmB wDKbRigf1YUoZM7jQm3m/Y5kLn6cjotR70ycH5y+wq36x90fZVVmX39CH c=; X-IronPort-AV: E=Sophos;i="5.98,300,1673913600"; d="scan'208";a="1117495953" Received: from pdx4-co-svc-p1-lb2-vlan3.amazon.com (HELO email-inbound-relay-pdx-2c-m6i4x-fad5e78e.us-west-2.amazon.com) ([10.25.36.214]) by smtp-border-fw-9103.sea19.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Mar 2023 12:36:28 +0000 Received: from EX19D020EUA004.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan3.pdx.amazon.com [10.236.137.198]) by email-inbound-relay-pdx-2c-m6i4x-fad5e78e.us-west-2.amazon.com (Postfix) with ESMTPS id 2FBF7A02EB; Wed, 29 Mar 2023 12:36:28 +0000 (UTC) Received: from EX19D030EUC004.ant.amazon.com (10.252.61.164) by EX19D020EUA004.ant.amazon.com (10.252.50.56) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Wed, 29 Mar 2023 12:36:27 +0000 Received: from EX19D030EUC004.ant.amazon.com (10.252.61.164) by EX19D030EUC004.ant.amazon.com (10.252.61.164) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.1118.26; Wed, 29 Mar 2023 12:36:26 +0000 Received: from EX19D030EUC004.ant.amazon.com ([fe80::f98a:db18:b0eb:477]) by EX19D030EUC004.ant.amazon.com ([fe80::f98a:db18:b0eb:477%3]) with mapi id 15.02.1118.026; Wed, 29 Mar 2023 12:36:26 +0000 From: "Krcka, Tomas" To: Will Deacon CC: "Krcka, Tomas" , "linux-arm-kernel@lists.infradead.org" , Robin Murphy , Joerg Roedel , Lu Baolu , "Shameer Kolothum" , "iommu@lists.linux.dev" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] iommu/arm-smmu-v3: Fix event queue overflow acknowledgment Thread-Topic: [PATCH] iommu/arm-smmu-v3: Fix event queue overflow acknowledgment Thread-Index: AQHZYjsUJTyLbHuMvUep4ekJH0WoLQ== Date: Wed, 29 Mar 2023 12:36:26 +0000 Message-ID: References: <20230308092048.71390-1-krckatom@amazon.de> <20230327121234.GA31342@willie-the-truck> <8845FA6A-45F1-4090-B4A2-C0C28F709095@amazon.com> <20230328115613.GB1159@willie-the-truck> In-Reply-To: <20230328115613.GB1159@willie-the-truck> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.1.213.23] Content-ID: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230329_053639_237631_B0D60BBE X-CRM114-Status: GOOD ( 16.72 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org > On 28. Mar 2023, at 13:56, Will Deacon wrote: > > > On Tue, Mar 28, 2023 at 07:13:52AM +0000, Krcka, Tomas wrote: >> >>> On 27. Mar 2023, at 14:12, Will Deacon wrote: >>> >>> >>> On Wed, Mar 08, 2023 at 09:20:47AM +0000, Tomas Krcka wrote: >>>> When an overflow occurs in the event queue, the SMMU toggles overflow >>>> flag OVFLG in the PROD register. >>>> The evtq thread is supposed to acknowledge the overflow flag by toggling >>>> flag OVACKFLG in the CONS register, otherwise the overflow condition is >>>> still active (OVFLG != OVACKFLG). >>>> >>>> Currently the acknowledge register is toggled after clearing the event >>>> queue but is never propagated to the hardware. It would be done next >>>> time when executing evtq thread. >>>> >>>> The SMMU still adds elements to the queue when the overflow condition is >>>> active but any subsequent overflow information after clearing the event >>>> queue will be lost. >>>> >>>> This change keeps the SMMU in sync as it's expected by design. >>>> >>>> Signed-off-by: Tomas Krcka >>>> Suggested-by: KarimAllah Ahmed >>>> --- >>>> drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 1 + >>>> 1 file changed, 1 insertion(+) >>>> >>>> diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c >>>> index f2425b0f0cd6..acc1ff5ff69b 100644 >>>> --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c >>>> +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c >>>> @@ -1579,6 +1579,7 @@ static irqreturn_t arm_smmu_evtq_thread(int irq, void *dev) >>>> /* Sync our overflow flag, as we believe we're up to speed */ >>>> llq->cons = Q_OVF(llq->prod) | Q_WRP(llq, llq->cons) | >>>> Q_IDX(llq, llq->cons); >>>> + queue_sync_cons_out(q); >>>> return IRQ_HANDLED; >>>> } >>> >>> I think I probably did mean to have something like this, but can we >>> only do the actual h/w update if overflow has occurred? Otherwise I think >>> we're pointlessly writing back the same value most of the time. >>> >>> Will >> >> Yes, we can, but then same applies for the priq as well, there we also write back >> every time. > > Sure, feel free to update both. > OK, I sent it as new patch: https://lore.kernel.org/lkml/20230329123420.34641-1-tomas.krcka@gmail.com Amazon Development Center Germany GmbH Krausenstr. 38 10117 Berlin Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B Sitz: Berlin Ust-ID: DE 289 237 879 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel