public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Mike Christie <michaelc@cs.wisc.edu>
To: Bhanu Gollapudi <bprakash@broadcom.com>
Cc: "devel@open-fcoe.org" <devel@open-fcoe.org>,
	"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	mchan@broadcom.com
Subject: Re: [v6 PATCH 4/4] bnx2fc: Makefile, Kconfig changes and FCoE interfaces
Date: Fri, 04 Feb 2011 11:03:12 -0600	[thread overview]
Message-ID: <4D4C3150.60709@cs.wisc.edu> (raw)
In-Reply-To: <1296790527.268.827.camel@LTLNR-SJCE10.corp.ad.broadcom.com>

On 02/03/2011 09:35 PM, Bhanu Gollapudi wrote:

> +
> +static int bnx2fc_l2_rcv_thread(void *arg)
> +{
> +	struct fcoe_percpu_s *bg = arg;
> +	struct sk_buff *skb;
> +
> +	while (!kthread_should_stop()) {
> +		spin_lock_bh(&bg->fcoe_rx_list.lock);
> +		while ((skb = __skb_dequeue(&bg->fcoe_rx_list)) == NULL) {
> +			set_current_state(TASK_INTERRUPTIBLE);
> +			spin_unlock_bh(&bg->fcoe_rx_list.lock);
> +			schedule();
> +			set_current_state(TASK_RUNNING);
> +			if (kthread_should_stop())
> +				return 0;
> +			spin_lock_bh(&bg->fcoe_rx_list.lock);
> +		}
> +		spin_unlock_bh(&bg->fcoe_rx_list.lock);
> +		bnx2fc_recv_frame(skb);
> +	}
> +	return 0;
> +}
> +
> +

I am not sure this is correct. Do you want to set the state to 
interruptible before calling kthread_should_stop and before scheduling? 
If kthread_stop is called after the check for kthread_should_stop() and 
before setting the state to interruptible then will you have missed 
kthread_stop's wake_up and will you schedule and not wake up again?

Do you need something like:

set_current_state(TASK_INTERRUPTIBLE);
while (!kthread_should_stop()) {
	schedule();
	set_current_state(TASK_RUNNING);
	spin_lock_bh(&bg->fcoe_rx_list.lock);
	while ((skb = __skb_dequeue(&bg->fcoe_rx_list)) != NULL) {
		spin_unlock_bh(&bg->fcoe_rx_list.lock);
		bnx2fc_recv_frame(skb);
		spin_lock_bh(&bg->fcoe_rx_list.lock);
	}
	set_current_state(TASK_INTERRUPTIBLE);
}
set_current_state(TASK_RUNNING);

  reply	other threads:[~2011-02-04 17:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-04  3:35 [v6 PATCH 4/4] bnx2fc: Makefile, Kconfig changes and FCoE interfaces Bhanu Gollapudi
2011-02-04 17:03 ` Mike Christie [this message]
2011-02-04 17:28   ` [Open-FCoE] " Mike Christie

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=4D4C3150.60709@cs.wisc.edu \
    --to=michaelc@cs.wisc.edu \
    --cc=bprakash@broadcom.com \
    --cc=devel@open-fcoe.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mchan@broadcom.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