Received: by 2002:a25:b323:0:0:0:0:0 with SMTP id l35csp2677489ybj; Mon, 23 Sep 2019 07:40:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqz/dj0buvvqBUsDJYcZyptMtdqgdDNQT0CuWTD610sMSUDWUxVpfn82LEqdOc7cM3DUB5K2 X-Received: by 2002:a50:9fce:: with SMTP id c72mr437909edf.166.1569249629670; Mon, 23 Sep 2019 07:40:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569249629; cv=none; d=google.com; s=arc-20160816; b=sBUb6y6NLUR4REGCOtIAE7n7EHeNpgMJ4vreX0SwI4PDKapjjSYjXvAUDjGs9sMqVf piIyaxcol/mcnShFDoTboQqKR6Zl9kjjbsd65bxEo9Vx/JofIYpqYNrOuZYDZaHk8Hn7 BrtOB6EYt9h1ynEWzlaR/m8REh0LtlW/YCa3/xgVHFtob+DI/GcV3G4cqxPJChoevTzE rsUj6cDCSoET/eEKtNiVWzclccFImqgJXHWEpzXuYmcfWUPJHAZguUQvdAbmYQKStSLH lOdmX2O9GmdDqN6I/te/bErM6EO8kFkE/K+fu8smdN5s23LmikXKqT+EsePB0LIs5l5k fVZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=BAoSG7fLK5HP9+dUCxFgXfWJ4nlU3nJsgbTBl8j3hLg=; b=kFENXQQgqUyDpCfIvGB5oAQSLecVb67I8Xu1uR4Fp2+IUiyH1nQFGHBpWYHUQeUYyl mtp7/y9ydLjP3fWl0es6yY8N0Ngj8mbSc25EOV9XvLnTGYB9A3uOhB1eTNjN0Wuadk5V i4tWBZNax6wSZ8zTRW4GjOgsZ+VdHKjjvI0Y8hgmVFa7XPtAqQPx/PE72Q6TZz97mLV6 2Wu+P2cIQ/D1mFHpQj9bsorf2x+5ToAPjULjGpHoQC4Uw95E/O2qVgfYChxxUn1cpqGr XsLpTWCZB4o3H48TYLG2roi9ZIyiAJSy3xcYxC60CC1ptFp3yPHr17Gvdl/CvKqXXHsI cFKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=YRLwwaS3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a15si6698225eda.222.2019.09.23.07.40.06; Mon, 23 Sep 2019 07:40:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=YRLwwaS3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2407716AbfIUQAZ (ORCPT + 99 others); Sat, 21 Sep 2019 12:00:25 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:58260 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2407710AbfIUQAZ (ORCPT ); Sat, 21 Sep 2019 12:00:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=BAoSG7fLK5HP9+dUCxFgXfWJ4nlU3nJsgbTBl8j3hLg=; b=YRLwwaS3U+t+MgM7paZ0WNocC lyp8QoiGrD28Ur6fGeQEGCgQDykn47KhE0hJ8ouYP/K3oOTlPTq5XKfVv0mPs9W/WGm00VrZ5kkkx 1GY8NykZ2rUKfTOwy34XC005U/NtXq0Pu2g12xTZJy20cb6stFmpFVk/pNos7ACy4Hhh5o6EByVbw xxZ6YfXeD28897vsfPSiiwvtPiYMzpYDZZOXpqxOKVtYvR98HLTrKzSVX7onREbguaqgR/2JGPQH+ iORi8ZAfrVUmtIP7KQt6Z/J2E5XDvpuuoKQBd29RVgQf6iv9iW7ZIIf9A+glf9KgrnLeU+CSA7qLh 74NSikOeQ==; Received: from willy by bombadil.infradead.org with local (Exim 4.92.2 #3 (Red Hat Linux)) id 1iBho2-0000xH-73; Sat, 21 Sep 2019 16:00:18 +0000 Date: Sat, 21 Sep 2019 09:00:18 -0700 From: Matthew Wilcox To: David Rientjes Cc: Miles Chen , Christoph Lameter , Pekka Enberg , Joonsoo Kim , Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-mediatek@lists.infradead.org, wsd_upstream@mediatek.com Subject: Re: [PATCH] mm: slub: print_hex_dump() with DUMP_PREFIX_OFFSET Message-ID: <20190921160018.GF15392@bombadil.infradead.org> References: <20190920104849.32504-1-miles.chen@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Sep 21, 2019 at 02:08:59AM -0700, David Rientjes wrote: > On Fri, 20 Sep 2019, Miles Chen wrote: > > > Since commit ad67b74d2469d9b8 ("printk: hash addresses printed with %p"), > > The use DUMP_PREFIX_OFFSET instead of DUMP_PREFIX_ADDRESS with > > print_hex_dump() can generate more useful messages. > > > > In the following example, it's easier get the offset of incorrect poison > > value with DUMP_PREFIX_OFFSET. > > > > Before: > > Object 00000000e817b73b: 00 00 00 00 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b > > Object 00000000816f4601: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b > > Object 00000000169d2bb8: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b > > Object 00000000f4c38716: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b > > Object 00000000917e3491: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b > > Object 00000000c0e33738: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b > > Object 000000001755ddd1: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b > > > > After: > > Object 00000000: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b > > Object 00000010: 63 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b > > Object 00000020: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b > > Object 00000030: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b a5 > > I agree it looks nicer for poisoning, I'm not sure that every caller of > print_section() is the same, however. For example trace() seems better > off as DUMP_PREFIX_ADDRESS since it already specifies the address of the > object being allocated or freed and offset here wouldn't really be useful, > no? While it looks nicer, it might be less useful for debugging. The point of obfuscated %p is that you can compare two "pointer" values for equality. So if you know that you freed object 00000000e817b73b from an earlier printk, then you can match it up to this dump. It's obviously not perfect since we're only getting the pointers at addresses that are multiples of 16, but it's a help.