From patchwork Fri Nov 29 04:38:43 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bharat Bhushan X-Patchwork-Id: 295137 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [IPv6:::1]) by ozlabs.org (Postfix) with ESMTP id 9DF2C2C0423 for ; Fri, 29 Nov 2013 15:39:27 +1100 (EST) Received: from co9outboundpool.messaging.microsoft.com (co9ehsobe001.messaging.microsoft.com [207.46.163.24]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (Client CN "mail.global.frontbridge.com", Issuer "MSIT Machine Auth CA 2" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 25A542C0086 for ; Fri, 29 Nov 2013 15:38:59 +1100 (EST) Received: from mail23-co9-R.bigfish.com (10.236.132.246) by CO9EHSOBE008.bigfish.com (10.236.130.71) with Microsoft SMTP Server id 14.1.225.22; Fri, 29 Nov 2013 04:38:49 +0000 Received: from mail23-co9 (localhost [127.0.0.1]) by mail23-co9-R.bigfish.com (Postfix) with ESMTP id 0485A1401E6; Fri, 29 Nov 2013 04:38:49 +0000 (UTC) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-SpamScore: 1 X-BigFish: VS1(zzzz1f42h2148h208ch1ee6h1de0h1fdah2073h2146h1202h1e76h1d1ah1d2ah1fc6hzz1de097hz2dh109h2a8h839h8e2h8e3h944hd25hf0ah1220h1288h12a5h12a9h12bdh137ah13b6h1441h1504h1537h153bh15d0h162dh1631h1758h18e1h1946h19b5h1ad9h1b0ah1b2fh2222h224fh1fb3h1d0ch1d2eh1d3fh1dc1h1dfeh1dffh1e1dh1fe8h1ff5h21a6h2216h22d0h2336hbe9i1155h) Received: from mail23-co9 (localhost.localdomain [127.0.0.1]) by mail23-co9 (MessageSwitch) id 1385699926333690_28360; Fri, 29 Nov 2013 04:38:46 +0000 (UTC) Received: from CO9EHSMHS003.bigfish.com (unknown [10.236.132.233]) by mail23-co9.bigfish.com (Postfix) with ESMTP id 439D7500041; Fri, 29 Nov 2013 04:38:46 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by CO9EHSMHS003.bigfish.com (10.236.130.13) with Microsoft SMTP Server (TLS) id 14.16.227.3; Fri, 29 Nov 2013 04:38:45 +0000 Received: from 039-SN2MPN1-012.039d.mgd.msft.net ([169.254.2.103]) by 039-SN1MMR1-005.039d.mgd.msft.net ([::1]) with mapi id 14.03.0158.002; Fri, 29 Nov 2013 04:38:44 +0000 From: Bharat Bhushan To: "agraf@suse.de" , "linuxppc-dev@lists.ozlabs.org" Subject: Error in frreing hugepages with preemption enabled Thread-Topic: Error in frreing hugepages with preemption enabled Thread-Index: Ac7svOE5J2BzIx6ETn+OSBHIkTRu8w== Date: Fri, 29 Nov 2013 04:38:43 +0000 Message-ID: <6A3DF150A5B70D4F9B66A25E3F7C888D07238568@039-SN2MPN1-012.039d.mgd.msft.net> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.232.14.2] MIME-Version: 1.0 X-OriginatorOrg: freescale.com X-FOPE-CONNECTOR: Id%0$Dn%*$RO%0$TLS%0$FQDN%$TlsDn% Cc: Scott Wood , "kvm@vger.kernel.org" , "kvm-ppc@vger.kernel.org" X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Hi Alex, I am running KVM guest with host kernel having CONFIG_PREEMPT enabled. With allocated pages things seems to work fine but I uses hugepages for guest I see below prints when "quit" from qemu. (qemu) QEMU waiting for connection on: telnet:0.0.0.0:4444,server qemu-system-ppc64: pci_add_option_rom: failed to find romfile "efi-virtio.rom" q debug_smp_processor_id: 15 callbacks suppressed BUG: using smp_processor_id() in preemptible [00000000] code: qemu-system-ppc/2504 caller is .free_hugepd_range+0xb0/0x21c CPU: 1 PID: 2504 Comm: qemu-system-ppc Not tainted 3.12.0-rc3-07733-gabf4907 #175 Call Trace: [c0000000fb433400] [c000000000007d38] .show_stack+0x7c/0x1cc (unreliable) [c0000000fb4334d0] [c0000000005e8ce0] .dump_stack+0x9c/0xf4 [c0000000fb433560] [c0000000002de5ec] .debug_smp_processor_id+0x108/0x11c [c0000000fb4335f0] [c000000000025e10] .free_hugepd_range+0xb0/0x21c [c0000000fb433680] [c0000000000265bc] .hugetlb_free_pgd_range+0x2c8/0x3b0 [c0000000fb4337a0] [c0000000000e428c] .free_pgtables+0x14c/0x158 [c0000000fb433840] [c0000000000ef320] .exit_mmap+0xec/0x194 [c0000000fb433960] [c00000000004d780] .mmput+0x64/0x124 [c0000000fb4339e0] [c000000000051f40] .do_exit+0x29c/0x9c8 [c0000000fb433ae0] [c0000000000527c8] .do_group_exit+0x50/0xc4 [c0000000fb433b70] [c0000000000606a0] .get_signal_to_deliver+0x21c/0x5d8 [c0000000fb433c70] [c000000000009b08] .do_signal+0x54/0x278 [c0000000fb433db0] [c000000000009e50] .do_notify_resume+0x64/0x78 [c0000000fb433e30] [c000000000000b44] .ret_from_except_lite+0x70/0x74 This mean that free_hugepd_range() must be called with preemption enabled. I tried below change and this seems to work fine (I am not having expertise in this area so not sure this is correct way) Thanks -Bharat diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c index d67db4b..6bf8459 100644 --- a/arch/powerpc/mm/hugetlbpage.c +++ b/arch/powerpc/mm/hugetlbpage.c @@ -563,8 +563,10 @@ static void hugetlb_free_pmd_range(struct mmu_gather *tlb, pud_t *pud, */ next = addr + (1 << hugepd_shift(*(hugepd_t *)pmd)); #endif + preempt_disable(); free_hugepd_range(tlb, (hugepd_t *)pmd, PMD_SHIFT, addr, next, floor, ceiling); + preempt_enable(); } while (addr = next, addr != end); start &= PUD_MASK;