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: <51C2BF3C.8020804@asianux.com>
Date:	Thu, 20 Jun 2013 16:37:16 +0800
From:	Chen Gang <gang.chen@...anux.com>
To:	Thomas Gleixner <tglx@...utronix.de>
CC:	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] kernel/timer.c: using spin_lock_irqsave instead of spin_lock
 + local_irq_save, especially when CONFIG_LOCKDEP not defined

On 06/19/2013 06:53 PM, Thomas Gleixner wrote:
> On Wed, 19 Jun 2013, Chen Gang wrote:
> 
>> > On 06/19/2013 05:59 PM, Thomas Gleixner wrote:
>>> > > I'm well aware how that works. And there is no difference whether you
>>> > > do:
>>> > > 
>>> > > 	local_irq_save(flags);
>>> > > 	spin_lock(&lock);
>>> > > or
>>> > > 	spin_lock_irqsave(&lock, flags);
>> > 
>> > if CONFIG_LOCKDEP is not defined, they are not semantically the same.
> Care to explain _your_ spinlock semantics to me?
> 
> The factual ones are:
> 
>     spin_lock_irqsave() returns with the lock held, interrupts and
>     preemption disabled. 
> 

Yes.

>     spin_lock() returns with the lock held, preemption disabled. It
>     does not affect interrupt disabled/enabled state
> 

Yes.

> So
> 	local_irq_save(flags);
> 	spin_lock(&lock);
> 
> is semantically the same as 
> 
> 	spin_lock_irqsave(&lock, flags);
> 

Yes (but reverse is NO).

> And this is completely independent of LOCKDEP.

NO.

 	spin_lock_irqsave(&lock, flags);

 is not semantically the same as

 	local_irq_save(flags);
 	spin_lock(&lock);

It depend on the spin_lock_irqsave() implementation, if the parameters
has no relation ship with each other, semantically the same.


Thanks.
-- 
Chen Gang

Asianux Corporation
--
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