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: <20141020170603.GG10616@piout.net>
Date:	Mon, 20 Oct 2014 19:06:04 +0200
From:	Alexandre Belloni <alexandre.belloni@...e-electrons.com>
To:	Vladimir Zapolskiy <vz@...ia.com>
Cc:	Thierry Reding <thierry.reding@...il.com>,
	Maxime Ripard <maxime.ripard@...e-electrons.com>,
	jonsmirl@...il.com, Simon <longsleep@...il.com>,
	linux-pwm@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCHv8 1/2] pwm: Add Allwinner SoC support

On 20/10/2014 at 16:10:31 +0300, Vladimir Zapolskiy wrote :
> Hi Alexandre,
> 
> On 20.10.2014 13:29, Alexandre Belloni wrote:
> > Hi,
> > 
> > On 20/10/2014 at 00:22:57 +0300, Vladimir Zapolskiy wrote :
> >>> +struct sun4i_pwm_chip {
> >>> +	struct pwm_chip chip;
> >>> +	struct clk *clk;
> >>> +	void __iomem *base;
> >>> +	struct mutex ctrl_lock;
> >>
> >> why do you use mutex? I haven't found any blocking subcalls under
> >> protection, a spinlock seems to fit better here.
> >>
> > 
> > A mutex here will do the right thing. The lock is never taken in
> > interrupt context and a mutex is spinning for a few cycles before
> > putting the thread to sleep.
> 
> and why do you want to put a thread to sleep in context of the driver?
> 

Because the PWM is getting configured from either a kernel thread or a
userspace thread accessing /sys. So you probably want the current thread
to sleep so the other thread accessing the register can finish. Unless
you are on smp and then, the mutex will spin for some time and your
other cpu will be finished by then.


-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
--
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