From patchwork Sun Jun 4 08:15:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Levin, Alexander \(Sasha Levin\)" X-Patchwork-Id: 101349 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp440464qgd; Sun, 4 Jun 2017 01:16:02 -0700 (PDT) X-Received: by 10.98.205.65 with SMTP id o62mr14645713pfg.105.1496564162297; Sun, 04 Jun 2017 01:16:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496564162; cv=none; d=google.com; s=arc-20160816; b=bXdb/ArScaYYKBrAbQHWgDmquVAjUgSdI1EiA7XoSNt7vi1XbP5JbRJoSDbjEC5m4k dSLUfJ7uHyf1OS1wKRvX9cpFPpp1k9XHplYgp3RkovDWWO0fepnWGmemQPW6jY4QPoc6 K43wSX89HYMKt1kvq3Vanwxx6Is+e6GoIPnp5qFdfTKkzL3IXa/e8XA39PzmDJpvOxcG jK+cuh5wiqnI/7vbg7TBOTsY1nK1qJ8/Dfa5Hjtu6RLFczjp9KPAeoay5TbCQo+o2yQU N2bBuAWWMNUuuboyf4DY4fME2OtpRu7DYXGkExqTqwAsLdSMvGyurUrOJPTMkY6p+3Ef Bz5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:to:dkim-signature:cc:from :dkim-signature:arc-authentication-results; bh=L/K/Wgm1A/74FYPtDNJkjYs5fyaCjsLz2ZCTCOd/s/M=; b=SyHxMGhQ5iHNZoNSCv0GxF81n3HKWUpav57m0G8MNVU/0FFY1LtTk5OdplOH3m3G4A mVojx8dzUmQkStsJPvt7b+78fLE7DfNSM/maNvifCKXx2dSGvHyknaPrLUC0muq6KKIj 1f3yxH/skX78FHNP8W6KLp1SH+sppsY3Xt9MASITwjOb5LFNnPMlb/aqZLw4C9xM1keI 9qMWTTVqrOO8ZB+gnxzX+JR89/B3a5vLFSThYdnVUNLSnNN6rnZY1J/t/TPeP7tvAqfK qq2izugL6XoaoJEyQSFMShESujB6uht2f1tTnVqhV95jkbyfbgXPv7mLOPxvNZQUmCzE gS3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@verizon.com; dkim=fail header.i=@verizon.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=verizon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j17si27669684pfj.239.2017.06.04.01.16.02; Sun, 04 Jun 2017 01:16:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@verizon.com; dkim=fail header.i=@verizon.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=verizon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751153AbdFDIQB (ORCPT + 6 others); Sun, 4 Jun 2017 04:16:01 -0400 Received: from omzsmtpe02.verizonbusiness.com ([199.249.25.209]:46976 "EHLO omzsmtpe02.verizonbusiness.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751292AbdFDIPm (ORCPT ); Sun, 4 Jun 2017 04:15:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=verizon.com; i=@verizon.com; q=dns/txt; s=corp; t=1496564142; x=1528100142; h=from:cc:to:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=hWS5gLmh7+v9WDBfki++/jenepPfCj7nkxZhUr6XSvs=; b=SNpsxJ2kgJRTteXKyenZeQT/q6bSZeHk/LncqSYFgYiDSbx7tIAiLe/P gSz8VjSN4aZlSEeDdRg8YucWEFio4t9cxGg+B/tnoEMWtsSeOx8tQ6qi4 tj599yIOObmWvdg7QZPCf+Y9QQamQ840KPnk9jZCg6hB7qZi1rzkDTiPa 0=; X-IronPort-Anti-Spam-Filtered: false Received: from unknown (HELO fldsmtpi01.verizon.com) ([166.68.71.143]) by omzsmtpe02.verizonbusiness.com with ESMTP; 04 Jun 2017 08:15:36 +0000 From: "Levin, Alexander (Sasha Levin)" Cc: Daniel Thompson , Pekka Enberg , Joonsoo Kim , Andrew Morton , Linus Torvalds , "Levin, Alexander (Sasha Levin)" X-IronPort-AV: E=Sophos;i="5.39,295,1493683200"; d="scan'208";a="214180395" Received: from nitro.tdc.vzwcorp.com (HELO Nitro.verizonwireless.com) ([10.254.88.186]) by fldsmtpi01.verizon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 04 Jun 2017 08:15:22 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=verizon.com; i=@verizon.com; q=dns/txt; s=corp; t=1496564122; x=1528100122; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=hWS5gLmh7+v9WDBfki++/jenepPfCj7nkxZhUr6XSvs=; b=iwW1FGQxVnVDnhRUBMIPYzLWvA1Vyqh/NZIB7eOxvXml9neJpyx0C7SY sOpSIVMiiS17a3so6KYwVhKG9TFbB3BQ0Jp/53PD508t5VLCisaCCWDeg Y5WB3MhdvplfdPzzF3jzH4Gv34AtFqWE706OSQEEZ8lhdgRaiXmKTaHcl s=; Received: from gaalpexhub4.uswin.ad.vzwcorp.com ([10.191.138.113]) by Nitro.verizonwireless.com with ESMTP/TLS/AES256-SHA; 04 Jun 2017 04:15:21 -0400 Received: from OMZP1LUMXCA12.uswin.ad.vzwcorp.com (144.8.22.187) by gaalpexhub4.uswin.ad.vzwcorp.com (10.191.138.113) with Microsoft SMTP Server (TLS) id 8.3.406.0; Sun, 4 Jun 2017 04:15:21 -0400 Received: from OMZP1LUMXCA17.uswin.ad.vzwcorp.com (144.8.22.195) by OMZP1LUMXCA12.uswin.ad.vzwcorp.com (144.8.22.187) with Microsoft SMTP Server (TLS) id 15.0.1263.5; Sun, 4 Jun 2017 03:15:19 -0500 Received: from OMZP1LUMXCA17.uswin.ad.vzwcorp.com ([144.8.22.195]) by OMZP1LUMXCA17.uswin.ad.vzwcorp.com ([144.8.22.195]) with mapi id 15.00.1263.000; Sun, 4 Jun 2017 03:15:19 -0500 To: "stable@vger.kernel.org" Subject: [PATCH for v4.9 LTS 093/111] mm/slub.c: trace free objects at KERN_INFO Thread-Topic: [PATCH for v4.9 LTS 093/111] mm/slub.c: trace free objects at KERN_INFO Thread-Index: AQHS3QqzXqAsr1xsDUeETmJN7IdLJA== Date: Sun, 4 Jun 2017 08:15:17 +0000 Message-ID: <20170604081457.19897-21-alexander.levin@verizon.com> References: <20170604081457.19897-1-alexander.levin@verizon.com> In-Reply-To: <20170604081457.19897-1-alexander.levin@verizon.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-messagesentrepresentingtype: 1 x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.144.60.250] MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Daniel Thompson [ Upstream commit aa2efd5ea4041754da4046c3d2e7edaac9526258 ] Currently when trace is enabled (e.g. slub_debug=T,kmalloc-128 ) the trace messages are mostly output at KERN_INFO. However the trace code also calls print_section() to hexdump the head of a free object. This is hard coded to use KERN_ERR, meaning the console is deluged with trace messages even if we've asked for quiet. Fix this the obvious way but adding a level parameter to print_section(), allowing calls from the trace code to use the same trace level as other trace messages. Link: http://lkml.kernel.org/r/20170113154850.518-1-daniel.thompson@linaro.org Signed-off-by: Daniel Thompson Acked-by: Christoph Lameter Acked-by: David Rientjes Cc: Pekka Enberg Cc: Joonsoo Kim Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- mm/slub.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) -- 2.11.0 diff --git a/mm/slub.c b/mm/slub.c index 58c7526f8de2..a94c8904dee1 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -496,10 +496,11 @@ static inline int check_valid_pointer(struct kmem_cache *s, return 1; } -static void print_section(char *text, u8 *addr, unsigned int length) +static void print_section(char *level, char *text, u8 *addr, + unsigned int length) { metadata_access_enable(); - print_hex_dump(KERN_ERR, text, DUMP_PREFIX_ADDRESS, 16, 1, addr, + print_hex_dump(level, text, DUMP_PREFIX_ADDRESS, 16, 1, addr, length, 1); metadata_access_disable(); } @@ -636,14 +637,15 @@ static void print_trailer(struct kmem_cache *s, struct page *page, u8 *p) p, p - addr, get_freepointer(s, p)); if (s->flags & SLAB_RED_ZONE) - print_section("Redzone ", p - s->red_left_pad, s->red_left_pad); + print_section(KERN_ERR, "Redzone ", p - s->red_left_pad, + s->red_left_pad); else if (p > addr + 16) - print_section("Bytes b4 ", p - 16, 16); + print_section(KERN_ERR, "Bytes b4 ", p - 16, 16); - print_section("Object ", p, min_t(unsigned long, s->object_size, - PAGE_SIZE)); + print_section(KERN_ERR, "Object ", p, + min_t(unsigned long, s->object_size, PAGE_SIZE)); if (s->flags & SLAB_RED_ZONE) - print_section("Redzone ", p + s->object_size, + print_section(KERN_ERR, "Redzone ", p + s->object_size, s->inuse - s->object_size); if (s->offset) @@ -658,7 +660,8 @@ static void print_trailer(struct kmem_cache *s, struct page *page, u8 *p) if (off != size_from_object(s)) /* Beginning of the filler is the free pointer */ - print_section("Padding ", p + off, size_from_object(s) - off); + print_section(KERN_ERR, "Padding ", p + off, + size_from_object(s) - off); dump_stack(); } @@ -820,7 +823,7 @@ static int slab_pad_check(struct kmem_cache *s, struct page *page) end--; slab_err(s, page, "Padding overwritten. 0x%p-0x%p", fault, end - 1); - print_section("Padding ", end - remainder, remainder); + print_section(KERN_ERR, "Padding ", end - remainder, remainder); restore_bytes(s, "slab padding", POISON_INUSE, end - remainder, end); return 0; @@ -973,7 +976,7 @@ static void trace(struct kmem_cache *s, struct page *page, void *object, page->freelist); if (!alloc) - print_section("Object ", (void *)object, + print_section(KERN_INFO, "Object ", (void *)object, s->object_size); dump_stack();