Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp1431311pxb; Fri, 10 Sep 2021 05:57:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy20lWvI5tQ+ru067QmK1ASANhnaHT2Q4tiDUDIvQWL8tliU9dKEK0LhxAu2lUce/3RyXcN X-Received: by 2002:a17:906:7716:: with SMTP id q22mr9581737ejm.457.1631278663202; Fri, 10 Sep 2021 05:57:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631278663; cv=none; d=google.com; s=arc-20160816; b=YnXUNgIoyOaeCrPQLX13KgBc6lBe2G7KKkojW0pBnGPYCPw+ITcZE/cogvu9fwYbOd wbwH1KTTyAo+JS0Y/MTaQ3/u56OD5fINB0vU6qZna2wi4fhQxlVDYJTMw54JUD+Q0TLa gLna/6g2UKqhBdKIh4Uva4PQhFOipeFAA4QkaasBjR2B8fazfmGYw4awzn6sV2g5SsFa +nyYC+RjE1FpIadCgPNcpxvKMXtyv6EOgEQpx5XCYAj5oMbFQmkQLHgmMvr1bDO8QrDL P9oB+9MZH523qavMANDEOAL9JyM4165LsFXiN1CH1QtT4mLckLyvYUhjcNK/oP6EilaM V5XA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=XfKqO1nVoROC+g6W7ctfTC2RMN0sRZoJ2d/b18BkaLQ=; b=ylzfloXWMNUhXJwdaJlTLoY9x9CySeogeVb6yoOxkoyETQEGvu4OHU16nthEOP20pV rKUEomIdGdNgg0WtYLtxkvhNVC/SRMZUT8p0a7utfCkHw5kajaYxHUTCNCJqHBeB3xOX MjnUxW2cS/8cQNv3qwCK+9WeLVoAJ6ywuRKCKhj1nhKfI3gFcUI5XFkcCInc6cNfmv4J WzPABm8duC1Ko5X8HfxxfltmP9DBRM6LKnQcKAggDodBzP0NSk7HOJZ/79QSH5PnP01S cLf3itioGTdXAIOnyUN4eV5ypMpJuS+UJfxtcWkf12+wFRgNijWHlAcrHFZaaSCrv685 C1aw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t18si4903261eds.55.2021.09.10.05.57.19; Fri, 10 Sep 2021 05:57:43 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233231AbhIJM5L (ORCPT + 99 others); Fri, 10 Sep 2021 08:57:11 -0400 Received: from foss.arm.com ([217.140.110.172]:56808 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231843AbhIJM5L (ORCPT ); Fri, 10 Sep 2021 08:57:11 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3058D6D; Fri, 10 Sep 2021 05:56:00 -0700 (PDT) Received: from [10.57.15.112] (unknown [10.57.15.112]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 57DC83F5A1; Fri, 10 Sep 2021 05:55:59 -0700 (PDT) Subject: Re: [PATCH] dma-debug: prevent an error message from causing runtime problems To: Hamza Mahfooz , linux-kernel@vger.kernel.org Cc: Jeremy Linton , iommu@lists.linux-foundation.org, Christoph Hellwig References: <20210910120541.39938-1-someguy@effective-light.com> From: Robin Murphy Message-ID: <215cd3ba-3f4c-ab74-c59e-f099fa64aaac@arm.com> Date: Fri, 10 Sep 2021 13:55:52 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <20210910120541.39938-1-someguy@effective-light.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021-09-10 13:05, Hamza Mahfooz wrote: > For some drivers, that call add_dma_entry() from somewhere down the call > stack. Nit: strictly, drivers don't call add_dma_entry(). Drivers only call the DMA API functions, and it is the DMA API internals which take a detour through dma-debug when desired. > If this error condition is triggered once, it causes the error > message to spam the kernel's printk buffer Is that true? It doesn't look like anything in dma-debug itself can obviously lead to that; I was assuming that in Jeremy's case it's the driver which has managed to do something such that every new mapping call it makes ends up hitting the warning. A busy network interface is probably more than capable of saturating the kernel log with a print for every packet (particularly a great big 100GBE-capable multi-queue thing like that one). > 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" > + )); Unless there's some subtlety I'm missing, it would be better to use err_printk() here - not only for consistency of output, but also to tie in with dma-debug's existing output-limiting controls. Robin. > } > } > >