Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
From: Jijie Shao <shaojijie@huawei.com>
To: Arnd Bergmann <arnd@arndb.de>, Jakub Kicinski <kuba@kernel.org>
Cc: <shaojijie@huawei.com>, Jian Shen <shenjian15@huawei.com>,
	Salil Mehta <salil.mehta@huawei.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>,
	Nathan Chancellor <nathan@kernel.org>,
	Nick Desaulniers <nick.desaulniers+lkml@gmail.com>,
	Bill Wendling <morbo@google.com>,
	Justin Stitt <justinstitt@google.com>,
	Hao Lan <lanhao@huawei.com>,
	Guangwei Zhang <zhangwangwei6@huawei.com>,
	Netdev <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<llvm@lists.linux.dev>
Subject: Re: [PATCH] hns3: work around stack size warning
Date: Mon, 23 Jun 2025 14:21:11 +0800	[thread overview]
Message-ID: <791a8e4e-8bcf-4638-8bd7-d9e8785a9320@huawei.com> (raw)
In-Reply-To: <13cf4327-f04f-455e-9a3a-1c74b22f42d0@app.fastmail.com>


on 2025/6/23 13:56, Arnd Bergmann wrote:
> On Mon, Jun 23, 2025, at 05:19, Jijie Shao wrote:
>>> on 2025/6/12 23:33, Jakub Kicinski wrote:
>>>
>> *Hi Jakub, Arnd We have changed the impleament as your suggestion. Would
>> you please help check it ? If it's OK, we will rewrite the rest parts of
>> our debugfs code. Thanks! *
> The conversion to seq_file looks good to me, this does address the
> stack usage problems I was observing.
> Thanks for cleaning this up!
>
>> -    sprintf(result[j++], "%u", index);
>> -    sprintf(result[j++], "%u", readl_relaxed(ring->tqp->io_base +
>> -        HNS3_RING_TX_RING_BD_NUM_REG));
>> +    seq_printf(s, "%-4u%6s", index, " ");
>> +    seq_printf(s, "%-5u%3s",
>> +           readl_relaxed(base + HNS3_RING_TX_RING_BD_NUM_REG), " ");
> I'm not sure I understand the format string changes here, I did
> not think they were necessary.
>
> Are you doing this to keep the output the same as before, or are
> you reformatting the contents for readability?

yeah, just to keep the output the same as before


>
>> +static int hns3_dbg_common_init_t1(struct hnae3_handle *handle, u32
>> cmd)
>> +{
>> +    struct device *dev = &handle->pdev->dev;
>> +    struct dentry *entry_dir;
>> +    read_func func = NULL;
>> +
>> +    switch (hns3_dbg_cmd[cmd].cmd) {
>> +    case HNAE3_DBG_CMD_TX_QUEUE_INFO:
>> +        func = hns3_dbg_tx_queue_info;
>> +        break;
>> +    default:
>> +        return -EINVAL;
>> +    }
>> +
>> +    entry_dir = hns3_dbg_dentry[hns3_dbg_cmd[cmd].dentry].dentry;
>> +    debugfs_create_devm_seqfile(dev, hns3_dbg_cmd[cmd].name, entry_dir,
>> +                    func);
>> +
>> +    return 0;
> This will work fine as well, but I think you can do slightly better
> by having your own file_operations with a read function based
> on single_open() and your current hns3_dbg_read_cmd().
>
> I don't think you gain anything from using debugfs_create_devm_seqfile()
> since you use debugfs_remove_recursive() for cleaning it up anyway.
>
>       Arnd

Using debugfs_create_devm_seqfile() is just to simplify the code.
We only need to focus on the implementation of .read() function.

Thanks
Jijie Shao



  reply	other threads:[~2025-06-23  6:21 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-10  9:21 [PATCH] hns3: work around stack size warning Arnd Bergmann
2025-06-10 16:08 ` Andrew Lunn
2025-06-11  2:10 ` Jijie Shao
2025-06-11 16:36   ` Arnd Bergmann
2025-06-12 13:09     ` Jijie Shao
2025-06-12 14:32       ` Jakub Kicinski
2025-06-12 15:27         ` Arnd Bergmann
2025-06-12 15:33       ` Jakub Kicinski
2025-06-13  5:59         ` Jijie Shao
2025-06-23  2:30           ` Jijie Shao
2025-06-23  3:19           ` Jijie Shao
2025-06-23  5:56             ` Arnd Bergmann
2025-06-23  6:21               ` Jijie Shao [this message]
2025-06-23  7:12                 ` Arnd Bergmann

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=791a8e4e-8bcf-4638-8bd7-d9e8785a9320@huawei.com \
    --to=shaojijie@huawei.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=arnd@arndb.de \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=justinstitt@google.com \
    --cc=kuba@kernel.org \
    --cc=lanhao@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=morbo@google.com \
    --cc=nathan@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nick.desaulniers+lkml@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=salil.mehta@huawei.com \
    --cc=shenjian15@huawei.com \
    --cc=zhangwangwei6@huawei.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