From patchwork Mon Jan 21 09:38:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miles Chen X-Patchwork-Id: 10773455 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E7389746 for ; Mon, 21 Jan 2019 09:38:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D3CEE2928C for ; Mon, 21 Jan 2019 09:38:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C3D6C29EB6; Mon, 21 Jan 2019 09:38:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6A14F2928C for ; Mon, 21 Jan 2019 09:38:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=enu4GxUCFMODy3Nkj9qQZD1LQXOJ0cY89HgNiZoag0Q=; b=axF0VwY8/YKodE tcngVsDHFAn1OsJ3v4PV8dSmce1mdG8r6HxvQ29/APK+Ea8VXfsChHv7V27C5ZbeiAK4Q9MkPVwHh uXRSOarNUI+8mZpIrDw5rbtpqJDRPMdmTv1j/RPdoZ5GkSIW0USpqq9ZT0pVltSxY5nKKo3uu7nEi Rl0cwwPEyUhk+326w6vv3b+WUSOgqVv8GtdqTqd9JoIM2HRNM6SM2MJ1WwRgzRyourHbmTTcnz954 v4ghWMN+plSOrhOHvDLPGyoSqB8dInqn3Xe9X6sAJqGHXKu35/9JPOeZbzUwRY/7OLEM9o1WZ3a2Q OF7hJSDd9AK6ygUETJbQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1glW2P-0000EP-J4; Mon, 21 Jan 2019 09:38:37 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1glW2N-0000E5-8Q for linux-mediatek@lists.infradead.org; Mon, 21 Jan 2019 09:38:36 +0000 X-UUID: 3c150a552e9a45b68cbc748c125c5bd1-20190121 X-UUID: 3c150a552e9a45b68cbc748c125c5bd1-20190121 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 527589643; Mon, 21 Jan 2019 01:38:22 -0800 Received: from mtkmbs08n2.mediatek.inc (172.21.101.56) by MTKMBS62N2.mediatek.inc (172.29.193.42) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Mon, 21 Jan 2019 01:38:21 -0800 Received: from mtkcas09.mediatek.inc (172.21.101.178) by mtkmbs08n2.mediatek.inc (172.21.101.56) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Mon, 21 Jan 2019 17:38:12 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas09.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Mon, 21 Jan 2019 17:38:12 +0800 From: To: Christoph Lameter , Pekka Enberg , "David Rientjes" , Joonsoo Kim , "Andrew Morton" Subject: [PATCH] mm/slub: use WARN_ON() for some slab errors Date: Mon, 21 Jan 2019 17:38:10 +0800 Message-ID: <1548063490-545-1-git-send-email-miles.chen@mediatek.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-TM-SNTS-SMTP: 22854B56D5FA26CFEBB0D7CFF0AD17A8FEB7B10791F002CBBB518968530C57542000:8 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190121_013835_302863_7B54B9AD X-CRM114-Status: UNSURE ( 8.71 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-mm@kvack.org, Miles Chen , linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Miles Chen When debugging with slub.c, sometimes we have to trigger a panic in order to get the coredump file. To do that, we have to modify slub.c and rebuild kernel. To make debugging easier, use WARN_ON() for these slab errors so we can dump stack trace by default or set panic_on_warn to trigger a panic. Signed-off-by: Miles Chen --- mm/slub.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/slub.c b/mm/slub.c index 1e3d0ec4e200..e48c3bb30c93 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -684,7 +684,7 @@ static void print_trailer(struct kmem_cache *s, struct page *page, u8 *p) print_section(KERN_ERR, "Padding ", p + off, size_from_object(s) - off); - dump_stack(); + WARN_ON(1); } void object_err(struct kmem_cache *s, struct page *page, @@ -705,7 +705,7 @@ static __printf(3, 4) void slab_err(struct kmem_cache *s, struct page *page, va_end(args); slab_bug(s, "%s", buf); print_page_info(page); - dump_stack(); + WARN_ON(1); } static void init_object(struct kmem_cache *s, void *object, u8 val) @@ -1690,7 +1690,7 @@ static struct page *new_slab(struct kmem_cache *s, gfp_t flags, int node) flags &= ~GFP_SLAB_BUG_MASK; pr_warn("Unexpected gfp: %#x (%pGg). Fixing up to gfp: %#x (%pGg). Fix your code!\n", invalid_mask, &invalid_mask, flags, &flags); - dump_stack(); + WARN_ON(1); } return allocate_slab(s,