From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932226AbcFGJTG (ORCPT ); Tue, 7 Jun 2016 05:19:06 -0400 Received: from www.linutronix.de ([62.245.132.108]:37709 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752958AbcFGJTA (ORCPT ); Tue, 7 Jun 2016 05:19:00 -0400 Date: Tue, 7 Jun 2016 11:17:01 +0200 (CEST) From: Thomas Gleixner To: Rui Wang cc: rjw@rjwysocki.net, Tony Luck , bhelgaas@google.com, linux-acpi@vger.kernel.org, linux-pci@vger.kernel.org, LKML Subject: Re: [PATCH 2/2] x86/ioapic: Fix wrong pointers in ioapic_setup_resources() In-Reply-To: <1465284073-354-3-git-send-email-rui.y.wang@intel.com> Message-ID: References: <1465284073-354-1-git-send-email-rui.y.wang@intel.com> <1465284073-354-3-git-send-email-rui.y.wang@intel.com> User-Agent: Alpine 2.11 (DEB 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org B1;2802;0cOn Tue, 7 Jun 2016, Rui Wang wrote: > On a 4-socket brickland, hot-removing one ioapic is fine. Hot-removing > the 2nd one causes panic: > > [ 453.422259] BUG: unable to handle kernel NULL pointer dereference at > 0000000000000030 > [ 453.431059] IP: [] release_resource+0x22/0x80 > [ 453.437713] PGD 0 > [ 453.439976] Oops: 0000 [#1] SMP > [ 453.698876] ffff88046267fd20 ffffffff8104e3ff 0000000000000000 > ffff88046267fd58 > [ 453.707195] Call Trace: > [ 453.709935] [] mp_unregister_ioapic+0x125/0x180 > [ 453.716846] [] acpi_unregister_ioapic+0x1f/0x40 > [ 453.723759] [] acpi_ioapic_remove+0x5f/0xf0 > [ 453.730283] [] acpi_pci_root_remove+0x2c/0x80 > [ 453.737002] [] acpi_bus_trim+0x5a/0x8d > [ 453.743039] [] acpi_device_hotplug+0x1b7/0x418 > [ 453.749851] [] acpi_hotplug_work_fn+0x1e/0x29 > [ 453.756570] [] process_one_work+0x14f/0x3d0 > [ 453.763092] [] worker_thread+0x125/0x4b0 > [ 453.769325] [] ? __schedule+0x2b1/0x700 > [ 453.775459] [] ? rescuer_thread+0x370/0x370 > [ 453.781981] [] kthread+0xd8/0xf0 > [ 453.787435] [] ? kthread_park+0x60/0x60 > [ 453.793570] [] ret_from_fork+0x3f/0x70 > [ 453.800203] [] ? kthread_park+0x60/0x60 > [ 453.806914] Code: 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 55 48 89 > e5 53 48 89 fb 48 c7 c7 f8 c0 e3 81 e8 87 69 66 00 48 8b 4b 20 b8 ea ff > ff ff <48> 8b 51 30 48 85 d2 74 1d 48 39 d3 75 0a eb 3f 48 39 c3 74 1b > [ 453.829861] RIP [] release_resource+0x22/0x80 > [ 453.837188] RSP > [ 453.841673] CR2: 0000000000000030 Please trim the dumps to the relevant information > Fix it by assigning the correct pointers to ioapics[i].iomem_res in > ioapic_setup_resources(). This does not explain the splat above. Please explain which pointer is wrong and what effects that has. > Also simplify the function by removing the redundant 'num' variable. Please don't do that. This makes the patch hard to read. Split this into a minimal bugfix, which can be backported and a cleanup patch which gets rid of the extra variable. > - ioapics[i].iomem_res = res; > + ioapics[i].iomem_res = &res[i]; If I read the patch correctly, then this is the fix. Right? So please make it a one liner and send a cleanup patch seperately. Thanks, tglx