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 B915EC2B9F7 for ; Fri, 28 May 2021 16:27:57 +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 6E8F661184 for ; Fri, 28 May 2021 16:27:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6E8F661184 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org 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=k+5tpnhwIwrd6oUxZGueyuOvRbsCIJP6lLZ3guKUZPw=; b=ZPcDMr6ZwYIsc3 Hoh9C0OLRx3E8mxYWxsDJ/0hR9zQf/EXojJJ18Vepu1BQ5ZsCF+wH48xpAhIvhypijXHQXefDj+e2 ybkOOQF66359EK06TNo/sxjsEN52zn1idO578aBPazXaCz1bjwnvAsP8rUbEfhfgdjU8tssn8fHK6 FOjP9dG7M1Dz9bsucz/itII6chPxb0Mdmrln4AGG3X/Z5axBec7U/elJg5YLPuy9DG2Bm0YPg5YVS kfOFgFdDt1W4GxyNXDeF5IPrzPRFvXNHc4KQxTwWHnMitLgmU90/EjFkyeGy/xC+s2yFRJuXCCx/Q QGE/G7MGZJQLRvyrpOjw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lmfJY-00Gzqo-0N; Fri, 28 May 2021 16:26:24 +0000 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lmfJN-00Gznx-IM for linux-arm-kernel@lists.infradead.org; Fri, 28 May 2021 16:26:15 +0000 Received: by mail-wm1-x32e.google.com with SMTP id f75-20020a1c1f4e0000b0290171001e7329so2733805wmf.1 for ; Fri, 28 May 2021 09:26:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=TKWYuy5e1a7MVcCONh10ek8WRVjfZhF24M6h3yAlFXg=; b=uAqk1rGnr4Zx8fqad9xCVt+J0mKPcTq7ssobuwqr0/V87yyJQtgkrWC0PF+2ZNSBCb XhlqvW8R38UvTKfuOKYM4U8FjttA+LC319F73dSL2q1oaYiHyl7IFHQNfRzJB6DEvkCr WBw9ERFllz9dAcVcDTtX6ixI8TGNFWs238R37lTFFMtTOgTsQKuif183pW6vIxDO6VrH IRc4pSRlEhHlW2GtyTtJFQZfwKxMIXcFohGmeP3RYGw9cswseI0c/VNWQS84ydjxRq7P KYaUwyTPqXmkvbyZ5Yb7FITQtQ1OKuIY1PlKlZY0Rf2OgiVaMGN8ylcKefQSE0fsHzW/ Dw8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=TKWYuy5e1a7MVcCONh10ek8WRVjfZhF24M6h3yAlFXg=; b=gcc9UlpHmcwpTc2eKdo7FIx+1PxZHV3XvhYUkyWbDQhw2waZizmOOzOvjWxcwf4Xih I2XiATu1ZLbgShPsu/Rp/VlFJ/sm0BQ2jc9wQeCyjJHwwOiFnWJ2NuVF+LuRljoK2ITk ohmCBLecTlcJzm0TT5FOHS/UG7g+4fmJ0hHpUKRp4CiKsU3kSxKoBF2gaj7V6qdHII+M KisF5eppF7h2N/RkeZelMEhVd6nR+aEmemFqGQGVwPBwu8wzBMqU5//qBKEGJzPnK1Ns Z5pGlKbOjp8qkdy+q+/wJ+j7fjO0xEyBco48vUh54pX1Itc7it3dFllfgrhWnc85IyPf fC1g== X-Gm-Message-State: AOAM531FSg6dSVoxExvNjIpr2Q8M4DqtmEbHq0g0LqFXlUHLgEc+WnoV dPg6tLU592MkyS0/3gjehkNNAQ== X-Google-Smtp-Source: ABdhPJyD6eRonZHgh1jOYg+fLrjyl1AjpTN9fePZXHfySYYUG9aFbvN7EU/RT7evtxyZw9yAjqjYDw== X-Received: by 2002:a05:600c:1909:: with SMTP id j9mr9652038wmq.100.1622219171653; Fri, 28 May 2021 09:26:11 -0700 (PDT) Received: from myrica (adsl-84-226-106-126.adslplus.ch. [84.226.106.126]) by smtp.gmail.com with ESMTPSA id b15sm7953338wru.64.2021.05.28.09.26.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 May 2021 09:26:11 -0700 (PDT) Date: Fri, 28 May 2021 18:25:52 +0200 From: Jean-Philippe Brucker To: Aaro Koskinen 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: References: <20200224182401.353359-1-jean-philippe@linaro.org> <20200224182401.353359-22-jean-philippe@linaro.org> <20210528080958.GA60351@darkstar.musicnaut.iki.fi> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210528080958.GA60351@darkstar.musicnaut.iki.fi> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210528_092613_657096_1D092027 X-CRM114-Status: GOOD ( 30.46 ) 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 Aaro, On Fri, May 28, 2021 at 11:09:58AM +0300, Aaro Koskinen wrote: > 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, Ok, I'll resend it Thanks, Jean > > 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