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


Groups > linux.kernel > #1467629

Re: [PATCH] iommu/vt-d: Fix modify_irte NULL pointer

From Wanpeng Li <kernellwp@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH] iommu/vt-d: Fix modify_irte NULL pointer
Date 2016-08-22 15:40 +0200
Message-ID <s8XCh-6TY-3@gated-at.bofh.it> (permalink)
References <s8Wwy-6dZ-15@gated-at.bofh.it> <s8WPT-6md-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


2016-08-22 20:38 GMT+08:00 Thomas Gleixner <tglx@linutronix.de>:
> On Mon, 22 Aug 2016, Wanpeng Li wrote:
>
>> From: Wanpeng Li <wanpeng.li@hotmail.com>
>>
>> native_smp_prepare_cpus
>>   -> default_setup_apic_routing
>>     -> enable_IR_x2apic
>>       -> irq_remapping_prepare
>>         -> intel_prepare_irq_remapping
>>           -> parse_ioapics_under_ir   => return 0
>>                   -> ir_parse_ioapic_hpet_scope
>>                     -> ir_parse_one_ioapic_scope
>>           -> intel_setup_irq_remapping
>
>> IR table is setup even if noapic boot parameter is added.
>> index ac59692..f1cb7c6 100644
>> --- a/drivers/iommu/intel_irq_remapping.c
>> +++ b/drivers/iommu/intel_irq_remapping.c
>> @@ -854,6 +854,9 @@ static int ir_parse_one_ioapic_scope(struct acpi_dmar_device_scope *scope,
>>       count = (scope->length - sizeof(struct acpi_dmar_device_scope))
>>               / sizeof(struct acpi_dmar_pci_path);
>>
>> +     if (skip_ioapic_setup)
>> +             return -ENODEV;
>
> Why are you adding this in the iommu code? We should not call any of the apic
> functions when apic is disabled.

Good point, how about something like this(untested, I will test it tomorrow):

diff --git a/arch/x86/kernel/apic/probe_32.c b/arch/x86/kernel/apic/probe_32.c
index 7c43e71..152d627 100644
--- a/arch/x86/kernel/apic/probe_32.c
+++ b/arch/x86/kernel/apic/probe_32.c
@@ -154,6 +154,9 @@ void __init default_setup_apic_routing(void)
 {
        int version = apic_version[boot_cpu_physical_apicid];

+       if (skip_ioapic_setup)
+               return;
+
        if (num_possible_cpus() > 8) {
                switch (boot_cpu_data.x86_vendor) {
                case X86_VENDOR_INTEL:
diff --git a/arch/x86/kernel/apic/probe_64.c b/arch/x86/kernel/apic/probe_64.c
index c303054..ffc3ae2 100644
--- a/arch/x86/kernel/apic/probe_64.c
+++ b/arch/x86/kernel/apic/probe_64.c
@@ -29,6 +29,9 @@ void __init default_setup_apic_routing(void)
 {
        struct apic **drv;

+       if (skip_ioapic_setup)
+               return;
+
        enable_IR_x2apic();

Regards,
Wanpeng Li

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


Thread

[PATCH] iommu/vt-d: Fix modify_irte NULL pointer Wanpeng Li <kernellwp@gmail.com> - 2016-08-22 14:30 +0200
  Re: [PATCH] iommu/vt-d: Fix modify_irte NULL pointer Thomas Gleixner <tglx@linutronix.de> - 2016-08-22 14:50 +0200
    Re: [PATCH] iommu/vt-d: Fix modify_irte NULL pointer Wanpeng Li <kernellwp@gmail.com> - 2016-08-22 15:40 +0200

csiph-web