All of lore.kernel.org
 help / color / mirror / Atom feed
From: mark gross <mgross@linux.intel.com>
To: "Jakub W. Jozwicki" <jozwicki@aster.pl>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2.6.25.10] pm_qos_params: change spinlock to rwlock
Date: Wed, 16 Jul 2008 10:15:47 -0700	[thread overview]
Message-ID: <20080716171547.GA13478@linux.intel.com> (raw)
In-Reply-To: <200807130119.19663.jozwicki@aster.pl>

nack.


On Sun, Jul 13, 2008 at 01:19:19AM +0200, Jakub W. Jozwicki wrote:
> Concurrent calls to pm_qos_requirement shouldn't block each other. This patch 
> changes spinlock to rwlock and fixes issues with PREEMPT_RT.
>  
> Signed-off-by:  Jakub Jozwicki <jozwicki@aster.pl>
> 
> --- linux-2.6.25.10/kernel/pm_qos_params.c	2008-07-03 05:46:47.000000000 +0200
> +++ linux-2.6.25.10-rt7/kernel/pm_qos_params.c	2008-07-12 23:18:20.696615771 
> +0200
> @@ -110,7 +110,7 @@
>  	&network_throughput_pm_qos
>  };
>  
> -static DEFINE_SPINLOCK(pm_qos_lock);
> +static DEFINE_RWLOCK(pm_qos_lock);

I don't see a problem with using spinlocks, and as this issues only
shows up running the PREEMPT-RT I feel that perhaps this would be better
in the RT tree.

Sorry,

--mgross


>  
>  static ssize_t pm_qos_power_write(struct file *filp, const char __user *buf,
>  		size_t count, loff_t *f_pos);
> @@ -142,7 +142,7 @@
>  	unsigned long flags;
>  	int call_notifier = 0;
>  
> -	spin_lock_irqsave(&pm_qos_lock, flags);
> +	write_lock_irqsave(&pm_qos_lock, flags);
>  	extreme_value = pm_qos_array[target]->default_value;
>  	list_for_each_entry(node,
>  			&pm_qos_array[target]->requirements.list, list) {
> @@ -155,7 +155,7 @@
>  		pr_debug(KERN_ERR "new target for qos %d is %d\n", target,
>  			pm_qos_array[target]->target_value);
>  	}
> -	spin_unlock_irqrestore(&pm_qos_lock, flags);
> +	write_unlock_irqrestore(&pm_qos_lock, flags);
>  
>  	if (call_notifier)
>  		blocking_notifier_call_chain(pm_qos_array[target]->notifiers,
> @@ -195,9 +195,9 @@
>  	int ret_val;
>  	unsigned long flags;
>  
> -	spin_lock_irqsave(&pm_qos_lock, flags);
> +	read_lock_irqsave(&pm_qos_lock, flags);
>  	ret_val = pm_qos_array[pm_qos_class]->target_value;
> -	spin_unlock_irqrestore(&pm_qos_lock, flags);
> +	read_unlock_irqrestore(&pm_qos_lock, flags);
>  
>  	return ret_val;
>  }
> @@ -228,10 +228,10 @@
>  		if (!dep->name)
>  			goto cleanup;
>  
> -		spin_lock_irqsave(&pm_qos_lock, flags);
> +		write_lock_irqsave(&pm_qos_lock, flags);
>  		list_add(&dep->list,
>  			&pm_qos_array[pm_qos_class]->requirements.list);
> -		spin_unlock_irqrestore(&pm_qos_lock, flags);
> +		write_unlock_irqrestore(&pm_qos_lock, flags);
>  		update_target(pm_qos_class);
>  
>  		return 0;
> @@ -260,7 +260,7 @@
>  	struct requirement_list *node;
>  	int pending_update = 0;
>  
> -	spin_lock_irqsave(&pm_qos_lock, flags);
> +	write_lock_irqsave(&pm_qos_lock, flags);
>  	list_for_each_entry(node,
>  		&pm_qos_array[pm_qos_class]->requirements.list, list) {
>  		if (strcmp(node->name, name) == 0) {
> @@ -273,7 +273,7 @@
>  			break;
>  		}
>  	}
> -	spin_unlock_irqrestore(&pm_qos_lock, flags);
> +	write_unlock_irqrestore(&pm_qos_lock, flags);
>  	if (pending_update)
>  		update_target(pm_qos_class);
>  
> @@ -295,7 +295,7 @@
>  	struct requirement_list *node;
>  	int pending_update = 0;
>  
> -	spin_lock_irqsave(&pm_qos_lock, flags);
> +	write_lock_irqsave(&pm_qos_lock, flags);
>  	list_for_each_entry(node,
>  		&pm_qos_array[pm_qos_class]->requirements.list, list) {
>  		if (strcmp(node->name, name) == 0) {
> @@ -306,7 +306,7 @@
>  			break;
>  		}
>  	}
> -	spin_unlock_irqrestore(&pm_qos_lock, flags);
> +	write_unlock_irqrestore(&pm_qos_lock, flags);
>  	if (pending_update)
>  		update_target(pm_qos_class);
>  }

      parent reply	other threads:[~2008-07-16 17:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-12 23:19 [PATCH 2.6.25.10] pm_qos_params: change spinlock to rwlock Jakub W. Jozwicki
2008-07-13  8:28 ` Andrew Morton
2008-07-13 13:05   ` Jakub W. Jozwicki
2008-07-15  0:17     ` mark gross
2008-08-22 13:14     ` Nicos Gollan
2008-07-16 17:15 ` mark gross [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=20080716171547.GA13478@linux.intel.com \
    --to=mgross@linux.intel.com \
    --cc=jozwicki@aster.pl \
    --cc=linux-kernel@vger.kernel.org \
    /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.