Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp1396039pxb; Fri, 10 Sep 2021 05:09:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzn5a4UF+woo/fwW9H6+bBqiULLcVVKrWBXPeVv424oml/IX+lyQrxcPUJ2n5+PbVsewp9d X-Received: by 2002:a17:906:b10d:: with SMTP id u13mr8347904ejy.135.1631275744051; Fri, 10 Sep 2021 05:09:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631275744; cv=none; d=google.com; s=arc-20160816; b=YVuNheTU6wpugxtvFPRKtXW7lEHij9b8jGGlijO9hiMvQNpipytDU9o8Sw1xgJs2mX C8HD+Tp8xhc25wyHRhJtwKBvadZY8x50KVXZyXHf/P9oS/CwfWSKr4F8ayHYF0V5b4E3 61C8rvYkquipRVz2H2IHp1abhEVhpSNVZKyyNSqIg0SKqL98HSfgsbBDGBteYiK//7aa Q0GbW7fNu9NPxf+4okEePukGfP3OvUGBmcwrdxIGH4eDjPx+1EQz3mVup5UBEQoCRhJX jv4l4nn9SgCTn1xiON26wR1MwjpugUMdiRDEQsgFbRO0RFUKAb6lULuDBY8JLGYGRDka Q5Ug== 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 :message-id:date:subject:cc:to:from; bh=E9ucPmbn7oNv717pRqx3VMEoO90SgbKPBueLFU8AbO4=; b=x9xuEJHKoWK7sEAdasEKtqANGoeFMfzP2Jc65TR4XgH8fHJQlO/p5mBjtF91n0UgDW 7jQshki917E5WO7rMGF0sUSV4NahOJP4ZlOSMnbEBNWGKMWyvYU03NVpouOiWPKQGXOL 3Ec5NCwCr+0uCSkhsQoxgKYW3XmxOh/NGMTWpBlJx1nsm9z3wrGKXkTVM4vFn1D6rnot P4g2wC6mYWDxJsYeK0CPr0OGT5w3kl1uylmqGIdZnzKghlIjHZz+rPj6T5SLSQV1trAi PfVUw7+chGjz/3opz3I07DtL3f7ZIBqZTUF8055lfaibi/M+1RXXuQX7DBuCH942mx/F aZww== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f5si5404689ejj.587.2021.09.10.05.07.47; Fri, 10 Sep 2021 05:09:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232987AbhIJMHM (ORCPT + 99 others); Fri, 10 Sep 2021 08:07:12 -0400 Received: from h4.fbrelay.privateemail.com ([131.153.2.45]:43104 "EHLO h4.fbrelay.privateemail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232873AbhIJMHL (ORCPT ); Fri, 10 Sep 2021 08:07:11 -0400 Received: from MTA-13-3.privateemail.com (mta-13-1.privateemail.com [198.54.122.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by h3.fbrelay.privateemail.com (Postfix) with ESMTPS id 3445F80C6B for ; Fri, 10 Sep 2021 08:05:59 -0400 (EDT) Received: from mta-13.privateemail.com (localhost [127.0.0.1]) by mta-13.privateemail.com (Postfix) with ESMTP id D2EE2180016B; Fri, 10 Sep 2021 08:05:57 -0400 (EDT) Received: from hal-station.. (unknown [10.20.151.212]) by mta-13.privateemail.com (Postfix) with ESMTPA id 0068B180015C; Fri, 10 Sep 2021 08:05:56 -0400 (EDT) From: Hamza Mahfooz To: linux-kernel@vger.kernel.org Cc: Hamza Mahfooz , Jeremy Linton , Christoph Hellwig , Marek Szyprowski , Robin Murphy , iommu@lists.linux-foundation.org Subject: [PATCH] dma-debug: prevent an error message from causing runtime problems Date: Fri, 10 Sep 2021 08:05:41 -0400 Message-Id: <20210910120541.39938-1-someguy@effective-light.com> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Virus-Scanned: ClamAV using ClamSMTP Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org For some drivers, that call add_dma_entry() from somewhere down the call stack. If this error condition is triggered once, it causes the error message to spam the kernel's printk buffer and bring the CPU usage up to 100%. Also, since there is at least one driver that is in the mainline and suffers from the error condition, it is more useful to WARN_ON() here instead of just printing the error message (in hopes that it will make it easier for other drivers that suffer from this issue to be spotted). Link: https://lkml.kernel.org/r/fd67fbac-64bf-f0ea-01e1-5938ccfab9d0@arm.com Reported-by: Jeremy Linton Signed-off-by: Hamza Mahfooz --- kernel/dma/debug.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kernel/dma/debug.c b/kernel/dma/debug.c index 6c90c69e5311..d9806689666e 100644 --- a/kernel/dma/debug.c +++ b/kernel/dma/debug.c @@ -567,7 +567,9 @@ static void add_dma_entry(struct dma_debug_entry *entry) pr_err("cacheline tracking ENOMEM, dma-debug disabled\n"); global_disable = true; } else if (rc == -EEXIST) { - pr_err("cacheline tracking EEXIST, overlapping mappings aren't supported\n"); + WARN_ONCE(1, + pr_fmt("cacheline tracking EEXIST, overlapping mappings aren't supported\n" + )); } } -- 2.33.0