[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <73300d46-81bb-42ab-85ac-19100f2346fa@yunsilicon.com>
Date: Wed, 12 Mar 2025 16:37:18 +0800
From: "Xin Tian" <tianx@...silicon.com>
To: "Paolo Abeni" <pabeni@...hat.com>, <netdev@...r.kernel.org>
Cc: <leon@...nel.org>, <andrew+netdev@...n.ch>, <kuba@...nel.org>,
<edumazet@...gle.com>, <davem@...emloft.net>,
<jeff.johnson@....qualcomm.com>, <przemyslaw.kitszel@...el.com>,
<weihg@...silicon.com>, <wanry@...silicon.com>, <jacky@...silicon.com>,
<horms@...nel.org>, <parthiban.veerasooran@...rochip.com>,
<masahiroy@...nel.org>, <kalesh-anakkur.purayil@...adcom.com>,
<geert+renesas@...der.be>
Subject: Re: [PATCH net-next v8 02/14] xsc: Enable command queue
On 2025/3/11 22:55, Paolo Abeni wrote:
> On 3/7/25 11:08 AM, Xin Tian wrote:
>> +void xsc_cmd_use_events(struct xsc_core_device *xdev)
>> +{
>> + struct xsc_cmd *cmd = &xdev->cmd;
>> + int i;
>> +
>> + for (i = 0; i < cmd->max_reg_cmds; i++)
>> + down(&cmd->sem);
>> +
>> + flush_workqueue(cmd->wq);
>> +
>> + cmd->mode = XSC_CMD_MODE_EVENTS;
>> +
>> + while (cmd->cmd_pid != cmd->cq_cid)
> If I read correctly, `cq_cid` can be concurrently and locklessy modfied
> by xsc_cmd_resp_handler() and/or xsc_cmd_cq_polling().
>
> If so you need at least READ/WRITE_ONCE() annotations and possibly some
> explicit mutual exclusion between xsc_cmd_resp_handler and
> xsc_cmd_cq_polling.
>
> Thanks,
>
> Paolo
Hi, Paolo
|xsc_cmd_cq_polling|and |xsc_cmd_resp_handler| operate in distinct phases:
Before interrupt initialization: |xsc_cmd_cq_polling| is used to
poll for command queue (cmdq) responses.
After interrupt initialization: |xsc_cmd_cq_polling| ceases operation,
and |xsc_cmd_resp_handler| takes over to handle cmdq responses.
This sequential operation ensures that there is no concurrent access
to |cq_cid| between the two functions.
The relevant implementation details can be found in patch 6.
Thanks,
Xin
Powered by blists - more mailing lists