From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B245221D3F5 for ; Mon, 18 May 2026 10:10:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779099047; cv=none; b=A5Q3Su/kyTNniNHNg9urRztHjuJrcBieq4juppb0WdWvjyUjHbVfIm2CxBgq+XZxUosiUFMnkSbHhdyJecRYMNV6Y+u0j98JWEFWPbYtc4aoewxxXszQFsPYSaAY25tyDPyi4Wd+Bsmw9ZpEVjTuzWDF3lk/GlDUYdUwQha88wE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779099047; c=relaxed/simple; bh=aUORUiqrvW7zb9bXPpjnpLQLn0KymJQcaxGWHgaAmr0=; h=Mime-Version:Content-Type:Date:Message-Id:Subject:Cc:To:From: References:In-Reply-To; b=S4+KQxBpXrP7XsvN21uJ4LbPWhS5QNy+jAl7g+X2oEuR6XyjPbX1IGS1tDuMwkVy4QlglmDkun8+l6CEfRw6nhQtxMLAALA7wbpls1kGBz0m77Pw1IzqYzuFT/0PXwiNypY9mqYaZ83LR63WgV4Cz0y3nzcfiqgqQFWoOkGlePk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=m8Lkslkv; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="m8Lkslkv" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 434D8C2BCB7; Mon, 18 May 2026 10:10:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1779099047; bh=aUORUiqrvW7zb9bXPpjnpLQLn0KymJQcaxGWHgaAmr0=; h=Date:Subject:Cc:To:From:References:In-Reply-To:From; b=m8LkslkvKrksMa89hR8I0c0EtoABcua57UIZhTq3aPPc91iVfYZFRqZI0hihuCt+Y 4pCAySTfDl9vQPiblQKGlvTFggbl95kqdeVodd6OwZbq2gqvZh+jf9XCadgm4YAzz2 vOp6uwgbEoC9tmL6skOuFnM1NjkJiuU0RjIBPyFdILqzb235d0R4C4Ad3owCNbPdzm YEuV3el9nB/OtJ0WWvmbsk2Ce59Ize/wEgngaANsQFXpLdSdgymelxm61UEl/mpORp I1FraZNchONMJzzMotAo+5oOLX7lk6gBhUJhj2Tk+XJB8Dsi84nDI5CpEuj4qTGOOd yWC1rDHsoPNxQ== Precedence: bulk X-Mailing-List: rust-for-linux@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Mon, 18 May 2026 12:10:42 +0200 Message-Id: Subject: Re: [PATCH 12/13] drm/tyr: add vms and gpuvas debugfs interface Cc: "Miguel Ojeda" , "Boqun Feng" , "Gary Guo" , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , "Benno Lossin" , "Andreas Hindborg" , "Alice Ryhl" , "Trevor Gross" , "David Airlie" , "Simona Vetter" , "Sumit Semwal" , =?utf-8?q?Christian_K=C3=B6nig?= , "Daniel Almeida" , , To: "Alvin Sun" From: "Danilo Krummrich" References: <20260326-b4-tyr-debugfs-v1-0-074badd18716@linux.dev> <20260326-b4-tyr-debugfs-v1-12-074badd18716@linux.dev> In-Reply-To: <20260326-b4-tyr-debugfs-v1-12-074badd18716@linux.dev> On Thu Mar 26, 2026 at 7:53 AM CET, Alvin Sun wrote: > +/// Writes VM debug information for the "gpuvas" debugfs file. > +fn show_vm(vm: &Vm, f: &mut impl Write) -> core::fmt::Result { > + writeln!( > + f, > + "DRM GPU VA space ({:?}) [0x{:016x};0x{:016x}]", > + vm.gpuvm.name(), > + vm.va_range.start, > + vm.va_range.end, > + )?; > + > + let kva =3D vm.gpuvm.kernel_alloc_va(); > + writeln!( > + f, > + "Kernel reserved node [0x{:016x};0x{:016x}]", > + kva.addr(), > + kva.addr() + kva.length(), > + )?; > + > + writeln!(f, " VAs | start | range | end = | object | object offset")?; > + writeln!(f, "-------------------------------------------------------= ------------------------------------------------------")?; > + for va in vm.gpuvm_core.lock().va_mappings() { > + f.write_fmt(fmt!( > + " | 0x{:016x} | 0x{:016x} | 0x{:016x} | {:18p} | 0x{:016= x}\n", > + va.addr(), > + va.length(), > + va.addr() + va.length(), > + va.obj().as_raw(), > + va.gem_offset(), > + ))?; > + } > + Ok(()) > +} Why is this code duplicated? The implementation already exists in [1]. [1] https://elixir.bootlin.com/linux/v7.0.8/source/drivers/gpu/drm/drm_debu= gfs.c#L209