Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1554807

Re: 174cc7187e6f ACPICA: Tables: Back port acpi_get_table_with_size() and early_acpi_os_unmap_memory() from Linux kernel

From "Rafael J. Wysocki" <rafael@kernel.org>
Newsgroups linux.kernel
Subject Re: 174cc7187e6f ACPICA: Tables: Back port acpi_get_table_with_size() and early_acpi_os_unmap_memory() from Linux kernel
Date 2017-01-10 00:50 +0100
Message-ID <sXRRn-26v-11@gated-at.bofh.it> (permalink)
References (6 earlier) <sXy2m-6t3-15@gated-at.bofh.it> <sXEAO-2pA-11@gated-at.bofh.it> <sXQsi-1ot-19@gated-at.bofh.it> <sXRom-1WC-19@gated-at.bofh.it> <sXRHH-231-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, Jan 10, 2017 at 12:32 AM, Paul E. McKenney
<paulmck@linux.vnet.ibm.com> wrote:
> On Tue, Jan 10, 2017 at 12:15:01AM +0100, Borislav Petkov wrote:
>> On Mon, Jan 09, 2017 at 02:18:31PM -0800, Paul E. McKenney wrote:
>> > @@ -690,6 +690,8 @@ void synchronize_rcu_expedited(void)
>> >  {
>> >     struct rcu_state *rsp = rcu_state_p;
>> >
>> > +   if (!rcu_scheduler_active)
>> > +           return;
>> >     _synchronize_rcu_expedited(rsp, sync_rcu_exp_handler);
>> >  }
>> >  EXPORT_SYMBOL_GPL(synchronize_rcu_expedited);
>>
>> That doesn't work and it is because of those damn what goes before what
>> boot sequence issues :-\
>>
>> We have:
>>
>> rest_init()
>> |-> rcu_scheduler_starting()  ---> that sets rcu_scheduler_active = 1;
>> |-> kernel_thread(kernel_init, NULL, CLONE_FS);
>> |-> kernel_init()
>> |-> kernel_init_freeable()
>> |-> native_smp_prepare_cpus(setup_max_cpus)
>> |-> default_setup_apic_routing
>> |-> enable_IR_x2apic
>> |-> irq_remapping_prepare
>> |-> amd_iommu_prepare
>> |-> iommu_go_to_state
>> |-> acpi_put_table(ivrs_base);
>> |-> acpi_tb_put_table(table_desc);
>> |-> acpi_tb_invalidate_table(table_desc);
>> |-> acpi_tb_release_table(...)
>> |-> acpi_os_unmap_memory
>> |-> acpi_os_unmap_iomem
>> |-> acpi_os_map_cleanup
>> |-> synchronize_rcu_expedited()
>>
>> Now here we have rcu_scheduler_active already set so the test doesn't
>> hit and we hang.
>>
>> So we must do it differently.
>
> Yeah, there is a window just as the scheduler is starting where things don't
> work.
>
> We could move rcu_scheduler_starting() later, as long as there
> is no chance of preemption or context switch before it is invoked.
> Would that help in this case, or are we already context switching before
> acpi_os_map_cleanup() is invoked?

In the particular AMD IOMMU case it doesn't look like we are, but we
do in other cases.

> (If we are already context switching,
> short-circuiting synchronize_rcu_expedited() would be a bug.)

It may be easier to make the caller avoid RCU synchronization
altogether if that's not necessary and the caller should actually be
able to figure out when that's the case.

The patch from Lv at https://patchwork.kernel.org/patch/9504277/ goes
in the right direction IMO, but I'm not yet convinced that this is the
right one.

Thanks,
Rafael

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: 174cc7187e6f ACPICA: Tables: Back port acpi_get_table_with_size()  and early_acpi_os_unmap_memory() from Linux kernel "Rafael J. Wysocki" <rafael.j.wysocki@intel.com> - 2017-01-08 00:40 +0100
  Re: 174cc7187e6f ACPICA: Tables: Back port  acpi_get_table_with_size() and early_acpi_os_unmap_memory() from Linux  kernel Borislav Petkov <bp@alien8.de> - 2017-01-08 01:10 +0100
    Re: 174cc7187e6f ACPICA: Tables: Back port acpi_get_table_with_size()  and early_acpi_os_unmap_memory() from Linux kernel "Rafael J. Wysocki" <rafael@kernel.org> - 2017-01-08 01:30 +0100
      Re: 174cc7187e6f ACPICA: Tables: Back port  acpi_get_table_with_size() and early_acpi_os_unmap_memory() from Linux  kernel Borislav Petkov <bp@alien8.de> - 2017-01-08 01:40 +0100
        Re: 174cc7187e6f ACPICA: Tables: Back port acpi_get_table_with_size()  and early_acpi_os_unmap_memory() from Linux kernel "Rafael J. Wysocki" <rafael@kernel.org> - 2017-01-08 02:00 +0100
          Re: 174cc7187e6f ACPICA: Tables: Back port  acpi_get_table_with_size() and early_acpi_os_unmap_memory() from Linux  kernel Borislav Petkov <bp@alien8.de> - 2017-01-08 02:10 +0100
            Re: 174cc7187e6f ACPICA: Tables: Back port acpi_get_table_with_size()  and early_acpi_os_unmap_memory() from Linux kernel "Rafael J. Wysocki" <rafael@kernel.org> - 2017-01-08 02:50 +0100
              Re: 174cc7187e6f ACPICA: Tables: Back port acpi_get_table_with_size()  and early_acpi_os_unmap_memory() from Linux kernel "Rafael J. Wysocki" <rafael@kernel.org> - 2017-01-08 03:30 +0100
                Re: 174cc7187e6f ACPICA: Tables: Back port  acpi_get_table_with_size() and early_acpi_os_unmap_memory() from Linux  kernel Borislav Petkov <bp@alien8.de> - 2017-01-08 14:10 +0100
                RE: 174cc7187e6f ACPICA: Tables: Back port  acpi_get_table_with_size() and early_acpi_os_unmap_memory() from Linux kernel "Zheng, Lv" <lv.zheng@intel.com> - 2017-01-09 03:00 +0100
                RE: 174cc7187e6f ACPICA: Tables: Back port  acpi_get_table_with_size() and early_acpi_os_unmap_memory() from Linux kernel "Zheng, Lv" <lv.zheng@intel.com> - 2017-01-09 03:40 +0100
                Re: 174cc7187e6f ACPICA: Tables: Back port  acpi_get_table_with_size() and early_acpi_os_unmap_memory() from Linux  kernel Borislav Petkov <bp@alien8.de> - 2017-01-09 10:40 +0100
                Re: 174cc7187e6f ACPICA: Tables: Back port  acpi_get_table_with_size() and early_acpi_os_unmap_memory() from Linux  kernel "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-01-09 23:20 +0100
                Re: 174cc7187e6f ACPICA: Tables: Back port acpi_get_table_with_size()  and early_acpi_os_unmap_memory() from Linux kernel "Rafael J. Wysocki" <rafael@kernel.org> - 2017-01-09 23:30 +0100
                Re: 174cc7187e6f ACPICA: Tables: Back port  acpi_get_table_with_size() and early_acpi_os_unmap_memory() from Linux  kernel "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-01-10 00:20 +0100
                Re: 174cc7187e6f ACPICA: Tables: Back port  acpi_get_table_with_size() and early_acpi_os_unmap_memory() from Linux  kernel Borislav Petkov <bp@alien8.de> - 2017-01-10 00:20 +0100
                Re: 174cc7187e6f ACPICA: Tables: Back port  acpi_get_table_with_size() and early_acpi_os_unmap_memory() from Linux  kernel "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-01-10 00:40 +0100
                Re: 174cc7187e6f ACPICA: Tables: Back port  acpi_get_table_with_size() and early_acpi_os_unmap_memory() from Linux  kernel Borislav Petkov <bp@alien8.de> - 2017-01-10 00:50 +0100
                Re: 174cc7187e6f ACPICA: Tables: Back port  acpi_get_table_with_size() and early_acpi_os_unmap_memory() from Linux  kernel Borislav Petkov <bp@alien8.de> - 2017-01-10 01:00 +0100
                RE: 174cc7187e6f ACPICA: Tables: Back port  acpi_get_table_with_size() and early_acpi_os_unmap_memory() from Linux kernel "Zheng, Lv" <lv.zheng@intel.com> - 2017-01-10 01:50 +0100
                Re: 174cc7187e6f ACPICA: Tables: Back port acpi_get_table_with_size()  and early_acpi_os_unmap_memory() from Linux kernel "Rafael J. Wysocki" <rafael@kernel.org> - 2017-01-10 02:30 +0100
                Re: 174cc7187e6f ACPICA: Tables: Back port  acpi_get_table_with_size() and early_acpi_os_unmap_memory() from Linux  kernel "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-01-10 03:30 +0100
                RE: 174cc7187e6f ACPICA: Tables: Back port  acpi_get_table_with_size() and early_acpi_os_unmap_memory() from Linux kernel "Zheng, Lv" <lv.zheng@intel.com> - 2017-01-10 06:50 +0100
                Re: 174cc7187e6f ACPICA: Tables: Back port  acpi_get_table_with_size() and early_acpi_os_unmap_memory() from Linux  kernel "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-01-10 07:00 +0100
                Re: 174cc7187e6f ACPICA: Tables: Back port  acpi_get_table_with_size() and early_acpi_os_unmap_memory() from Linux  kernel Borislav Petkov <bp@alien8.de> - 2017-01-11 10:30 +0100
                Re: 174cc7187e6f ACPICA: Tables: Back port  acpi_get_table_with_size() and early_acpi_os_unmap_memory() from Linux  kernel "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-01-11 11:00 +0100
                Re: 174cc7187e6f ACPICA: Tables: Back port  acpi_get_table_with_size() and early_acpi_os_unmap_memory() from Linux  kernel Borislav Petkov <bp@alien8.de> - 2017-01-11 11:10 +0100
                Re: 174cc7187e6f ACPICA: Tables: Back port  acpi_get_table_with_size() and early_acpi_os_unmap_memory() from Linux  kernel "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-01-11 11:30 +0100
                Re: 174cc7187e6f ACPICA: Tables: Back port  acpi_get_table_with_size() and early_acpi_os_unmap_memory() from Linux  kernel Borislav Petkov <bp@alien8.de> - 2017-01-10 10:50 +0100
                Re: 174cc7187e6f ACPICA: Tables: Back port acpi_get_table_with_size()  and early_acpi_os_unmap_memory() from Linux kernel "Rafael J. Wysocki" <rafael@kernel.org> - 2017-01-11 04:50 +0100
                Re: 174cc7187e6f ACPICA: Tables: Back port  acpi_get_table_with_size() and early_acpi_os_unmap_memory() from Linux  kernel Borislav Petkov <bp@alien8.de> - 2017-01-11 10:50 +0100
                Re: 174cc7187e6f ACPICA: Tables: Back port  acpi_get_table_with_size() and early_acpi_os_unmap_memory() from Linux  kernel "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-01-10 01:00 +0100
                Re: 174cc7187e6f ACPICA: Tables: Back port acpi_get_table_with_size()  and early_acpi_os_unmap_memory() from Linux kernel "Rafael J. Wysocki" <rafael@kernel.org> - 2017-01-10 00:50 +0100
                Re: 174cc7187e6f ACPICA: Tables: Back port  acpi_get_table_with_size() and early_acpi_os_unmap_memory() from Linux  kernel "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-01-10 01:30 +0100
                RE: 174cc7187e6f ACPICA: Tables: Back port  acpi_get_table_with_size() and early_acpi_os_unmap_memory() from Linux kernel "Zheng, Lv" <lv.zheng@intel.com> - 2017-01-09 06:30 +0100
                Re: 174cc7187e6f ACPICA: Tables: Back port  acpi_get_table_with_size() and early_acpi_os_unmap_memory() from Linux  kernel Jörg Rödel <joro@8bytes.org> - 2017-01-09 12:00 +0100
                Re: 174cc7187e6f ACPICA: Tables: Back port acpi_get_table_with_size() and early_acpi_os_unmap_memory() from Linux kernel "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2017-01-09 23:50 +0100
                Re: 174cc7187e6f ACPICA: Tables: Back port  acpi_get_table_with_size() and early_acpi_os_unmap_memory() from Linux  kernel Borislav Petkov <bp@alien8.de> - 2017-01-10 00:00 +0100
                Re: 174cc7187e6f ACPICA: Tables: Back port  acpi_get_table_with_size() and early_acpi_os_unmap_memory() from Linux  kernel Jörg Rödel <joro@8bytes.org> - 2017-01-10 15:00 +0100

csiph-web