public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
From: Wen Gu <guwen@linux.alibaba.com>
To: Heiko Carstens <hca@linux.ibm.com>
Cc: kgraul@linux.ibm.com, davem@davemloft.net, kuba@kernel.org,
	linux-s390@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, tonylu@linux.alibaba.com,
	dust.li@linux.alibaba.com, xuanzhuo@linux.alibaba.com
Subject: Re: [PATCH net] net/smc: Transfer remaining wait queue entries during fallback
Date: Fri, 12 Nov 2021 23:28:11 +0800	[thread overview]
Message-ID: <0a5d62a6-4486-16c8-9b69-bea8949606ee@linux.alibaba.com> (raw)
In-Reply-To: <YY5z4H5/CVpRtrwh@osiris>



On 2021/11/12 10:02 pm, Heiko Carstens wrote:
> On Fri, Nov 12, 2021 at 11:30:39AM +0800, Wen Gu wrote:
> ...
>> +	wait_queue_head_t *smc_wait = sk_sleep(&smc->sk);
>> +	wait_queue_head_t *clc_wait = sk_sleep(smc->clcsock->sk);
>> +	unsigned long flags;
>> +
>>   	smc->use_fallback = true;
>>   	smc->fallback_rsn = reason_code;
>>   	smc_stat_fallback(smc);
>> @@ -571,6 +575,16 @@ static void smc_switch_to_fallback(struct smc_sock *smc, int reason_code)
>>   		smc->clcsock->file->private_data = smc->clcsock;
>>   		smc->clcsock->wq.fasync_list =
>>   			smc->sk.sk_socket->wq.fasync_list;
>> +
>> +		/* There might be some wait queue entries remaining
>> +		 * in smc socket->wq, which should be removed to
>> +		 * clcsocket->wq during the fallback.
>> +		 */
>> +		spin_lock_irqsave(&smc_wait->lock, flags);
>> +		spin_lock_irqsave(&clc_wait->lock, flags);
>> +		list_splice_init(&smc_wait->head, &clc_wait->head);
>> +		spin_unlock_irqrestore(&clc_wait->lock, flags);
>> +		spin_unlock_irqrestore(&smc_wait->lock, flags);
> 
> No idea if the rest of the patch makes sense, however this usage of
> spin_lock_irqsave() is not correct. The second spin_lock_irqsave()
> would always save a state with irqs disabled into "flags", and
> therefore this path would always be left with irqs disabled,
> regardless if irqs were enabled or disabled when entering.
> 
> You need to change it to something like
> 
>> +		spin_lock_irqsave(&smc_wait->lock, flags);
>> +		spin_lock(&clc_wait->lock);
>> +		list_splice_init(&smc_wait->head, &clc_wait->head);
>> +		spin_unlock(&clc_wait->lock);
>> +		spin_unlock_irqrestore(&smc_wait->lock, flags);

Sorry for the mistake... I will correct this.

Thanks,
Wen Gu

      reply	other threads:[~2021-11-12 15:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-12  3:30 [PATCH net] net/smc: Transfer remaining wait queue entries during fallback Wen Gu
2021-11-12 14:02 ` Heiko Carstens
2021-11-12 15:28   ` Wen Gu [this message]

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=0a5d62a6-4486-16c8-9b69-bea8949606ee@linux.alibaba.com \
    --to=guwen@linux.alibaba.com \
    --cc=davem@davemloft.net \
    --cc=dust.li@linux.alibaba.com \
    --cc=hca@linux.ibm.com \
    --cc=kgraul@linux.ibm.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=tonylu@linux.alibaba.com \
    --cc=xuanzhuo@linux.alibaba.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