Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp337934rdb; Thu, 21 Dec 2023 10:28:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IFXU+Bnr6O0uGySGbHCi4TLmCVxgUEFwvlojnEdDESxxNrJHe30tkQKhEAsC7CB/UqB+klL X-Received: by 2002:a05:620a:1441:b0:77f:3db5:7b69 with SMTP id i1-20020a05620a144100b0077f3db57b69mr263087qkl.32.1703183334221; Thu, 21 Dec 2023 10:28:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703183334; cv=none; d=google.com; s=arc-20160816; b=yMDxtBg7ydaWtXWRbybkxI1sUPoUxonYmASHLrm5os/sIWf3erK3sCQNM6hyamT29g 4U0+GaEXppEYyePRqM7EEAxQZSqAAw47jgcU1Kuf7GshdVlAPUd4/b0kR/5P8Nh8L2Yh 6kbhBkJQKEpkwA5xFG05vys+Adz4nRSvmJDHqXwAM2KpRFaV2QMHygVRbbsRZEw1lsmX UEyqe2Fwijz0iZbgpkQNfkeoC5AHo3yWf/8k9WwjzG1IMmq+wQeSG001Ij2PORGx2P1Q rAVFzYW9bOzVnEXXfDiTbBDIbHAEg3ATwcjo70fuPZL6n3he58SnFyIBqrzC3iZTma1T CZSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:dkim-signature:date; bh=0jZW0b0lm5RMynnWmSejBR19+/LyL1/KkgZ6oIXL75I=; fh=yT+A6FPEZlMOuSm5kJ2iVXd4DHLGSAFlICh4O+Gupjo=; b=x9dz5cRXCgo9LSgQ+ypna7Tj9jaV0gGxI0wH15YJ3MBxdmoKWXD0ql4BomXL8kdN+1 lo3L3qU8eypvdfCkzE98x/FPSou5YTQHTUUW2Nw01j1Yf24hEH13ct796ZTraFN4MteK KHb7QGSizZFy06hGOrJuMhJGmAImGiHZ86k2eytOGoZb26xf0KvpWh10Z299wbP6J/HB 3hzIOoxYp8CiWC/5jGB4wS1TNHsdwWHvQv1whkSAEpblH1YbAaQfAjpIxvTofrg6etVP zqksSANPkIPKsVXTsn92dQnn/U5JbgbFfUpn3gIqJO+4RB17biH0ZWTcDwN4PnGW64iC kzzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b="XRyh/wvg"; spf=pass (google.com: domain of linux-kernel+bounces-8923-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8923-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id vm8-20020a05620a718800b0078117c27b62si2785417qkn.371.2023.12.21.10.28.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 10:28:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-8923-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b="XRyh/wvg"; spf=pass (google.com: domain of linux-kernel+bounces-8923-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8923-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id DE2BD1C2351B for ; Thu, 21 Dec 2023 18:28:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9686F64A98; Thu, 21 Dec 2023 18:28:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="XRyh/wvg" X-Original-To: linux-kernel@vger.kernel.org Received: from out-173.mta1.migadu.com (out-173.mta1.migadu.com [95.215.58.173]) (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 01BED63503 for ; Thu, 21 Dec 2023 18:28:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Date: Thu, 21 Dec 2023 18:27:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1703183284; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=0jZW0b0lm5RMynnWmSejBR19+/LyL1/KkgZ6oIXL75I=; b=XRyh/wvgzvJPwABrAu1MA0OdmzIh1K33vCQXcnoSSO1C4xR6Xhl33pLhM8pHnqXvk4aiO3 5+00f0sGhR13/Qz44jmbdyy5wYNkM94B3BFz8FWYsoHBLKHy/I2QiUDNM3U3SBPQwMtOMp Rmemg1S1xZw5ePNCXP77oRWcc7y71/c= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Oliver Upton To: Sebastian Ene Cc: will@kernel.org, James Morse , Suzuki K Poulose , Zenghui Yu , catalin.marinas@arm.com, mark.rutland@arm.com, akpm@linux-foundation.org, maz@kernel.org, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kernel-team@android.com, vdonnefort@google.com, qperret@google.com, smostafa@google.com Subject: Re: [PATCH v4 10/10] arm64: ptdump: Add guest stage-2 pagetables dumping Message-ID: References: <20231218135859.2513568-2-sebastianene@google.com> <20231218135859.2513568-12-sebastianene@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231218135859.2513568-12-sebastianene@google.com> X-Migadu-Flow: FLOW_OUT On Mon, Dec 18, 2023 at 01:59:00PM +0000, Sebastian Ene wrote: > Register a debugfs file on guest creation to be able to view their > second translation tables with ptdump. This assumes that the host is in > control of the guest stage-2 and has direct access to the pagetables. > > Signed-off-by: Sebastian Ene I couldn't see how this patched worked at all until I went back to patch 1 and found this: > +static int kvm_ptdump_open(struct inode *inode, struct file *file) > +{ [...] > + if (!reg->show_ptdump_info) > + reg->show_ptdump_info = kvm_ptdump_show; [...] > +} > +static int kvm_ptdump_show(struct seq_file *m, void *) > +{ > + struct kvm *guest_kvm = m->private; > + struct kvm_s2_mmu *mmu = &guest_kvm->arch.mmu; > + int ret; > + > + write_lock(&guest_kvm->mmu_lock); > + ret = kvm_ptdump_show_common(m, mmu->pgt); > + write_unlock(&guest_kvm->mmu_lock); > + > + return ret; > +} Where are you getting a reference on the kvm struct? You need to do this to ensure the VM doesn't get destroyed behind your back. -- Thanks, Oliver