[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <39262c11-b14f-462f-b9c0-4e7bd1f32f0d@lunn.ch>
Date: Wed, 20 Aug 2025 22:37:01 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Dong Yibo <dong100@...se.com>
Cc: andrew+netdev@...n.ch, davem@...emloft.net, edumazet@...gle.com,
kuba@...nel.org, pabeni@...hat.com, horms@...nel.org,
corbet@....net, gur.stavi@...wei.com, maddy@...ux.ibm.com,
mpe@...erman.id.au, danishanwar@...com, lee@...ger.us,
gongfan1@...wei.com, lorenzo@...nel.org, geert+renesas@...der.be,
Parthiban.Veerasooran@...rochip.com, lukas.bulwahn@...hat.com,
alexanderduyck@...com, richardcochran@...il.com,
netdev@...r.kernel.org, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v5 4/5] net: rnpgbe: Add basic mbx_fw support
> +static int mucse_mbx_fw_post_req(struct mucse_hw *hw,
> + struct mbx_fw_cmd_req *req,
> + struct mbx_req_cookie *cookie)
> +{
> + int len = le16_to_cpu(req->datalen);
> + int err;
> +
> + cookie->errcode = 0;
> + cookie->done = 0;
> + init_waitqueue_head(&cookie->wait);
> + err = mutex_lock_interruptible(&hw->mbx.lock);
> + if (err)
> + return err;
> + err = mucse_write_mbx(hw, (u32 *)req, len);
> + if (err)
> + goto out;
> + err = wait_event_timeout(cookie->wait,
> + cookie->done == 1,
> + cookie->timeout_jiffies);
> +
> + if (!err)
> + err = -ETIMEDOUT;
> + else
> + err = 0;
> + if (!err && cookie->errcode)
> + err = cookie->errcode;
> +out:
> + mutex_unlock(&hw->mbx.lock);
> + return err;
What is your design with respect to mutex_lock_interruptible() and
then calling wait_event_timeout() which will ignore signals?
Is your intention that you can always ^C the driver, and it will clean
up whatever it was doing and return -EINTR? Such unwinding can be
tricky and needs careful review. Before i do that, i just want to make
sure this is your intention, and you yourself have carefully reviewed
the code.
Andrew
Powered by blists - more mailing lists