From: Kamal Mostafa <kamal@canonical.com>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
kernel-team@lists.ubuntu.com
Cc: Gu Zheng <guz.fnst@cn.fujitsu.com>,
David Rientjes <rientjes@google.com>,
Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>,
Taku Izumi <izumi.taku@jp.fujitsu.com>,
Tang Chen <tangchen@cn.fujitsu.com>,
Xie XiuQi <xiexiuqi@huawei.com>,
Andrew Morton <akpm@linux-foundation.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Kamal Mostafa <kamal@canonical.com>
Subject: [PATCH 3.13.y-ckt 33/90] mm/memory hotplug: postpone the reset of obsolete pgdat
Date: Tue, 5 May 2015 13:54:05 -0700 [thread overview]
Message-ID: <1430859302-5886-34-git-send-email-kamal@canonical.com> (raw)
In-Reply-To: <1430859302-5886-1-git-send-email-kamal@canonical.com>
3.13.11-ckt20 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Gu Zheng <guz.fnst@cn.fujitsu.com>
commit b0dc3a342af36f95a68fe229b8f0f73552c5ca08 upstream.
Qiu Xishi reported the following BUG when testing hot-add/hot-remove node under
stress condition:
BUG: unable to handle kernel paging request at 0000000000025f60
IP: next_online_pgdat+0x1/0x50
PGD 0
Oops: 0000 [#1] SMP
ACPI: Device does not support D3cold
Modules linked in: fuse nls_iso8859_1 nls_cp437 vfat fat loop dm_mod coretemp mperf crc32c_intel ghash_clmulni_intel aesni_intel ablk_helper cryptd lrw gf128mul glue_helper aes_x86_64 pcspkr microcode igb dca i2c_algo_bit ipv6 megaraid_sas iTCO_wdt i2c_i801 i2c_core iTCO_vendor_support tg3 sg hwmon ptp lpc_ich pps_core mfd_core acpi_pad rtc_cmos button ext3 jbd mbcache sd_mod crc_t10dif scsi_dh_alua scsi_dh_rdac scsi_dh_hp_sw scsi_dh_emc scsi_dh ahci libahci libata scsi_mod [last unloaded: rasf]
CPU: 23 PID: 238 Comm: kworker/23:1 Tainted: G O 3.10.15-5885-euler0302 #1
Hardware name: HUAWEI TECHNOLOGIES CO.,LTD. Huawei N1/Huawei N1, BIOS V100R001 03/02/2015
Workqueue: events vmstat_update
task: ffffa800d32c0000 ti: ffffa800d32ae000 task.ti: ffffa800d32ae000
RIP: 0010: next_online_pgdat+0x1/0x50
RSP: 0018:ffffa800d32afce8 EFLAGS: 00010286
RAX: 0000000000001440 RBX: ffffffff81da53b8 RCX: 0000000000000082
RDX: 0000000000000000 RSI: 0000000000000082 RDI: 0000000000000000
RBP: ffffa800d32afd28 R08: ffffffff81c93bfc R09: ffffffff81cbdc96
R10: 00000000000040ec R11: 00000000000000a0 R12: ffffa800fffb3440
R13: ffffa800d32afd38 R14: 0000000000000017 R15: ffffa800e6616800
FS: 0000000000000000(0000) GS:ffffa800e6600000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000025f60 CR3: 0000000001a0b000 CR4: 00000000001407e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
refresh_cpu_vm_stats+0xd0/0x140
vmstat_update+0x11/0x50
process_one_work+0x194/0x3d0
worker_thread+0x12b/0x410
kthread+0xc6/0xd0
ret_from_fork+0x7c/0xb0
The cause is the "memset(pgdat, 0, sizeof(*pgdat))" at the end of
try_offline_node, which will reset all the content of pgdat to 0, as the
pgdat is accessed lock-free, so that the users still using the pgdat
will panic, such as the vmstat_update routine.
process A: offline node XX:
vmstat_updat()
refresh_cpu_vm_stats()
for_each_populated_zone()
find online node XX
cond_resched()
offline cpu and memory, then try_offline_node()
node_set_offline(nid), and memset(pgdat, 0, sizeof(*pgdat))
zone = next_zone(zone)
pg_data_t *pgdat = zone->zone_pgdat; // here pgdat is NULL now
next_online_pgdat(pgdat)
next_online_node(pgdat->node_id); // NULL pointer access
So the solution here is postponing the reset of obsolete pgdat from
try_offline_node() to hotadd_new_pgdat(), and just resetting
pgdat->nr_zones and pgdat->classzone_idx to be 0 rather than the memset
0 to avoid breaking pointer information in pgdat.
Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
Reported-by: Xishi Qiu <qiuxishi@huawei.com>
Suggested-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Cc: Taku Izumi <izumi.taku@jp.fujitsu.com>
Cc: Tang Chen <tangchen@cn.fujitsu.com>
Cc: Xie XiuQi <xiexiuqi@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
mm/memory_hotplug.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 489f235..38c966a 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -1017,6 +1017,10 @@ static pg_data_t __ref *hotadd_new_pgdat(int nid, u64 start)
return NULL;
arch_refresh_nodedata(nid, pgdat);
+ } else {
+ /* Reset the nr_zones and classzone_idx to 0 before reuse */
+ pgdat->nr_zones = 0;
+ pgdat->classzone_idx = 0;
}
/* we can use NODE_DATA(nid) from here */
@@ -1862,15 +1866,6 @@ void try_offline_node(int nid)
if (is_vmalloc_addr(zone->wait_table))
vfree(zone->wait_table);
}
-
- /*
- * Since there is no way to guarentee the address of pgdat/zone is not
- * on stack of any kernel threads or used by other kernel objects
- * without reference counting or other symchronizing method, do not
- * reset node_data and free pgdat here. Just reset it to 0 and reuse
- * the memory when the node is online again.
- */
- memset(pgdat, 0, sizeof(*pgdat));
}
EXPORT_SYMBOL(try_offline_node);
--
1.9.1
next prev parent reply other threads:[~2015-05-05 20:56 UTC|newest]
Thread overview: 91+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
2015-05-05 20:53 ` [PATCH 3.13.y-ckt 01/90] Input: serio - add firmware_id sysfs attribute Kamal Mostafa
2015-05-05 20:53 ` [PATCH 3.13.y-ckt 02/90] Input: i8042 - add firmware_id support Kamal Mostafa
2015-05-05 20:53 ` [PATCH 3.13.y-ckt 03/90] Input: Add INPUT_PROP_TOPBUTTONPAD device property Kamal Mostafa
2015-05-05 20:53 ` [PATCH 3.13.y-ckt 04/90] Input: synaptics - report INPUT_PROP_TOPBUTTONPAD property Kamal Mostafa
2015-05-05 20:53 ` [PATCH 3.13.y-ckt 05/90] Input: synaptics - add a matches_pnp_id helper function Kamal Mostafa
2015-05-05 20:53 ` [PATCH 3.13.y-ckt 06/90] Input: synaptics - change min/max quirk table to pnp-id matching Kamal Mostafa
2015-05-05 20:53 ` [PATCH 3.13.y-ckt 07/90] Input: psmouse - add psmouse_matches_pnp_id helper function Kamal Mostafa
2015-05-05 20:53 ` [PATCH 3.13.y-ckt 08/90] Input: synaptics - split synaptics_resolution(), query first Kamal Mostafa
2015-05-05 20:53 ` [PATCH 3.13.y-ckt 09/90] Input: synaptics - log queried and quirked dimension values Kamal Mostafa
2015-05-05 20:53 ` [PATCH 3.13.y-ckt 10/90] Input: synaptics - remove obsolete min/max quirk for X240 Kamal Mostafa
2015-05-05 20:53 ` [PATCH 3.13.y-ckt 11/90] Input: synaptics - add min/max quirk for pnp-id LEN2002 (Edge E531) Kamal Mostafa
2015-05-05 20:53 ` [PATCH 3.13.y-ckt 12/90] Input: synaptics - add min/max quirk for Lenovo T440s Kamal Mostafa
2015-05-05 20:53 ` [PATCH 3.13.y-ckt 13/90] Input: synaptics - adjust min/max for Lenovo ThinkPad X1 Carbon 2nd Kamal Mostafa
2015-05-05 20:53 ` [PATCH 3.13.y-ckt 14/90] Input: synaptics - adjust min/max on Thinkpad E540 Kamal Mostafa
2015-05-05 20:53 ` [PATCH 3.13.y-ckt 15/90] Input: synaptics - support min/max board id in min_max_pnpid_table Kamal Mostafa
2015-05-05 20:53 ` [PATCH 3.13.y-ckt 16/90] Input: synaptics - skip quirks when post-2013 dimensions Kamal Mostafa
2015-05-05 20:53 ` [PATCH 3.13.y-ckt 17/90] n_tty: Merge .receive_buf() flavors Kamal Mostafa
2015-05-05 20:53 ` [PATCH 3.13.y-ckt 18/90] n_tty: Fix read buffer overwrite when no newline Kamal Mostafa
2015-05-05 20:53 ` [PATCH 3.13.y-ckt 19/90] KVM: x86: Fix lost interrupt on irr_pending race Kamal Mostafa
2015-05-05 20:53 ` [PATCH 3.13.y-ckt 20/90] fs: take i_mutex during prepare_binprm for set[ug]id executables Kamal Mostafa
2015-05-05 20:53 ` [PATCH 3.13.y-ckt 21/90] tcp: Fix crash in TCP Fast Open Kamal Mostafa
2015-05-05 20:53 ` [PATCH 3.13.y-ckt 22/90] writeback: add missing INITIAL_JIFFIES init in global_update_bandwidth() Kamal Mostafa
2015-05-05 20:53 ` [PATCH 3.13.y-ckt 23/90] nbd: fix possible memory leak Kamal Mostafa
2015-05-05 20:53 ` [PATCH 3.13.y-ckt 24/90] mfd: kempld-core: Fix callback return value check Kamal Mostafa
2015-05-05 20:53 ` [PATCH 3.13.y-ckt 25/90] KVM: nVMX: mask unrestricted_guest if disabled on L0 Kamal Mostafa
2015-05-05 20:53 ` [PATCH 3.13.y-ckt 26/90] spi: trigger trace event for message-done before mesg->complete Kamal Mostafa
2015-05-05 20:53 ` [PATCH 3.13.y-ckt 27/90] powerpc/pseries: Little endian fixes for post mobility device tree update Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 28/90] net: ethernet: pcnet32: Setup the SRAM and NOUFLO on Am79C97{3, 5} Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 29/90] perf: Fix irq_work 'tail' recursion Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 30/90] arm64: Use the reserved TTBR0 if context switching to the init_mm Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 31/90] selinux: fix sel_write_enforce broken return value Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 32/90] mm: fix anon_vma->degree underflow in anon_vma endless growing prevention Kamal Mostafa
2015-05-05 20:54 ` Kamal Mostafa [this message]
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 34/90] hfsplus: fix B-tree corruption after insertion at position 0 Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 35/90] ARC: SA_SIGINFO ucontext regs off-by-one Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 36/90] writeback: fix possible underflow in write bandwidth calculation Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 37/90] iio: fix drivers that check buffer->scan_mask Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 38/90] iio: inv_mpu6050: Clear timestamps fifo while resetting hardware fifo Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 39/90] iio: core: Fix double free Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 40/90] USB: ftdi_sio: Added custom PID for Synapse Wireless product Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 41/90] iwlwifi: dvm: run INIT firmware again upon .start() Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 42/90] USB: keyspan_pda: add new device id Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 43/90] cifs: smb2_clone_range() - exit on unhandled error Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 44/90] cifs: fix use-after-free bug in find_writable_file Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 45/90] can: flexcan: Deferred on Regulator return EPROBE_DEFER Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 46/90] usb: xhci: handle Config Error Change (CEC) in xhci driver Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 47/90] usb: xhci: apply XHCI_AVOID_BEI quirk to all Intel xHCI controllers Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 48/90] USB: ftdi_sio: Use jtag quirk for SNAP Connect E10 Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 49/90] tty: serial: fsl_lpuart: clear receive flag on FIFO flush Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 50/90] radeon: Do not directly dereference pointers to BIOS area Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 51/90] iio: imu: Use iio_trigger_get for indio_dev->trig assignment Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 52/90] dmaengine: edma: fix memory leak when terminating running transfers Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 53/90] dmaengine: omap-dma: Fix memory leak when terminating running transfer Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 54/90] x86/reboot: Add ASRock Q1900DC-ITX mainboard reboot quirk Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 55/90] mac80211: fix RX A-MPDU session reorder timer deletion Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 56/90] IB/uverbs: Prevent integer overflow in ib_umem_get address arithmetic Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 57/90] tcp: prevent fetching dst twice in early demux code Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 58/90] net: use for_each_netdev_safe() in rtnl_group_changelink() Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 59/90] xen-netfront: transmit fully GSO-sized packets Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 60/90] tcp: fix FRTO undo on cumulative ACK of SACKed range Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 61/90] PCI: cpcihp: Add missing curly braces in cpci_configure_slot() Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 62/90] [media] sh_veu: v4l2_dev wasn't set Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 63/90] [media] media: s5p-mfc: fix mmap support for 64bit arch Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 64/90] cpuidle: ACPI: do not overwrite name and description of C0 Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 65/90] ioctx_alloc(): fix vma (and file) leak on failure Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 66/90] ALSA: hda/realtek - Make more stable to get pin sense for ALC283 Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 67/90] be2iscsi: Fix kernel panic when device initialization fails Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 68/90] Defer processing of REQ_PREEMPT requests for blocked devices Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 69/90] ALSA: hda - Fix headphone pin config for Lifebook T731 Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 70/90] ocfs2: _really_ sync the right range Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 71/90] ALSA: usb - Creative USB X-Fi Pro SB1095 volume knob support Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 72/90] iscsi target: fix oops when adding reject pdu Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 73/90] net/mlx4_en: Call register_netdevice in the proper location Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 74/90] ipv6: protect skb->sk accesses from recursive dereference inside the stack Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 75/90] tcp: tcp_make_synack() should clear skb->tstamp Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 76/90] 8139cp: Call dev_kfree_skby_any instead of kfree_skb Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 77/90] 8139too: Call dev_kfree_skby_any instead of dev_kfree_skb Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 78/90] r8169: " Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 79/90] bonding: Call dev_kfree_skby_any instead of kfree_skb Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 80/90] bnx2: Call dev_kfree_skby_any instead of dev_kfree_skb Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 81/90] tg3: " Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 82/90] ixgb: " Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 83/90] benet: Call dev_kfree_skby_any instead of kfree_skb Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 84/90] gianfar: Carefully free skbs in functions called by netpoll Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 85/90] ip_forward: Drop frames with attached skb->sk Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 86/90] tcp: fix possible deadlock in tcp_send_fin() Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 87/90] tcp: avoid looping " Kamal Mostafa
2015-05-05 20:55 ` [PATCH 3.13.y-ckt 88/90] net: do not deplete pfmemalloc reserve Kamal Mostafa
2015-05-05 20:55 ` [PATCH 3.13.y-ckt 89/90] net: fix crash in build_skb() Kamal Mostafa
2015-05-05 20:55 ` [PATCH 3.13.y-ckt 90/90] ipv4: Missing sk_nulls_node_init() in ping_unhash() Kamal Mostafa
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=1430859302-5886-34-git-send-email-kamal@canonical.com \
--to=kamal@canonical.com \
--cc=akpm@linux-foundation.org \
--cc=guz.fnst@cn.fujitsu.com \
--cc=isimatu.yasuaki@jp.fujitsu.com \
--cc=izumi.taku@jp.fujitsu.com \
--cc=kernel-team@lists.ubuntu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rientjes@google.com \
--cc=stable@vger.kernel.org \
--cc=tangchen@cn.fujitsu.com \
--cc=torvalds@linux-foundation.org \
--cc=xiexiuqi@huawei.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
all inboxes | Powered by JetHome®