lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <791a8e4e-8bcf-4638-8bd7-d9e8785a9320@huawei.com>
Date: Mon, 23 Jun 2025 14:21:11 +0800
From: Jijie Shao <shaojijie@...wei.com>
To: Arnd Bergmann <arnd@...db.de>, Jakub Kicinski <kuba@...nel.org>
CC: <shaojijie@...wei.com>, Jian Shen <shenjian15@...wei.com>, Salil Mehta
	<salil.mehta@...wei.com>, Andrew Lunn <andrew+netdev@...n.ch>, "David S .
 Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, Paolo
 Abeni <pabeni@...hat.com>, Nathan Chancellor <nathan@...nel.org>, Nick
 Desaulniers <nick.desaulniers+lkml@...il.com>, Bill Wendling
	<morbo@...gle.com>, Justin Stitt <justinstitt@...gle.com>, Hao Lan
	<lanhao@...wei.com>, Guangwei Zhang <zhangwangwei6@...wei.com>, Netdev
	<netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
	<llvm@...ts.linux.dev>
Subject: Re: [PATCH] hns3: work around stack size warning


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



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ