All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Cousson, Benoit" <b-cousson@ti.com>
To: "Kanigeri, Hari" <h-kanigeri2@ti.com>
Cc: "Marathe, Yogesh" <yogesh_marathe@ti.com>,
	"Premi, Sanjeev" <premi@ti.com>,
	Linux Omap <linux-omap@vger.kernel.org>,
	Tony Lindgren <tony@atomide.com>,
	"Shilimkar, Santosh" <santosh.shilimkar@ti.com>,
	"Que, Simon" <sque@ti.com>
Subject: Re: [PATCH 3/5] omap:hwspinlock-added hwspinlock driver
Date: Thu, 29 Jul 2010 15:23:52 +0200	[thread overview]
Message-ID: <4C5180E8.3060105@ti.com> (raw)
In-Reply-To: <8F7AF80515AF0D4D93307E594F3CB40E4D2F3F83@dlee03.ent.ti.com>

On 7/29/2010 3:14 PM, Kanigeri, Hari wrote:
> Yogesh,
>
> Nice to see your email.
>
>>>> +/* Release a spinlock */
>>>> +int hwspinlock_unlock(struct hwspinlock *handle)
>>>> +{
>>>> +     if (WARN_ON(handle == NULL))
>>>> +             return -EINVAL;
>>>> +
>>>> +     /* Release it by writing 0 to it */
>>>> +     writel(0, handle->lock_reg);
>>
>> [[Yogesh Marathe]] Releasing the spinlock without knowing who owns it is
>> risky. There should be a check for ownership and if authenticated user has
>> called this api  only then it should be released otherwise permission
>> denied error should be returned.
>
> -- I think if there is another Kernel client that is trying to release that is not owned by it then that Kernel client itself is buggy and needs to be fixed. Please share your thoughts on how we can ensure that we can add some protection.

Yes, I think so as well. The hwspinlock itself was done to be simple. 
The HW is not even checking that the processor that is taking the 
spinlock is the one that will release it.

This is maybe not the ideal and safe way to do that, but I'm not sure 
that we need to add some more complexity than needed for such a basic IP.

BTW, is a Linux kernel spinlock taking care of ownership?

Benoit

>
>>
>>>> +
>>>> +     pm_runtime_put(&handle->pdev->dev);
>>>> +
>>>> +     return 0;
>
> Thank you,
> Best regards,
> Hari


  reply	other threads:[~2010-07-29 13:23 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-19 16:50 [PATCH 0/5] omap:hwspinlock support-omap4 Hari Kanigeri
2010-07-19 16:50 ` [PATCH 1/5] omap:hwmod-hwspinlock-enable Hari Kanigeri
2010-07-27 15:57   ` Premi, Sanjeev
2010-07-27 16:05     ` Cousson, Benoit
2010-07-19 16:50 ` [PATCH 2/5] omap:hwspinlock-define HWSPINLOCK base address Hari Kanigeri
2010-07-27 15:59   ` Premi, Sanjeev
2010-07-27 16:50     ` Kanigeri, Hari
2010-07-28 14:11       ` Premi, Sanjeev
2010-07-28 14:22         ` Kanigeri, Hari
2010-07-28 14:33           ` Premi, Sanjeev
2010-07-28 14:55             ` Kanigeri, Hari
2010-07-19 16:50 ` [PATCH 3/5] omap:hwspinlock-added hwspinlock driver Hari Kanigeri
2010-07-24 16:43   ` Cousson, Benoit
2010-07-26 20:39     ` Kanigeri, Hari
2010-07-28 16:58   ` Premi, Sanjeev
2010-07-29  4:56     ` Marathe, Yogesh
2010-07-29 13:14       ` Kanigeri, Hari
2010-07-29 13:23         ` Cousson, Benoit [this message]
2010-07-30  6:53         ` Marathe, Yogesh
2010-08-02  1:55           ` Kanigeri, Hari
2010-07-29 13:29     ` Kanigeri, Hari
2010-07-29 14:05   ` Nishanth Menon
2010-08-11 22:03     ` Que, Simon
2010-08-12  2:02       ` linux hardware spinlock framework for heterogeneous processor SOCs? Nishanth Menon
2010-07-19 16:50 ` [PATCH 4/5] omap:hwspinlock-add build support Hari Kanigeri
2010-07-19 16:50 ` [PATCH 5/5] omap:hwspinlocks-ensure the order of registration Hari Kanigeri
2010-07-28 17:00   ` Premi, Sanjeev
2010-07-28 17:05     ` Kanigeri, Hari
2010-07-20  5:37 ` [PATCH 0/5] omap:hwspinlock support-omap4 Shilimkar, Santosh
2010-07-20 14:12   ` Kanigeri, Hari
2010-07-24 15:04     ` Cousson, Benoit
2010-07-24 15:35       ` Shilimkar, Santosh
2010-07-24 15:47         ` Cousson, Benoit

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=4C5180E8.3060105@ti.com \
    --to=b-cousson@ti.com \
    --cc=h-kanigeri2@ti.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=premi@ti.com \
    --cc=santosh.shilimkar@ti.com \
    --cc=sque@ti.com \
    --cc=tony@atomide.com \
    --cc=yogesh_marathe@ti.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.