From patchwork Thu Sep 27 10:06:30 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen Congyang X-Patchwork-Id: 187322 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id CC6B12C01EE for ; Thu, 27 Sep 2012 20:01:06 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753968Ab2I0KAw (ORCPT ); Thu, 27 Sep 2012 06:00:52 -0400 Received: from cn.fujitsu.com ([222.73.24.84]:60982 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1753614Ab2I0KAt (ORCPT ); Thu, 27 Sep 2012 06:00:49 -0400 X-IronPort-AV: E=Sophos;i="4.80,495,1344182400"; d="scan'208";a="5928316" Received: from unknown (HELO tang.cn.fujitsu.com) ([10.167.250.3]) by song.cn.fujitsu.com with ESMTP; 27 Sep 2012 17:59:26 +0800 Received: from fnstmail02.fnst.cn.fujitsu.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id q8RA0jpP020780; Thu, 27 Sep 2012 18:00:45 +0800 Received: from [10.167.225.226] ([10.167.225.226]) by fnstmail02.fnst.cn.fujitsu.com (Lotus Domino Release 8.5.3) with ESMTP id 2012092718005679-115473 ; Thu, 27 Sep 2012 18:00:56 +0800 Message-ID: <50642526.4070603@cn.fujitsu.com> Date: Thu, 27 Sep 2012 18:06:30 +0800 From: Wen Congyang User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100413 Fedora/3.0.4-2.fc13 Thunderbird/3.0.4 MIME-Version: 1.0 To: Vasilis Liaskovitis CC: x86@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-acpi@vger.kernel.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, linux-ia64@vger.kernel.org, cmetcalf@tilera.com, sparclinux@vger.kernel.org, rientjes@google.com, liuj97@gmail.com, len.brown@intel.com, benh@kernel.crashing.org, paulus@samba.org, cl@linux.com, minchan.kim@gmail.com, akpm@linux-foundation.org, kosaki.motohiro@jp.fujitsu.com, isimatu.yasuaki@jp.fujitsu.com Subject: Re: [RFC v9 PATCH 00/21] memory-hotplug: hot-remove physical memory References: <1346837155-534-1-git-send-email-wency@cn.fujitsu.com> <20120926165820.GB7559@dhcp-192-168-178-175.profitbricks.localdomain> In-Reply-To: <20120926165820.GB7559@dhcp-192-168-178-175.profitbricks.localdomain> X-MIMETrack: Itemize by SMTP Server on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2012/09/27 18:00:56, Serialize by Router on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2012/09/27 18:00:58, Serialize complete at 2012/09/27 18:00:58 Sender: sparclinux-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: sparclinux@vger.kernel.org At 09/27/2012 12:58 AM, Vasilis Liaskovitis Wrote: > Testing 3.6.0-rc7 with this v9 patchset plus more recent fixes [1],[2],[3] > Running in a guest (qemu+seabios from [4]). > CONFIG_SLAB=y > CONFIG_DEBUG_SLAB=y > > - succesfull hot-add and online > - succesfull hot-remove with SCI (qemu) eject > - attempt to hot-readd same memory > > When the pages are re-onlined on hot-readd, I get a bad_page state for many > pages e.g. > > [ 59.611278] init_memory_mapping: [mem 0x80000000-0x9fffffff] > [ 59.637836] Built 2 zonelists in Node order, mobility grouping on. Total pages: 547617 > [ 59.638739] Policy zone: Normal > [ 59.650840] BUG: Bad page state in process bash pfn:9b6dc > [ 59.651124] page:ffffea0002200020 count:0 mapcount:0 mapping: (null) index:0xfdfdfdfdfdfdfdfd > [ 59.651494] page flags: 0x2fdfdfdfd5df9fd(locked|referenced|uptodate|dirty|lru|active|slab|owner_priv_1|private|private_2|writeback|head|tail|swapcache|reclaim|swapbacked|unevictable|uncached|compound_lock) > [ 59.653604] Modules linked in: netconsole acpiphp pci_hotplug acpi_memhotplug loop kvm_amd kvm microcode tpm_tis tpm tpm_bios evdev psmouse serio_raw i2c_piix4 i2c_core parport_pc parport processor button thermal_sys ext3 jbd mbcache sg sr_mod cdrom ata_generic virtio_net ata_piix virtio_blk libata virtio_pci virtio_ring virtio scsi_mod > [ 59.656998] Pid: 988, comm: bash Not tainted 3.6.0-rc7-guest #12 > [ 59.657172] Call Trace: > [ 59.657275] [] ? bad_page+0xb0/0x100 > [ 59.657434] [] ? free_pages_prepare+0xb3/0x100 > [ 59.657610] [] ? free_hot_cold_page+0x48/0x1a0 > [ 59.657787] [] ? online_pages_range+0x68/0xa0 > [ 59.657961] [] ? __online_page_increment_counters+0x10/0x10 > [ 59.658162] [] ? walk_system_ram_range+0x101/0x110 > [ 59.658346] [] ? online_pages+0x1a5/0x2b0 > [ 59.658515] [] ? __memory_block_change_state+0x20d/0x270 > [ 59.658710] [] ? store_mem_state+0xb6/0xf0 > [ 59.658878] [] ? sysfs_write_file+0xd2/0x160 > [ 59.659052] [] ? vfs_write+0xaa/0x160 > [ 59.659212] [] ? sys_write+0x47/0x90 > [ 59.659371] [] ? async_page_fault+0x25/0x30 > [ 59.659543] [] ? system_call_fastpath+0x16/0x1b > [ 59.659720] Disabling lock debugging due to kernel taint > > Patch 20/21 deals with a similar scenario, but only for __PG_HWPOISON flag. > Did i miss any other patch for this? Please try the following patch: From a38ec678e0a9b48b252f457d7910b7527049dc43 Mon Sep 17 00:00:00 2001 From: Wen Congyang Date: Thu, 27 Sep 2012 17:27:57 +0800 Subject: [PATCH] clear the memory to store page information --- mm/sparse.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/mm/sparse.c b/mm/sparse.c index ab9d755..36dda08 100644 --- a/mm/sparse.c +++ b/mm/sparse.c @@ -639,7 +639,6 @@ static struct page *__kmalloc_section_memmap(unsigned long nr_pages) got_map_page: ret = (struct page *)pfn_to_kaddr(page_to_pfn(page)); got_map_ptr: - memset(ret, 0, memmap_size); return ret; } @@ -761,6 +760,8 @@ int __meminit sparse_add_one_section(struct zone *zone, unsigned long start_pfn, goto out; } + memset(memmap, 0, sizeof(struct page) * nr_pages); + ms->section_mem_map |= SECTION_MARKED_PRESENT; ret = sparse_init_one_section(ms, section_nr, memmap, usemap);