Received: by 2002:a05:7412:2a91:b0:fc:a2b0:25d7 with SMTP id u17csp55357rdh; Tue, 13 Feb 2024 09:11:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IFgcbFsUKyJqwp3scS73sDTW57oTLYs1rcBQ48pUsSh0FuWXYRQ8nDY4vD2QeTjKQgm34hG X-Received: by 2002:a05:6a00:2392:b0:6e0:e56c:87f5 with SMTP id f18-20020a056a00239200b006e0e56c87f5mr6362840pfc.30.1707844290336; Tue, 13 Feb 2024 09:11:30 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707844290; cv=pass; d=google.com; s=arc-20160816; b=PCsW2l/evILix7t631E6qQR4CZ78fb1VMn0EHr4AiQLruUZDCGRE/+OM6HSRho6Gyr myXLm+IJdNvPZh3mQu2mFlxsSQ0afu5s8jbdYYst8dtShlUMt+5tfdFooUFhwCnJ0opl kUHupCnFUPdM0b7u5cOgzQSC5bobXa1MpYZ3zX9ZSa9WBiUjloiIaUOEAoPvW8NqXArv Bh45YV0CXE5GvIcEzb5+8Mvwp5/icyDLYh7M6LXWQK4yPenEB4vAYtOS1atFBXfljdHO FfmchnrnXTsSkqJtvkyIUoATHeY0nucBs+oKcxHpF7QXeIU7OLMmQSrx29QuVRDWWdQV h0gQ== ARC-Message-Signature: i=2; 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=XY+IFiGgHmCeoZd/AEfpX4a3LV5h8HfarWWWxCHWdMw=; fh=NrDVH6drDOwZxq6eaXRCWl0SNaY3g7KQ62+FsZaz3lo=; b=m0wDpczislTauYyKaqXEpdpnR6MC3VsaKy1qxpM9jnE2HI8nNecFd2zR5cUm735tuL cRRBCCpWZ97hhzTKfxdKtDXkpEcSM2caRTX32s+M8ClAi8PHbSR2m2MzZrbA9ogS9BWB c6mxsXzCMRUvidpa3ZlBI/AEAS6lE3nGXqWPGyX/Sco6bkGNY458UIY/RmYsZ66Evofc z8ry2Rpl95I5M2sEO95qiN9uyngsxwdTWCHnZPdzpMUJxQQe4zJM/KdUBL2ljd/RlJvh hnNeCIZKVBYaNee9n+4muOB40Vf893Mtvtm346OjE/BE34EeQ1sSDEnpQdWyRKEKpLta IefQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=pSy1UV+l; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-63966-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63966-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev X-Forwarded-Encrypted: i=2; AJvYcCWQW1rDUuxsFc21MK0VworIQoOnZzU0eqnSw+6gESG6uD86otE87VvOW8ODqqxSwzO6ARq9NKrzl3hHgkgOF0qCbUcjVnukaGAKcqwrzg== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id j20-20020a056a00175400b006e0381a4a95si6724379pfc.402.2024.02.13.09.11.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 09:11:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-63966-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=pSy1UV+l; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-63966-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63966-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 3CBF728AAC3 for ; Tue, 13 Feb 2024 17:10:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1C4745FDD7; Tue, 13 Feb 2024 17:10:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="pSy1UV+l" Received: from out-179.mta1.migadu.com (out-179.mta1.migadu.com [95.215.58.179]) (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 3DE475FBBF for ; Tue, 13 Feb 2024 17:10:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707844241; cv=none; b=gyzbKK//QU8+i20KGdW8KCg5FhEUcXXgocEboQ5g/kBntFly891JIaHw8j3Crxpq4CeSELwONfqefaT8eGXKVAUC216IRCFhsWdBy9czuy5G3QiUQ2egsFw8TOKOqbM9oZ0P/pH74i1+mt3RFlNkXWbhylQ6TFGZQyWwz+dSmuM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707844241; c=relaxed/simple; bh=7jyPvAGQvkF5KRYVMFV8tgRFEjX4+bvU+GD9z15uSQE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=s+Ke+QBc0a8cIA8F/ufKLAXs+eThPsFIfa3D132+eCySXV81OLfLSuRy+Q5KBTXS33DUf2eP0uOp5amx+9Ynn9Gob6m2CWjskrHBVeUpQ/+IO2CQdRUvwS8kAbaX180ncfRDrcEIea1yvqqSJfFNlVJfOS8WbvMBJGTLgOR7jF8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=pSy1UV+l; arc=none smtp.client-ip=95.215.58.179 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: Tue, 13 Feb 2024 17:10:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1707844237; 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=XY+IFiGgHmCeoZd/AEfpX4a3LV5h8HfarWWWxCHWdMw=; b=pSy1UV+lUx8nXsiVimgjdtfBP9tXfN5OBdGUJVJ0i/FeU/0/+KkWuHcwJEhXxFvakfaq7U a3h+psZeEeZcRpXELh0tU+MNZmimtkdImBoUpExbCKGUDxnm+gynK0YxqGdmzBGNbI/yD5 niqgaKB2KlZFrMEr1kLiySYvt1gVcWQ= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Oliver Upton To: Sebastian Ene Cc: catalin.marinas@arm.com, gshan@redhat.com, james.morse@arm.com, mark.rutland@arm.com, maz@kernel.org, rananta@google.com, ricarkol@google.com, ryan.roberts@arm.com, shahuang@redhat.com, suzuki.poulose@arm.com, will@kernel.org, yuzenghui@huawei.com, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kernel-team@android.com, vdonnefort@google.com Subject: Re: [PATCH v5 4/4] KVM: arm64: Initialize the ptdump parser with stage-2 attributes Message-ID: References: <20240207144832.1017815-2-sebastianene@google.com> <20240207144832.1017815-6-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: X-Migadu-Flow: FLOW_OUT On Tue, Feb 13, 2024 at 04:59:01PM +0000, Sebastian Ene wrote: > On Tue, Feb 13, 2024 at 12:42:42AM +0000, Oliver Upton wrote: > > On Wed, Feb 07, 2024 at 02:48:33PM +0000, Sebastian Ene wrote: [...] > > > + > > > + snprintf(marker_msg, MARKER_MSG_LEN, "IPA bits %2u start lvl %1d", > > > + pgtable->ia_bits, pgtable->start_level); > > > + > > > + ipa_addr_marker[0].name = marker_msg; > > > > Is the dynamic name worth the added complexity? I see nothing wrong with > > exposing additional debugfs files for simple attributes like the IPA > > range and page table levels. > > > > I know it isn't *that* much, just looking for every opportunity to > > simplify further. > > > > We can keep them separate, I have no strong opinion about this. I think > this was Vincent's, original suggestion to have them so I will check with > him as well. Well, if we get to the place where there's a single struct containing all of the required data upfront then this becomes less of an issue. This is useful information still, so let's see if we can go about it the other way. > > > + ret = kvm_ptdump_parser_init(&parser_state, mmu->pgt, m); > > > + if (ret) > > > + return ret; > > > + > > > > Can this be done at open(), or am I missing something? > > > > I guess we can do this in open() but then we will have to add again that > struct that wraps some ptdump specific state tracking. It seemed a bit cleaner in > this way. What do you think ? Allocating something that looks like an iterator end embedding it in ->private isn't too uncommon. > > > write_lock(&guest_kvm->mmu_lock); > > > ret = kvm_ptdump_show_common(m, mmu->pgt, &parser_state); > > > write_unlock(&guest_kvm->mmu_lock); > > > > > > + kvm_ptdump_parser_teardown(&parser_state); > > > > Same question here, can this happen at close()? I guess you'll need a > > struct to encapsulate pg_state and a pointer to the VM at least. > > > > Right, I tried to avoid using a separate struct as we discussed in v4. Sorry, I hope I didn't confuse you in my prior feedback. What I had issue with was the multiple layers of function ptr / ops structs for managing the file interface. I have zero concerns with organizing the _data_ for the walk this way. > > Actually, come to think of it, if you embed all of the data you need for > > the walker into a structure you can just do a single allocation for it > > upfront. -- Thanks, Oliver