public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Lan Tianyu <tianyu.lan@intel.com>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: lenb@kernel.org, linux-acpi@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ACPI/OSL: Remove RCU in the osl.c to avoid dead lock with cpu hot plug
Date: Thu, 07 Aug 2014 17:31:06 +0800	[thread overview]
Message-ID: <53E3475A.9090301@intel.com> (raw)
In-Reply-To: <5565710.HfsfjXfcL3@vostro.rjw.lan>

On 2014年08月07日 03:09, Rafael J. Wysocki wrote:
> On Wednesday, August 06, 2014 10:22:45 AM Lan Tianyu wrote:
>> On 2014年08月06日 09:24, Rafael J. Wysocki wrote:
>>> On Monday, August 04, 2014 04:40:08 PM Lan Tianyu wrote:
> 
> [cut]
> 
>>>> @@ -298,29 +298,29 @@ void __iomem *acpi_os_get_iomem(acpi_physical_address phys, unsigned int size)
>>>>  {
>>>>  	struct acpi_ioremap *map;
>>>>  	void __iomem *virt = NULL;
>>>> +	unsigned long flags;
>>>>  
>>>> -	mutex_lock(&acpi_ioremap_lock);
>>>> +	spin_lock_irqsave(&acpi_ioremap_lock, flags);
>>>
>>> Why do you need to do _irqsave here?  It was a mutex before, after all,
>>> so it can't be called from interrupt context.
>>>
>>> In other places below too.
>>
>> Original code uses RCU lock to protect acpi_ioremaps list in the
>> acpi_os_read/write_memory() which will be called in apei_read/write().
>> apei_read/write() will be called in the interrupt from APEI comments.
> 
> But acpi_os_get_iomem() won't be called from interrupt context and should use
> spin_lock_irq() instead of _irqsave.  This also applies to the other places
> that use the mutex.

Yes, that's correct. Sorry. I misunderstood what you meant.

> 
>> Now replace RCU with acpi_ioremap_lock and the lock will be called in
>> the interrupt. So redefine it to spin lock. From history,
>> acpi_ioremap_lock was spin lock before adding RCU support.
> 
> And it had scalability problems IIRC.
> 
> Did you consider using SRCU instead of going back to the spinlock?

No, I will have a look at SRCU.

> 
> Rafael
> 


-- 
Best regards
Tianyu Lan

  reply	other threads:[~2014-08-07  9:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-04  8:40 [PATCH] ACPI/OSL: Remove RCU in the osl.c to avoid dead lock with cpu hot plug Lan Tianyu
2014-08-06  1:24 ` Rafael J. Wysocki
2014-08-06  2:22   ` Lan Tianyu
2014-08-06 19:09     ` Rafael J. Wysocki
2014-08-07  9:31       ` Lan Tianyu [this message]
2014-08-12  2:59       ` [PATCH V2] ACPI/OSL: Replace synchronize_rcu() with call_rcu() in the acpi_os_map_cleanup() " Lan Tianyu
2014-08-14  0:04         ` Rafael J. Wysocki

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=53E3475A.9090301@intel.com \
    --to=tianyu.lan@intel.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    /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