From: Bibek Kumar Patro <quic_bibekkum@quicinc.com>
To: <akpm@linux-foundation.org>
Cc: <linux-mm@kvack.org>, <linux-kernel@vger.kernel.org>,
<quic_pkondeti@quicinc.com>, <quic_charante@quicinc.com>
Subject: Re: [PATCH v2] cma: introduce CMA_ALLOC_DEBUG config
Date: Wed, 9 Aug 2023 19:27:52 +0530 [thread overview]
Message-ID: <653dd444-cb47-49ac-b20c-25e256025410@quicinc.com> (raw)
In-Reply-To: <20230809131640.18791-1-quic_bibekkum@quicinc.com>
v2 was added by mistake. It's first submission of the patch. Please
ignore the v2.
regards,
Bibek
On 8/9/2023 6:46 PM, Bibek Kumar Patro wrote:
> Currently enabling CONFIG_CMA_DEBUG enables DEBUG preprocessor macro.
> If DEBUG is defined, it's equivalent to a printk with KERN_DEBUG loglevel
> flooding the dmesg buffer with pr_debug prints from mm/cma driver and from
> included files as well. This results in excessive amount of CMA logging and
> also might distract the debug teams with unrelated KERN_DEBUG prints.One of
> the ways engineers currently tackle this problem is by passing loglevel=N
> though commandline to suppress KERN_DEBUG messages. This approach can
> sometimes become tiresome due to its repetitive nature.
> This patch proposes an alternative approach by introducing a simple new
> config CONFIG_CMA_ALLOC_DEBUG which only shows the cma bit allocation
> status in case of cma failure and do not enable DEBUG preprocessor macro
> from CONFIG_CMA_DEBUG avoiding excessive CMA logging from pr_debug.
> Engineers and tech teams seeking only for bitmap status in case of cma
> failure can use this simple config instead of worrying about changing
> the loglevel or trying other similar workarounds.
>
> Signed-off-by: Bibek Kumar Patro <quic_bibekkum@quicinc.com>
> ---
> mm/Kconfig | 11 +++++++++++
> mm/cma.c | 2 +-
> 2 files changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/mm/Kconfig b/mm/Kconfig
> index 09130434e30d..ad2a20576a65 100644
> --- a/mm/Kconfig
> +++ b/mm/Kconfig
> @@ -891,12 +891,23 @@ config CMA
> config CMA_DEBUG
> bool "CMA debug messages (DEVELOPMENT)"
> depends on DEBUG_KERNEL && CMA
> + select CMA_ALLOC_DEBUG
> help
> Turns on debug messages in CMA. This produces KERN_DEBUG
> messages for every CMA call as well as various messages while
> processing calls such as dma_alloc_from_contiguous().
> This option does not affect warning and error messages.
>
> +config CMA_ALLOC_DEBUG
> + bool "CMA bitmap status upon failure"
> + depends on CMA
> + help
> + Turns on bitmap dump in case of cma failures. This prints
> + current status of CMA bit upon failures and will appear
> + when cma_alloc() return no_warn argument as false and won't
> + flood the dmesg buffer with unrelated KERN_DEBUG prints. No
> + need to explicitly enable this if CMA_DEBUG is enabled.
> +
> config CMA_DEBUGFS
> bool "CMA debugfs interface"
> depends on CMA && DEBUG_FS
> diff --git a/mm/cma.c b/mm/cma.c
> index a4cfe995e11e..0ead392769b3 100644
> --- a/mm/cma.c
> +++ b/mm/cma.c
> @@ -383,7 +383,7 @@ int __init cma_declare_contiguous_nid(phys_addr_t base,
> return ret;
> }
>
> -#ifdef CONFIG_CMA_DEBUG
> +#ifdef CONFIG_CMA_ALLOC_DEBUG
> static void cma_debug_show_areas(struct cma *cma)
> {
> unsigned long next_zero_bit, next_set_bit, nr_zero;
> --
> 2.17.1
>
next prev parent reply other threads:[~2023-08-09 13:58 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-09 13:16 Bibek Kumar Patro
2023-08-09 13:57 ` Bibek Kumar Patro [this message]
2023-08-10 16:54 ` Andrew Morton
2023-08-11 6:54 ` Bibek Kumar Patro
2023-08-14 3:00 ` Pavan Kondeti
2023-08-25 13:08 ` Bibek Kumar Patro
2023-08-28 3:18 ` Pavan Kondeti
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=653dd444-cb47-49ac-b20c-25e256025410@quicinc.com \
--to=quic_bibekkum@quicinc.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=quic_charante@quicinc.com \
--cc=quic_pkondeti@quicinc.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox