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: <20190215102635.kdo4yxifh5dt2yj7@pathway.suse.cz>
Date:   Fri, 15 Feb 2019 11:26:35 +0100
From:   Petr Mladek <pmladek@...e.com>
To:     John Ogness <john.ogness@...utronix.de>
Cc:     linux-kernel@...r.kernel.org,
        Peter Zijlstra <peterz@...radead.org>,
        Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>,
        Steven Rostedt <rostedt@...dmis.org>,
        Daniel Wang <wonderfly@...gle.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Alan Cox <gnomes@...rguk.ukuu.org.uk>,
        Jiri Slaby <jslaby@...e.com>,
        Peter Feiner <pfeiner@...gle.com>,
        linux-serial@...r.kernel.org,
        Sergey Senozhatsky <sergey.senozhatsky@...il.com>
Subject: Re: [RFC PATCH v1 02/25] printk-rb: add prb locking functions

On Thu 2019-02-14 13:10:28, John Ogness wrote:
> On 2019-02-14, Petr Mladek <pmladek@...e.com> wrote:
> >>> cpu_store looks like an implementation detail. The caller
> >>> needs to remember it to handle the nesting properly.
> >>> 
> >>> We could achieve the same with a recursion counter hidden
> >>> in struct prb_lock.
> >
> > The atomic operations are tricky. I feel other lost in them.
> > Well, I still think that it might easier to detect nesting
> > on the same CPU, see below.
> >
> > Also there is no need to store irq flags in per-CPU variable.
> > Only the first owner of the lock need to store the flags. The others
> > are spinning or nested.
> >
> > struct prb_cpulock {
> > 	atomic_t		owner;
> > 	unsigned int		flags;
> > 	int			nesting; /* intialized to 0 */
> > };
> >
> > void prb_lock(struct prb_cpulock *cpu_lock)
> > {
> > 	unsigned int flags;
> > 	int cpu;
> 
> I added an explicit preempt_disable here:
> 
>         cpu = get_cpu();

It is superfluous. Preemption is not possible when interrupts
are disabled.


> It looks great. I've run my stress tests on it and everything is running
> well.

I am glad to read this.
 
> Thanks for simplifying this!

You are welcome.

Best Regards,
Petr

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ