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 X-Spam-Level: X-Spam-Status: No, score=-14.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 317D0C4708C for ; Fri, 28 May 2021 08:11:47 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id EBDC8610FC for ; Fri, 28 May 2021 08:11:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EBDC8610FC Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=iki.fi Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=RsSdpBXibo2gtkGGOUer6AkZmkt+4140ygZu0lHdwjA=; b=VAHiIDvILae3NE CEulYc8fdl62Vd76p9SciEPBTxfaHCMK+SMyfyyR9PcSKE5e7sxGOZjq67ktw0Bf1oZnXE7BIHLsJ D/RtW2RK2Ee+4BHpo7BchVgRJ83Kyl5puZQD5KNec7TTyXm2mv6bdn6Q3yAIyGGJEEJH4LYTq37di 2EF9xVEZTAVHgc7yU5xxMP3WaW6MElI73nIrI2GduGK3fbCMnyQg8kTEIXAitdTSvRI1r1hxKGAJD x7xWyHzQej+pRw3iy4h+V+L56uHPZCLER2QGpcwWTeD/ALHlr5E0QQ4yTOeV2/fAUrHZ3dO1GHKaY L0gxocCCFDg+XqnUw1eQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lmXZR-00DIO0-67; Fri, 28 May 2021 08:10:17 +0000 Received: from fgw22-4.mail.saunalahti.fi ([62.142.5.109]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lmXZM-00DIEQ-V5 for linux-arm-kernel@lists.infradead.org; Fri, 28 May 2021 08:10:14 +0000 Received: from darkstar.musicnaut.iki.fi (85-76-82-161-nat.elisa-mobile.fi [85.76.82.161]) by fgw22.mail.saunalahti.fi (Halon) with ESMTP id 1822b824-bf8c-11eb-88cb-005056bdf889; Fri, 28 May 2021 11:10:01 +0300 (EEST) Date: Fri, 28 May 2021 11:09:58 +0300 From: Aaro Koskinen To: Jean-Philippe Brucker Cc: iommu@lists.linux-foundation.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org, linux-mm@kvack.org, mark.rutland@arm.com, kevin.tian@intel.com, jacob.jun.pan@linux.intel.com, catalin.marinas@arm.com, joro@8bytes.org, robin.murphy@arm.com, robh+dt@kernel.org, yi.l.liu@intel.com, Jonathan.Cameron@huawei.com, zhangfei.gao@linaro.org, will@kernel.org, christian.koenig@amd.com, baolu.lu@linux.intel.com Subject: Re: [PATCH v4 21/26] iommu/arm-smmu-v3: Ratelimit event dump Message-ID: <20210528080958.GA60351@darkstar.musicnaut.iki.fi> References: <20200224182401.353359-1-jean-philippe@linaro.org> <20200224182401.353359-22-jean-philippe@linaro.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200224182401.353359-22-jean-philippe@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210528_011013_206426_2E2535D8 X-CRM114-Status: GOOD ( 22.35 ) 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 Hi, On Mon, Feb 24, 2020 at 07:23:56PM +0100, Jean-Philippe Brucker wrote: > When a device or driver misbehaves, it is possible to receive events > much faster than we can print them out. Ratelimit the printing of > events. > > Signed-off-by: Jean-Philippe Brucker Tested-by: Aaro Koskinen > During the SVA tests when the device driver didn't properly stop DMA > before unbinding, the event queue thread would almost lock-up the server > with a flood of event 0xa. This patch helped recover from the error. I was just debugging a similar case, and this patch was required to prevent system from locking up. Could you please resend this patch independently from the other patches in the series, as it seems it's a worthwhile fix and still relevent for current kernels. Thanks, A. > --- > drivers/iommu/arm-smmu-v3.c | 13 ++++++++----- > 1 file changed, 8 insertions(+), 5 deletions(-) > > diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c > index 28f8583cd47b..6a5987cce03f 100644 > --- a/drivers/iommu/arm-smmu-v3.c > +++ b/drivers/iommu/arm-smmu-v3.c > @@ -2243,17 +2243,20 @@ static irqreturn_t arm_smmu_evtq_thread(int irq, void *dev) > struct arm_smmu_device *smmu = dev; > struct arm_smmu_queue *q = &smmu->evtq.q; > struct arm_smmu_ll_queue *llq = &q->llq; > + static DEFINE_RATELIMIT_STATE(rs, DEFAULT_RATELIMIT_INTERVAL, > + DEFAULT_RATELIMIT_BURST); > u64 evt[EVTQ_ENT_DWORDS]; > > do { > while (!queue_remove_raw(q, evt)) { > u8 id = FIELD_GET(EVTQ_0_ID, evt[0]); > > - dev_info(smmu->dev, "event 0x%02x received:\n", id); > - for (i = 0; i < ARRAY_SIZE(evt); ++i) > - dev_info(smmu->dev, "\t0x%016llx\n", > - (unsigned long long)evt[i]); > - > + if (__ratelimit(&rs)) { > + dev_info(smmu->dev, "event 0x%02x received:\n", id); > + for (i = 0; i < ARRAY_SIZE(evt); ++i) > + dev_info(smmu->dev, "\t0x%016llx\n", > + (unsigned long long)evt[i]); > + } > } > > /* _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel