lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080825163412.GA21910@linux.intel.com>
Date:	Mon, 25 Aug 2008 09:34:12 -0700
From:	mark gross <mgross@...ux.intel.com>
To:	John Kacur <jkacur@...il.com>
Cc:	Peter Zijlstra <peterz@...radead.org>,
	LKML <linux-kernel@...r.kernel.org>,
	rt-users <linux-rt-users@...r.kernel.org>,
	Steven Rostedt <rostedt@...dmis.org>,
	Ingo Molnar <mingo@...e.hu>,
	Thomas Gleixner <tglx@...utronix.de>,
	arjan <arjan@...radead.org>
Subject: Re: [PATCH RFC] pm_qos_requirement might sleep

On Fri, Aug 15, 2008 at 12:51:11AM +0200, John Kacur wrote:
> On Thu, Aug 14, 2008 at 7:48 PM, Peter Zijlstra <peterz@...radead.org> wrote:
> > On Thu, 2008-08-14 at 08:52 -0700, mark gross wrote:
> >
> >> Keeping a lock around the different "target_value"s may not be so
> >> important.  Its just a 32bit scaler value, and perhaps we can make it an
> >> atomic type?  That way we loose the raw_spinlock.
> >
> > My suggestion was to keep the locking for the write side - so as to
> > avoid stuff stomping on one another, but drop the read side as:
> >
> >  spin_lock
> >  foo = var;
> >  spin_unlock
> >  return foo;
> >
> > is kinda useless, it doesn't actually serialize against the usage of
> > foo, that is, once it gets used, var might already have acquired a new
> > value.
> >
> > The only thing it would protect is reading var, but since that is a
> > machine sized read, its atomic anyway (assuming its naturally aligned).
> >
> > So no need for atomic_t (its read-side is just a read too), just drop
> > the whole lock usage from pq_qos_requirement().
> >
> 
> Thanks Peter.
> 
> Mark, is the following patch ok with you? This should be applied to
> mainline, and then after that no special patches are necessary for
> real-time.

I've been thinking about this patch and I worry that the readability
from making the use of this lock asymmetric WRT reads and writes to the
storage address is bothersome.

I would rather make the variable an atomic.  What do you think about
that?

--mgross

> 
> Thanks
> 
> John Kacur

> Subject: Remove unnecessary lock in pm_qos_requirement
> 
> Signed-off-by: John Kacur <jkacur at gmail dot com>
> 
> Index: linux-2.6/kernel/pm_qos_params.c
> ===================================================================
> --- linux-2.6.orig/kernel/pm_qos_params.c
> +++ linux-2.6/kernel/pm_qos_params.c
> @@ -193,14 +193,7 @@ static int find_pm_qos_object_by_minor(i
>   */
>  int pm_qos_requirement(int pm_qos_class)
>  {
> -	int ret_val;
> -	unsigned long flags;
> -
> -	spin_lock_irqsave(&pm_qos_lock, flags);
> -	ret_val = pm_qos_array[pm_qos_class]->target_value;
> -	spin_unlock_irqrestore(&pm_qos_lock, flags);
> -
> -	return ret_val;
> +	return pm_qos_array[pm_qos_class]->target_value;
>  }
>  EXPORT_SYMBOL_GPL(pm_qos_requirement);
>  

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ