All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gertjan van Wingerde <gwingerde@gmail.com>
To: "John W. Linville" <linville@tuxdriver.com>
Cc: Ivo van Doorn <ivdoorn@gmail.com>,
	linux-wireless@vger.kernel.org, users@rt2x00.serialmonkey.com
Subject: Re: [rt2x00-users] [PATCH 6/7] rt2x00: Queue index locks don't have to disable IRQs.
Date: Wed, 18 May 2011 22:54:51 +0200	[thread overview]
Message-ID: <4DD4321B.5080800@gmail.com> (raw)
In-Reply-To: <201105182025.56724.IvDoorn@gmail.com>

On 05/18/11 20:25, Ivo van Doorn wrote:
> From: Gertjan van Wingerde <gwingerde@gmail.com>
> 
> The queue index locks are no longer used in interrupt context due to the
> introduction of tasklets and workqueues. Therefore we can use a lighter
> variant of the spinlocks.
> 
> Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
> Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>

John, as noted in another email on the mailing list, this patch seems to introduce
a problem on USB devices, which escaped my testing for some reason.

Hence, please do not apply this patch to wireless-next.

Patch 7 of the series does not depend on this patch, so that one can still be applied.

> ---
>  drivers/net/wireless/rt2x00/rt2x00debug.c |    5 ++---
>  drivers/net/wireless/rt2x00/rt2x00queue.c |   20 ++++++++------------
>  2 files changed, 10 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/net/wireless/rt2x00/rt2x00debug.c b/drivers/net/wireless/rt2x00/rt2x00debug.c
> index 78787fc..8e417de 100644
> --- a/drivers/net/wireless/rt2x00/rt2x00debug.c
> +++ b/drivers/net/wireless/rt2x00/rt2x00debug.c
> @@ -327,7 +327,6 @@ static ssize_t rt2x00debug_read_queue_stats(struct file *file,
>  {
>  	struct rt2x00debug_intf *intf = file->private_data;
>  	struct data_queue *queue;
> -	unsigned long irqflags;
>  	unsigned int lines = 1 + intf->rt2x00dev->data_queues;
>  	size_t size;
>  	char *data;
> @@ -344,7 +343,7 @@ static ssize_t rt2x00debug_read_queue_stats(struct file *file,
>  	    sprintf(data, "qid\tflags\t\tcount\tlimit\tlength\tindex\tdma done\tdone\n");
>  
>  	queue_for_each(intf->rt2x00dev, queue) {
> -		spin_lock_irqsave(&queue->index_lock, irqflags);
> +		spin_lock_bh(&queue->index_lock);
>  
>  		temp += sprintf(temp, "%d\t0x%.8x\t%d\t%d\t%d\t%d\t%d\t\t%d\n",
>  				queue->qid, (unsigned int)queue->flags,
> @@ -353,7 +352,7 @@ static ssize_t rt2x00debug_read_queue_stats(struct file *file,
>  				queue->index[Q_INDEX_DMA_DONE],
>  				queue->index[Q_INDEX_DONE]);
>  
> -		spin_unlock_irqrestore(&queue->index_lock, irqflags);
> +		spin_unlock_bh(&queue->index_lock);
>  	}
>  
>  	size = strlen(data);
> diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c
> index f1e1381..e2e1bf6 100644
> --- a/drivers/net/wireless/rt2x00/rt2x00queue.c
> +++ b/drivers/net/wireless/rt2x00/rt2x00queue.c
> @@ -735,7 +735,6 @@ bool rt2x00queue_for_each_entry(struct data_queue *queue,
>  				bool (*fn)(struct queue_entry *entry,
>  					   void *data))
>  {
> -	unsigned long irqflags;
>  	unsigned int index_start;
>  	unsigned int index_end;
>  	unsigned int i;
> @@ -753,10 +752,10 @@ bool rt2x00queue_for_each_entry(struct data_queue *queue,
>  	 * it should not be kicked during this run, since it
>  	 * is part of another TX operation.
>  	 */
> -	spin_lock_irqsave(&queue->index_lock, irqflags);
> +	spin_lock_bh(&queue->index_lock);
>  	index_start = queue->index[start];
>  	index_end = queue->index[end];
> -	spin_unlock_irqrestore(&queue->index_lock, irqflags);
> +	spin_unlock_bh(&queue->index_lock);
>  
>  	/*
>  	 * Start from the TX done pointer, this guarentees that we will
> @@ -787,7 +786,6 @@ struct queue_entry *rt2x00queue_get_entry(struct data_queue *queue,
>  					  enum queue_index index)
>  {
>  	struct queue_entry *entry;
> -	unsigned long irqflags;
>  
>  	if (unlikely(index >= Q_INDEX_MAX)) {
>  		ERROR(queue->rt2x00dev,
> @@ -795,11 +793,11 @@ struct queue_entry *rt2x00queue_get_entry(struct data_queue *queue,
>  		return NULL;
>  	}
>  
> -	spin_lock_irqsave(&queue->index_lock, irqflags);
> +	spin_lock_bh(&queue->index_lock);
>  
>  	entry = &queue->entries[queue->index[index]];
>  
> -	spin_unlock_irqrestore(&queue->index_lock, irqflags);
> +	spin_unlock_bh(&queue->index_lock);
>  
>  	return entry;
>  }
> @@ -808,7 +806,6 @@ EXPORT_SYMBOL_GPL(rt2x00queue_get_entry);
>  void rt2x00queue_index_inc(struct queue_entry *entry, enum queue_index index)
>  {
>  	struct data_queue *queue = entry->queue;
> -	unsigned long irqflags;
>  
>  	if (unlikely(index >= Q_INDEX_MAX)) {
>  		ERROR(queue->rt2x00dev,
> @@ -816,7 +813,7 @@ void rt2x00queue_index_inc(struct queue_entry *entry, enum queue_index index)
>  		return;
>  	}
>  
> -	spin_lock_irqsave(&queue->index_lock, irqflags);
> +	spin_lock_bh(&queue->index_lock);
>  
>  	queue->index[index]++;
>  	if (queue->index[index] >= queue->limit)
> @@ -831,7 +828,7 @@ void rt2x00queue_index_inc(struct queue_entry *entry, enum queue_index index)
>  		queue->count++;
>  	}
>  
> -	spin_unlock_irqrestore(&queue->index_lock, irqflags);
> +	spin_unlock_bh(&queue->index_lock);
>  }
>  
>  void rt2x00queue_pause_queue(struct data_queue *queue)
> @@ -1031,10 +1028,9 @@ EXPORT_SYMBOL_GPL(rt2x00queue_flush_queues);
>  
>  static void rt2x00queue_reset(struct data_queue *queue)
>  {
> -	unsigned long irqflags;
>  	unsigned int i;
>  
> -	spin_lock_irqsave(&queue->index_lock, irqflags);
> +	spin_lock_bh(&queue->index_lock);
>  
>  	queue->count = 0;
>  	queue->length = 0;
> @@ -1042,7 +1038,7 @@ static void rt2x00queue_reset(struct data_queue *queue)
>  	for (i = 0; i < Q_INDEX_MAX; i++)
>  		queue->index[i] = 0;
>  
> -	spin_unlock_irqrestore(&queue->index_lock, irqflags);
> +	spin_unlock_bh(&queue->index_lock);
>  }
>  
>  void rt2x00queue_init_queues(struct rt2x00_dev *rt2x00dev)


-- 
---
Gertjan

  reply	other threads:[~2011-05-18 20:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <201105182022.20341.IvDoorn@gmail.com>
2011-05-18 18:25 ` [PATCH 2/7] rt2x00: Don't disable G0 PA_PE bit in case of BT coexistence Ivo van Doorn
     [not found] ` <201105182022.40563.IvDoorn@gmail.com>
2011-05-18 18:25   ` [PATCH 3/7] rt2x00: Add support for RT3572/RT3592/RT3592+Bluetooth combo card Ivo van Doorn
     [not found]   ` <201105182023.04837.IvDoorn@gmail.com>
2011-05-18 18:25     ` [PATCH 4/7] rt2x00: Interface sequence lock doesn't have to disable interrupts Ivo van Doorn
     [not found]     ` <201105182023.25912.IvDoorn@gmail.com>
2011-05-18 18:25       ` [PATCH 5/7] rt2x00: Move rt2800_txdone and rt2800_txdone_entry_check to rt2800usb Ivo van Doorn
2011-05-18 20:38         ` [rt2x00-users] [PATCH 5/7] rt2x00: Move rt2800_txdone andrt2800_txdone_entry_check " Marc Dietrich
2011-05-18 20:53           ` Gertjan van Wingerde
     [not found]       ` <201105182023.47984.IvDoorn@gmail.com>
2011-05-18 18:25         ` [PATCH 6/7] rt2x00: Queue index locks don't have to disable IRQs Ivo van Doorn
2011-05-18 20:54           ` Gertjan van Wingerde [this message]
     [not found]         ` <201105182024.21295.IvDoorn@gmail.com>
2011-05-18 18:26           ` [PATCH 7/7] rt2x00: Enabled rt35xx device support by default Ivo van Doorn

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=4DD4321B.5080800@gmail.com \
    --to=gwingerde@gmail.com \
    --cc=ivdoorn@gmail.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=users@rt2x00.serialmonkey.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.