From: "Zheng, Lv" <lv.zheng@intel.com>
To: "paulmck@linux.vnet.ibm.com" <paulmck@linux.vnet.ibm.com>,
"Rafael J. Wysocki" <rafael@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>,
"Wysocki, Rafael J" <rafael.j.wysocki@intel.com>,
"Moore, Robert" <robert.moore@intel.com>,
"J?rg R?del" <joro@8bytes.org>,
lkml <linux-kernel@vger.kernel.org>,
Linux ACPI <linux-acpi@vger.kernel.org>
Subject: RE: 174cc7187e6f ACPICA: Tables: Back port acpi_get_table_with_size() and early_acpi_os_unmap_memory() from Linux kernel
Date: Tue, 10 Jan 2017 05:41:45 +0000 [thread overview]
Message-ID: <1AE640813FDE7649BE1B193DEA596E886CE286C3@SHSMSX101.ccr.corp.intel.com> (raw)
In-Reply-To: <20170110022338.GJ3800@linux.vnet.ibm.com>
Hi, Rafael and Paul
> From: Paul E. McKenney [mailto:paulmck@linux.vnet.ibm.com]
> Subject: Re: 174cc7187e6f ACPICA: Tables: Back port acpi_get_table_with_size() and
> early_acpi_os_unmap_memory() from Linux kernel
>
> On Tue, Jan 10, 2017 at 02:27:16AM +0100, Rafael J. Wysocki wrote:
> > On Tue, Jan 10, 2017 at 12:52 AM, Borislav Petkov <bp@alien8.de> wrote:
> > > On Tue, Jan 10, 2017 at 12:40:39AM +0100, Borislav Petkov wrote:
> > >> Lemme run it.
> > >
> > > Well, it boots but I get:
> > >
> > > [ 0.291447] ------------[ cut here ]------------
> > > [ 0.291702] WARNING: CPU: 0 PID: 1 at kernel/rcu/tree.c:3993 rcu_scheduler_starting+0x5c/0x70
> > > [ 0.292107] Modules linked in:
> > > [ 0.292277] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.10.0-rc3+ #21
> > > [ 0.292540] Hardware name: HP HP EliteBook 745 G3/807E, BIOS N73 Ver. 01.08 01/28/2016
> > > [ 0.292893] Call Trace:
> > > [ 0.293072] ? dump_stack+0x46/0x63
> > > [ 0.293285] ? __warn+0xec/0x110
> > > [ 0.293487] ? rcu_scheduler_starting+0x5c/0x70
> > > [ 0.293735] ? kernel_init_freeable+0x58/0x19a
> > > [ 0.293976] ? rest_init+0x80/0x80
> > > [ 0.294153] ? kernel_init+0xa/0x100
> > > [ 0.294334] ? ret_from_fork+0x22/0x30
> > > [ 0.294525] ---[ end trace 4c0fe009ed4dc740 ]---
> > >
> > > TBH, I like Rafael's suggestion in the other mail to stick with fixing
> > > this in ACPI, especially this is an ACPI problem, not RCU. Well,
> > > more or less: RCU could be taught to *not* do schedule_work() if
> > > workqueue_init() hasn't happened yet but that's a tangential.
> > >
> > > So, I'm going to bed. When I wake up, I want to see working fixes!
> > >
> > > :-)))
> >
> > Well, if the https://patchwork.kernel.org/patch/9504277/ patch from Lv
> > worked, the attached one should work too (please test), but it can be
> > justified in a slightly more convincing way.
> >
> > Namely, the idea is that acpi_os_read/write_memory() should never be
> > used before invoking acpi_os_initialize() and since those are the only
> > places where the list of memory regions is walked under RCU without
> > extra locking, it is safe to skip the RCU synchronization until that
> > happens.
> >
> > Thanks,
> > Rafael
>
> Makes sense to me!
Also looks good to me.
>
> It looks like I can make the grace-period-free boot-time window
> for CONFIG_PREEMPT=y kernels quite a bit narrower, but it does not
> look like something suitable for jamming into 4.10.
OK, we can have this fixed in ACPI layer first.
Thanks
Lv
>
> Thanx, Paul
>
> > ---
> > drivers/acpi/osl.c | 8 +++++++-
> > 1 file changed, 7 insertions(+), 1 deletion(-)
> >
> > Index: linux-pm/drivers/acpi/osl.c
> > ===================================================================
> > --- linux-pm.orig/drivers/acpi/osl.c
> > +++ linux-pm/drivers/acpi/osl.c
> > @@ -378,7 +378,9 @@ static void acpi_os_drop_map_ref(struct
> > static void acpi_os_map_cleanup(struct acpi_ioremap *map)
> > {
> > if (!map->refcount) {
> > - synchronize_rcu_expedited();
> > + if (acpi_os_initialized)
> > + synchronize_rcu_expedited();
> > +
> > acpi_unmap(map->phys, map->virt);
> > kfree(map);
> > }
> > @@ -671,6 +673,8 @@ acpi_os_read_memory(acpi_physical_addres
> > bool unmap = false;
> > u64 dummy;
> >
> > + WARN_ON_ONCE(!acpi_os_initialized);
> > +
> > rcu_read_lock();
> > virt_addr = acpi_map_vaddr_lookup(phys_addr, size);
> > if (!virt_addr) {
> > @@ -716,6 +720,8 @@ acpi_os_write_memory(acpi_physical_addre
> > unsigned int size = width / 8;
> > bool unmap = false;
> >
> > + WARN_ON_ONCE(!acpi_os_initialized);
> > +
> > rcu_read_lock();
> > virt_addr = acpi_map_vaddr_lookup(phys_addr, size);
> > if (!virt_addr) {
next prev parent reply other threads:[~2017-01-10 5:41 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20170107204227.bwdb5yzrjpiggkmo@pd.tnic>
2017-01-07 23:30 ` 174cc7187e6f ACPICA: Tables: Back port acpi_get_table_with_size() and early_acpi_os_unmap_memory() from Linux kernel Rafael J. Wysocki
2017-01-08 0:07 ` Borislav Petkov
2017-01-08 0:22 ` Rafael J. Wysocki
2017-01-08 0:37 ` Borislav Petkov
2017-01-08 0:52 ` Rafael J. Wysocki
2017-01-08 1:01 ` Borislav Petkov
2017-01-08 1:45 ` Rafael J. Wysocki
2017-01-08 2:20 ` Rafael J. Wysocki
2017-01-08 13:03 ` Borislav Petkov
2017-01-09 1:58 ` Zheng, Lv
2017-01-09 2:36 ` Zheng, Lv
2017-01-09 9:33 ` Borislav Petkov
2017-01-09 22:18 ` Paul E. McKenney
2017-01-09 22:25 ` Rafael J. Wysocki
2017-01-09 23:14 ` Paul E. McKenney
2017-01-09 23:15 ` Borislav Petkov
2017-01-09 23:32 ` Paul E. McKenney
2017-01-09 23:40 ` Borislav Petkov
2017-01-09 23:52 ` Paul E. McKenney
2017-01-09 23:52 ` Borislav Petkov
2017-01-10 0:44 ` Zheng, Lv
2017-01-10 1:27 ` Rafael J. Wysocki
2017-01-10 2:23 ` Paul E. McKenney
2017-01-10 5:41 ` Zheng, Lv [this message]
2017-01-10 5:51 ` Paul E. McKenney
2017-01-11 9:21 ` Borislav Petkov
2017-01-11 9:51 ` Paul E. McKenney
2017-01-11 10:03 ` Borislav Petkov
2017-01-11 10:22 ` Paul E. McKenney
2017-01-10 9:41 ` Borislav Petkov
2017-01-11 3:42 ` Rafael J. Wysocki
2017-01-11 9:42 ` Borislav Petkov
2017-01-09 23:42 ` Rafael J. Wysocki
2017-01-10 0:21 ` Paul E. McKenney
2017-01-09 5:21 ` Zheng, Lv
2017-01-09 10:52 ` Jörg Rödel
2017-01-09 22:41 ` Rafael J. Wysocki
2017-01-09 22:57 ` Borislav Petkov
2017-01-10 13:58 ` Jörg Rödel
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=1AE640813FDE7649BE1B193DEA596E886CE286C3@SHSMSX101.ccr.corp.intel.com \
--to=lv.zheng@intel.com \
--cc=bp@alien8.de \
--cc=joro@8bytes.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@linux.vnet.ibm.com \
--cc=rafael.j.wysocki@intel.com \
--cc=rafael@kernel.org \
--cc=robert.moore@intel.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 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).