From: Yichong Chen <chenyichong@uniontech.com>
To: gregkh@linuxfoundation.org
Cc: chenyichong@uniontech.com, dakr@kernel.org, djakov@kernel.org,
driver-core@lists.linux.dev, linux-kernel@vger.kernel.org,
linux-pm@vger.kernel.org, linux-sound@vger.kernel.org,
pierre-louis.bossart@linux.dev, quic_mdtipton@quicinc.com,
rafael@kernel.org, vkoul@kernel.org,
yung-chuan.liao@linux.intel.com
Subject: Re: [PATCH v2 1/3] interconnect: debugfs: replace writable string helper
Date: Fri, 7 Aug 2026 09:59:30 +0800 [thread overview]
Message-ID: <20260807015930.1067612-1-chenyichong@uniontech.com> (raw)
In-Reply-To: <2026080632-delighted-bonsai-18b7@gregkh>
On Thu, Aug 06, 2026 at 11:01:07AM +0200, Greg KH wrote:
> On Thu, Aug 06, 2026 at 04:48:52PM +0800, Yichong Chen wrote:
> > + mutex_lock(&debugfs_lock);
> > + copy = kstrdup(*node ?: "", GFP_KERNEL);
> > + mutex_unlock(&debugfs_lock);
>
> scoped guard?
Yes, scoped guard would be cleaner here. I can use it in the next version.
> > - src = kstrdup(src, GFP_ATOMIC);
> > - dst = kstrdup(dst, GFP_ATOMIC);
> > - rcu_read_unlock();
> > + src = kstrdup(src_node, GFP_KERNEL);
> > + dst = kstrdup(dst_node, GFP_KERNEL);
>
> Why is GFP_KERNEL now ok, while GFP_ATOMIC wasn't? Is this the rcu
> stuff interacting somehow?
Yes. The old code duplicated the strings while still inside the RCU
read-side critical section, so it had to use GFP_ATOMIC.
After this change, src_node and dst_node are protected by debugfs_lock
instead of RCU. The duplication is done while holding that mutex, so the
allocation can sleep and GFP_KERNEL should be OK.
I will make this clearer in the changelog when sending the next version.
Thanks,
Yichong
next prev parent reply other threads:[~2026-08-07 2:00 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-06 8:48 [PATCH v2 0/3] debugfs: make debugfs_create_str() read-only Yichong Chen
2026-08-06 8:48 ` [PATCH v2 1/3] interconnect: debugfs: replace writable string helper Yichong Chen
2026-08-06 9:01 ` Greg KH
2026-08-07 1:59 ` Yichong Chen [this message]
2026-08-06 8:48 ` [PATCH v2 2/3] soundwire: " Yichong Chen
2026-08-06 9:02 ` Greg KH
2026-08-06 8:48 ` [PATCH v2 3/3] debugfs: make debugfs_create_str() read-only Yichong Chen
2026-08-06 9:02 ` Greg KH
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=20260807015930.1067612-1-chenyichong@uniontech.com \
--to=chenyichong@uniontech.com \
--cc=dakr@kernel.org \
--cc=djakov@kernel.org \
--cc=driver-core@lists.linux.dev \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=pierre-louis.bossart@linux.dev \
--cc=quic_mdtipton@quicinc.com \
--cc=rafael@kernel.org \
--cc=vkoul@kernel.org \
--cc=yung-chuan.liao@linux.intel.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