From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id AC71AC433EF for ; Fri, 24 Jun 2022 10:18:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2E9DC8E020D; Fri, 24 Jun 2022 06:18:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 298076B0178; Fri, 24 Jun 2022 06:18:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 186C08E020D; Fri, 24 Jun 2022 06:18:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 062D76B0177 for ; Fri, 24 Jun 2022 06:18:54 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay12.hostedemail.com (Postfix) with ESMTP id C6704120D2E for ; Fri, 24 Jun 2022 10:18:53 +0000 (UTC) X-FDA: 79612730946.29.A2D14BD Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf28.hostedemail.com (Postfix) with ESMTP id 2D520C002A for ; Fri, 24 Jun 2022 10:18:53 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 41680CE290C; Fri, 24 Jun 2022 10:18:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2B0B7C34114; Fri, 24 Jun 2022 10:18:47 +0000 (UTC) Date: Fri, 24 Jun 2022 11:18:43 +0100 From: Catalin Marinas To: Yee Lee Cc: Patrick Wang , akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Marco Elver Subject: Re: [PATCH v4 3/4] mm: kmemleak: add rbtree and store physical address for objects allocated with PA Message-ID: References: <20220611035551.1823303-1-patrick.wang.shcn@gmail.com> <20220611035551.1823303-4-patrick.wang.shcn@gmail.com> <09d9066b3e55966c108670219711482791d38880.camel@mediatek.com> <10660122efb538669144e4c46558b83400125d79.camel@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <10660122efb538669144e4c46558b83400125d79.camel@mediatek.com> ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656065933; a=rsa-sha256; cv=none; b=oRKfGHOZZ3MZwpXGSYILAmAQVmZTkSJBbn0RxpEIKdN3pcM99n/Cvdvhsbr+po8eityHqj kHrKj1/01pEUNctBKHlRI0y3VCXdsFH+utgAuaGL0L4y4JpBNDAePCzPku+iT13bX2w2ZW w1dfNiMRj4UyR3kIiQSlgtfH8TC9okg= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=arm.com (policy=none); spf=pass (imf28.hostedemail.com: domain of cmarinas@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=cmarinas@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1656065933; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cfgTxXo5cZ1ix+HJgpn1u2Kbl8sei9D90tg0/aWfAzY=; b=XFmUpJJ9KdeR80uyVlI4398piObZIxuJI1gaT0uiiSZALYzmyo7xQOr0NMIJcYQf6oOPPT 4aFZCII+2ZgIPc4znqZrA4JtbJCIo/UD2Z9HpostFwv0LcvuUV4HZYM6atubz9PRWYR+wV aHNrD+AFQiDYMhl+yQTs/kRqw4dr+pM= X-Stat-Signature: 1xib11xd3t4h9nzpb1hg9ce638b5n97n X-Rspamd-Queue-Id: 2D520C002A Authentication-Results: imf28.hostedemail.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=arm.com (policy=none); spf=pass (imf28.hostedemail.com: domain of cmarinas@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=cmarinas@kernel.org X-Rspamd-Server: rspam10 X-Rspam-User: X-HE-Tag: 1656065933-722578 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, Jun 23, 2022 at 07:25:15PM +0800, Yee Lee wrote: > On Thu, 2022-06-23 at 16:45 +0800, Yee Lee wrote: > > Now we have seperated rb_tree for phys and virts addresses. But why > > can't we have kmemleak_free_phys()? It may apply the same format to > > delete_object_full(). > > > > Some users would request to remove the kmemleak object from the phys > > tree but we don't have this one. > > Please check this, an issue happened at kfence with the latest kmemleak > patches. kfence pool allocated memory from memblock but have no way to > free it from the phys tree. > https://lkml.org/lkml/2022/6/23/486 I don't think I was cc'ed on the other thread but at a quick look, what you probably want is: kmemleak_ignore_phys(__kfence_pool); instead of the current kmemleak_free(). With Patrick's changes, you can no longer tell kmemleak about an object with a physical address and free it with the virtual one. -- Catalin