linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ohad Ben-Cohen <ohad@wizery.com>
To: Lina Iyer <lina.iyer@linaro.org>
Cc: Bjorn Andersson <bjorn.andersson@sonymobile.com>,
	Jeffrey Hugo <jhugo@codeaurora.org>,
	"linux-arm-msm@vger.kernel.org" <linux-arm-msm@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH RFC v2 0/2] hwspinlock: Introduce raw capability for hwspinlock_device
Date: Thu, 13 Aug 2015 09:34:13 +0300	[thread overview]
Message-ID: <CAK=WgbatEexJNMipJpE7z5MkMO99dat=L=jH6uKMg+eR3x6CwA@mail.gmail.com> (raw)
In-Reply-To: <20150728215122.GE51847@linaro.org>

On Wed, Jul 29, 2015 at 12:51 AM, Lina Iyer <lina.iyer@linaro.org> wrote:
>> Let's not make this more complicated than needed, so please add the
>> hwcaps member to hwspinlock_device instead of to hwspinlock struct. We
>> could always change this later if it proves to be insufficient.
>>
> But this could yield wrong locking scenarios. If banks are allowed RAW
> capability and is not enforced on a per-lock basis, a driver may lock
> using non-raw lock using the _raw API, while another driver may
> 'acquire' the lock (since the value written to the lock would be the
> same as raw api would). That is why you should have the capability on
> hwspinlock and not on hwspinlock_device. Locks that are defined are RAW
> capable should be used as RAW only.
>
> QCOM platform hwlock #7 is unique that different CPUs trying to acquire
> the lock would write different values and hence would be fine. But, the
> same is not true for other locks in the bank.

As far as I understand, there is nothing special about QCOM's hwlock
#7 in terms of hardware. It's exactly the same lock as all the others.

The only difference in hwlock #7 is the way you use it, and that
sounds like a decision the driver should be able to make. It's a
policy, and I'm not sure we should put it in the DT. I'm also not sure
we need this hwlock-specific complexity in the hwspinlock framework.

The driver already makes a decision whether to disable the interrupts
or not and whether to save their state or not. So it can also make a
decision whether to take a sw spinlock at all or not --- if the
hardware allows it. and that if should be encoded in an accessible
vendor specific (not hwlock specific) struct, which is setup by the
underlying vendor specific hwspinlock driver (no DT involved).

Let's go over your aforementioned concerns:
> But this could yield wrong locking scenarios. If banks are allowed RAW
> capability and is not enforced on a per-lock basis, a driver may lock
> using non-raw lock using the _raw API

If this is allowed by the hardware, then this is a valid scenario.
There's no such thing a non-raw lock: a lock is raw if a raw
functionality is required.

> while another driver may
> 'acquire' the lock (since the value written to the lock would be the
> same as raw api would).

Not sure I understand this one. If a lock has already been assigned to
a driver, it cannot be re-assigned to another driver.

Thanks,
Ohad.

  reply	other threads:[~2015-08-13  6:34 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-09 16:23 [PATCH RFC v2 0/2] hwspinlock: Introduce raw capability for hwspinlock_device Lina Iyer
2015-06-09 16:23 ` [PATCH RFC v2 1/2] hwspinlock: Introduce raw capability for hwspinlocks Lina Iyer
2015-06-09 16:59   ` Jeffrey Hugo
2015-06-09 16:23 ` [PATCH RFC v2 2/2] hwspinlock: qcom: Lock #7 is special lock, uses dynamic proc_id Lina Iyer
2015-06-10 17:33   ` Bjorn Andersson
2015-06-10 20:13     ` Lina Iyer
2015-06-27  3:05 ` [PATCH RFC v2 0/2] hwspinlock: Introduce raw capability for hwspinlock_device Lina Iyer
2015-06-27 11:25   ` Ohad Ben-Cohen
2015-07-02 20:30     ` Lina Iyer
2015-07-18 11:31       ` Ohad Ben-Cohen
2015-07-28 21:51         ` Lina Iyer
2015-08-13  6:34           ` Ohad Ben-Cohen [this message]
2015-08-13 15:25             ` Andy Gross
2015-08-14 10:52               ` Ohad Ben-Cohen
2015-08-14 13:52                 ` Lina Iyer
2015-08-14 15:24             ` Lina Iyer
2015-09-20 13:02               ` Ohad Ben-Cohen

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='CAK=WgbatEexJNMipJpE7z5MkMO99dat=L=jH6uKMg+eR3x6CwA@mail.gmail.com' \
    --to=ohad@wizery.com \
    --cc=bjorn.andersson@sonymobile.com \
    --cc=jhugo@codeaurora.org \
    --cc=lina.iyer@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).