Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp221184ybk; Tue, 12 May 2020 21:05:59 -0700 (PDT) X-Google-Smtp-Source: APiQypJQC9ofVKEdyxTn6Tz76K8KgdgkHQlnNFXzYROlnWphTHJXX/3ADoPNEi/XadO/+y9QQWE5 X-Received: by 2002:a17:906:a44f:: with SMTP id cb15mr13841847ejb.219.1589342759651; Tue, 12 May 2020 21:05:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589342759; cv=none; d=google.com; s=arc-20160816; b=09nf4ONhePmDiXwy4G3jEXVxELhQfmUrCndOpbUtxCQywVlIZpFkOhYNzGEgIJLA2L fNCjkLy+PdrrJssmgV6ZxZMfyr5BPC+MBj/CgBShb5ZPpWhjX9e2soYixuS7u2tNQp1a WIciLlJFwEF4aEPS8BFlVxwsl1HOrcpCbiL2duPR1qBTEIO/BDkJ4ekAPME/85I0p6VG 6u+D2SPETu799ckmZFpWVWxdz16WLTTCg1wsX2KnmHh4c2uc2032PAsVsJK88X8PCRdK RErE+MjZPrghSQFOH/uo5cy1JrQSPRQ3u5cup2+rERsIe51OnWWUxWsj/0Vru2FaD8Oh KDvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=eypdgomwTHFzpnw3qIpQvEKEq52ueJOZMPOZnCt4hPw=; b=Qe6tXhRA8MtbqUdSYziw2g3MlyZMkJbaW5zJsvM5INfSpbnlpFnd/nwiYdQaBzXjQo /ZQWmBh97lmwF9S0sxerMNiZVUq82s1N+YOLkBfGv+Vbvz+N3NmAX+95vZzFKMoQymC7 ejG5b0QXgMLdHY2miZpL/hohgcbSGCiA28dh3FNLjGUIsuctOwsJh0VZBp9QrdIidWH4 Y2QggQEEKXYPDfBHhuc2gZ6ZS0pggjW1JftIOh8YpZJmzMWECzv6rh07zf/C5bWx5MeI xdIH/nRlGo+vdd05N0ZG+YJ+mRQY/zesPnOldFbqKv4bRXHhqB6dhDdlJ+0yrjN+qJav Tcwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b="m7cvVUU/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id my6si4105953ejb.87.2020.05.12.21.05.32; Tue, 12 May 2020 21:05:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b="m7cvVUU/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725973AbgEMEA3 (ORCPT + 99 others); Wed, 13 May 2020 00:00:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725837AbgEMEA3 (ORCPT ); Wed, 13 May 2020 00:00:29 -0400 Received: from ozlabs.org (ozlabs.org [IPv6:2401:3900:2:1::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 32418C061A0C; Tue, 12 May 2020 21:00:29 -0700 (PDT) Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 49MLYP40yxz9sSW; Wed, 13 May 2020 14:00:25 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ellerman.id.au; s=201909; t=1589342426; bh=sh82LwVUQBWzo4DGjemROA2YW4sZvRmQ0Wh5kVhlPxs=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=m7cvVUU/d6GfsojEfn1dmd1edFyjClrbxvfxvEVF4Mot9bPv3iHbgPNot86TxUXtP Pvmyd623oi4B8xEQxBOlm72ixfpKUZF+/PQHWe1EHviaPDMcMjyRIKnSfRHPGr+8tl qrMWclEu13Y1Gec4uQZY8Fr5r3Zz5jPtSlhbU5z37zi8JngBU+WHEidUxrvTMkGn+T K8vrZ0iGF4zjjGexfSnRQLZJzAJZl/q+ymPSvDCqrU2DGJEdaCGS90uaWbXUQ0bBVg EnXsxjajfCMb2FmHdBA9NRWD3+h1tdADO361XdGVW73DjXW3BWUDlK2ATBybeuj2Sq MbOwWS85ITR5g== From: Michael Ellerman To: Catalin Marinas Cc: Qian Cai , paulus@ozlabs.org, benh@kernel.crashing.org, kvm-ppc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] powerpc/kvm: silence kmemleak false positives In-Reply-To: <20200511112829.GB19176@gaia> References: <20200509015538.3183-1-cai@lca.pw> <87y2pybu38.fsf@mpe.ellerman.id.au> <20200511112829.GB19176@gaia> Date: Wed, 13 May 2020 14:00:44 +1000 Message-ID: <87k11gbi1f.fsf@mpe.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Catalin Marinas writes: > On Mon, May 11, 2020 at 09:15:55PM +1000, Michael Ellerman wrote: >> Qian Cai writes: >> > kvmppc_pmd_alloc() and kvmppc_pte_alloc() allocate some memory but then >> > pud_populate() and pmd_populate() will use __pa() to reference the newly >> > allocated memory. The same is in xive_native_provision_pages(). >> > >> > Since kmemleak is unable to track the physical memory resulting in false >> > positives, silence those by using kmemleak_ignore(). >> >> There is kmemleak_alloc_phys(), which according to the docs can be used >> for tracking a phys address. > > This won't help. While kmemleak_alloc_phys() allows passing a physical > address, it doesn't track physical address references to this object. It > still expects VA pointing to it, otherwise the object would be reported > as a leak. OK, thanks for clarifying that. > We currently only call this from the memblock code with a min_count of > 0, meaning it will not be reported as a leak if no references are found. > > We don't have this issue with page tables on other architectures since > most of them use whole page allocations which aren't tracked by > kmemleak. These powerpc functions use kmem_cache_alloc() which would be > tracked automatically by kmemleak. While we could add a phys alias to > kmemleak (another search tree), I think the easiest is as per Qian's > patch, just ignore those objects. Agreed. cheers