Re: [PATCH 1/1] s390/ism: fix concurrency management in ism_cmd()

From: Alexandra Winter
Date: Mon Jul 21 2025 - 04:19:04 EST




On 21.07.25 09:30, Alexander Gordeev wrote:
> On Sun, Jul 20, 2025 at 11:11:09PM +0200, Halil Pasic wrote:
>
> Hi Halil,
>
> ...
>> @@ -129,7 +129,9 @@ static int ism_cmd(struct ism_dev *ism, void *cmd)
>> {
>> struct ism_req_hdr *req = cmd;
>> struct ism_resp_hdr *resp = cmd;
>> + unsigned long flags;
>>
>> + spin_lock_irqsave(&ism->cmd_lock, flags);
>
> I only found smcd_handle_irq() scheduling a tasklet, but no commands issued.
> Do we really need disable interrupts?

You are right in current code, the interrupt and event handlers of ism and smcd
never issue a control command that calls ism_cmd().
OTOH, future ism clients could do that.
The control commands are not part of the data path, but of connection establish.
So I don't really expect a performance impact.
I have it on my ToDo list, to change this to threaded interrupts in the future.
So no strong opinion on my side.
Simple spin_lock is fine with me.



>
>> __ism_write_cmd(ism, req + 1, sizeof(*req), req->len - sizeof(*req));
>> __ism_write_cmd(ism, req, 0, sizeof(*req));
>>
>> @@ -143,6 +145,7 @@ static int ism_cmd(struct ism_dev *ism, void *cmd)
>> }
>> __ism_read_cmd(ism, resp + 1, sizeof(*resp), resp->len - sizeof(*resp));
>> out:
>> + spin_unlock_irqrestore(&ism->cmd_lock, flags);
>> return resp->ret;
>> }
>>
> ...
>
> Thanks!
>