All of lore.kernel.org
 help / color / mirror / Atom feed
From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Cc: Antoine Tenart <antoine.tenart@free-electrons.com>,
	thierry.reding@gmail.com, zmxu@marvell.com, jszhang@marvell.com,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-pwm@vger.kernel.org
Subject: Re: [PATCH v4 1/5] pwm: add the Berlin pwm controller driver
Date: Tue, 18 Aug 2015 13:04:53 +0100	[thread overview]
Message-ID: <20150818120452.GP7557@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <55D31CB7.9030504@gmail.com>

On Tue, Aug 18, 2015 at 01:53:27PM +0200, Sebastian Hesselbarth wrote:
> On 08/18/2015 01:38 PM, Antoine Tenart wrote:
> >+	val = berlin_pwm_readl(pwm, pwm_dev->hwpwm, BERLIN_PWM_CONTROL);
> >+	val &= ~BERLIN_PWM_PRESCALE_MASK;
> >+	val |= prescale;
> >+	berlin_pwm_writel(val, pwm, pwm_dev->hwpwm, BERLIN_PWM_CONTROL);
> >+
> >+	berlin_pwm_writel(duty, pwm, pwm_dev->hwpwm, BERLIN_PWM_DUTY);
> >+	berlin_pwm_writel(period, pwm, pwm_dev->hwpwm, BERLIN_PWM_TCNT);
> 
> The reason why I usually tend to _not_ use _relaxed() in low-performance
> setup code is that you'll have to think about reordering issues when
> using _relaxed ones.

If that is your concern, then you should read Documentation/memory-barriers.txt,
specifically the section on "ACQUIRES VS I/O ACCESSES".  Using the non-
relaxed accessors doesn't save you in every circumstance.

> The question here is: Is it _guaranteed_ that above writel_relaxed()
> will be issued _before_ actually releasing the spin_lock?

There is no guarantee on all hardware that writel() will be seen by the
hardware before other accesses within a separate spinlocked region
using the same lock.

-- 
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.

WARNING: multiple messages have this Message-ID (diff)
From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v4 1/5] pwm: add the Berlin pwm controller driver
Date: Tue, 18 Aug 2015 13:04:53 +0100	[thread overview]
Message-ID: <20150818120452.GP7557@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <55D31CB7.9030504@gmail.com>

On Tue, Aug 18, 2015 at 01:53:27PM +0200, Sebastian Hesselbarth wrote:
> On 08/18/2015 01:38 PM, Antoine Tenart wrote:
> >+	val = berlin_pwm_readl(pwm, pwm_dev->hwpwm, BERLIN_PWM_CONTROL);
> >+	val &= ~BERLIN_PWM_PRESCALE_MASK;
> >+	val |= prescale;
> >+	berlin_pwm_writel(val, pwm, pwm_dev->hwpwm, BERLIN_PWM_CONTROL);
> >+
> >+	berlin_pwm_writel(duty, pwm, pwm_dev->hwpwm, BERLIN_PWM_DUTY);
> >+	berlin_pwm_writel(period, pwm, pwm_dev->hwpwm, BERLIN_PWM_TCNT);
> 
> The reason why I usually tend to _not_ use _relaxed() in low-performance
> setup code is that you'll have to think about reordering issues when
> using _relaxed ones.

If that is your concern, then you should read Documentation/memory-barriers.txt,
specifically the section on "ACQUIRES VS I/O ACCESSES".  Using the non-
relaxed accessors doesn't save you in every circumstance.

> The question here is: Is it _guaranteed_ that above writel_relaxed()
> will be issued _before_ actually releasing the spin_lock?

There is no guarantee on all hardware that writel() will be seen by the
hardware before other accesses within a separate spinlocked region
using the same lock.

-- 
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.

  reply	other threads:[~2015-08-18 12:05 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-18 11:38 [PATCH v4 0/5] ARM: berlin: PWM support Antoine Tenart
2015-08-18 11:38 ` Antoine Tenart
2015-08-18 11:38 ` [PATCH v4 1/5] pwm: add the Berlin pwm controller driver Antoine Tenart
2015-08-18 11:38   ` Antoine Tenart
2015-08-18 11:53   ` Sebastian Hesselbarth
2015-08-18 11:53     ` Sebastian Hesselbarth
2015-08-18 12:04     ` Russell King - ARM Linux [this message]
2015-08-18 12:04       ` Russell King - ARM Linux
2015-08-18 11:38 ` [PATCH v4 2/5] Documentation: bindings: document the Berlin PWM driver Antoine Tenart
2015-08-18 11:38   ` Antoine Tenart
2015-08-18 11:38   ` Antoine Tenart
2015-08-18 11:38 ` [PATCH v4 3/5] ARM: berlin: add a PWM node on the BG2Q Antoine Tenart
2015-08-18 11:38   ` Antoine Tenart
2015-08-18 11:38   ` Antoine Tenart
2015-08-18 11:38 ` [PATCH v4 4/5] ARM: berlin: add a PWM node on the BG2 Antoine Tenart
2015-08-18 11:38   ` Antoine Tenart
2015-08-18 11:38 ` [PATCH v4 5/5] ARM: berlin: add a PWM node on the BG2CD Antoine Tenart
2015-08-18 11:38   ` Antoine Tenart

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=20150818120452.GP7557@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=antoine.tenart@free-electrons.com \
    --cc=jszhang@marvell.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=sebastian.hesselbarth@gmail.com \
    --cc=thierry.reding@gmail.com \
    --cc=zmxu@marvell.com \
    /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.