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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 01324C48BC3 for ; Wed, 14 Feb 2024 16:30:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=GvE/pHS3arAl+di0S9xSMt82z0EwkaY0uqOIpHVlrvo=; b=fHlcwn4VWozjy+ 8OTdlNmHrBX/TiIjJMaKo7SuZtsyFJbZ3Ss5TpXKqVNOMF7LjblJI51d3/0AaJYVhG/Rdva0Bsqv4 8oaOtYu5Eow88kkEttrRrGjQOj2EzPe3sHukO5Lx8YjMZLscJKC0e1nSl4kbypUdd5mSgcfzNQRLn ZxODFHLxsJzqrqPKS3DKWcKaRIGkYpFwJo+XJcm4R5+1JA+G1rYGD001USha/s6D/WQISZg1/4SJq 22RoaomzKLbOvLzkSYe9dlEFE6HRHvMiU+fGMSJJmrW7ncrhGyjC+5UXmNhUsBy29PJ8QPnpxiUZU rgAFpi/duiAo0e1njD+w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1raI8t-0000000DWbt-2xWa; Wed, 14 Feb 2024 16:29:51 +0000 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1raI8r-0000000DWap-2F4D for linux-arm-kernel@lists.infradead.org; Wed, 14 Feb 2024 16:29:50 +0000 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-411d9e901dcso92995e9.1 for ; Wed, 14 Feb 2024 08:29:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1707928188; x=1708532988; darn=lists.infradead.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=vG7i4rTv5dN/K3IttStABw6h9ZHaBPfu/H1rnYVvfSA=; b=hNIPEkaa/+dSotKpq0NNHjTIAzY7oIFffddoloMeB5sSim7JSoss8Ba9oT9CEnH/zz 2li5mv5AMNIh1pxI81yQQBTKzubB1vCYi82W5LDwTp6ngkd8ZvrCtNPr5YzAoG/USIew j45tZs/n7fh6Zi9iAKrlu6rki2rePmOftJf2/OUFPxRQaaZXi1KCPQTKyhbO4/Uxx1CW pNL8TldkPgkMRHFqcOJNy4mJOsCkOFJFxO+0A61ktb5EoAYKROZiCEXnVH9/vwtUzFgd JkhMeqV/0aO3+3JFNsmDAKPIBJCfbbVlZmaV4+W7/RV28Tmv0cSG4KPG3ZRKehq9eMcw LH4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707928188; x=1708532988; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=vG7i4rTv5dN/K3IttStABw6h9ZHaBPfu/H1rnYVvfSA=; b=rj8cO+kjJzdiVSyD5mmR+wqWUENaI4iXlg6TGYX9cX2ElFkUt0TrTTt3E3boJwiksT lZ0rjyMr51g+StMDGEs8D7up5vy943u5mp8dASOFL31cp1PIbS+uKQxwopSCMD8RAitP rwA/l0y/Uqa7KZbKgK6Td4vjTdlMR8ZFOJ7T8Puclpj2U8gj29LAAB7euiXHkMFTFpK4 jSvFx+nSZQevwmKdBjSSs/quUe8Tw4P2Uxt9t3PE30ryus3qpeNt9hRC29DuGkkl2rQz mlQhjzBqqFNMEnXsrz7uFQBYOtwPFCPb5ncGB2lxAPAdCJFUiKWnvV/2OFya3u+xnn4B na1A== X-Forwarded-Encrypted: i=1; AJvYcCXBKh3q+Xx30wL1cEkNzLrlhVITo5jG8iAG2c1A7090R6nTMZEA87Tk+U+WJrHBUdpGzAhRq9nBVhl6O+4rRmaz8SUhvfr7P5fMfl4FDFU2pthb0rk= X-Gm-Message-State: AOJu0Ywu2Is/dr5fwxOhuQxeDYU+rNYoTyc7A/03ZWpJMa6Olj+TR85s LMPzNEVWZY6jFSAEsNGaTEQj7ZQVzASEOUPMV+FF0LipLbMTPFi5Mw9+NkY1sA== X-Google-Smtp-Source: AGHT+IEfoGVEcSkXcvHm9vOSlr8zdWFY2LiFK/ZqzUsRqAzqSErJ5TjzXMSPE5rGzs06KCKoPTgvzg== X-Received: by 2002:a05:600c:519b:b0:411:e5c1:9b2a with SMTP id fa27-20020a05600c519b00b00411e5c19b2amr166293wmb.2.1707928187624; Wed, 14 Feb 2024 08:29:47 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCXTndGOWllW29C9NCd6GB5W+GrXhfNKAS8hQ9ZMrGGufMYE0N0LcmrQqDdtFfrmT/CQmeC/ieRIBChaF/mS2ijPZEw10gGsdJpn1gd5kJ69gwGvog55s7r5Gl/IfVntFj+cGu3+V24FlEIIrzZ/C//5OZEEbduhMedb+DMQPnsXVuifDYpWbdcW6DKM6hK9rVVp6USakKw/rh9fkIWtFOe30xtca25+9QBCXzgeLq4pG1ldhq8hBPX2bXmxqEA3Bx2OTpw+CP8NIHcvg5BMN9Dz/jrI++2ml8mo5l63AzoZCn/aaWNtekd5WYyGk484sjRm0tbdMcLLjfK7lfbj6WZgOgEwF5gXHCNpAlKJnsUeVEERaAu+BIW3DcB9+yrqeeCJpJ55MARx9J8rjH4amn8edwIYiyGQbZLpa0auY2SjrE8RMesK+4njl2cEicQfsO03AzO+xPZyT0g7bXbgL6FtA6dM8nRkdCoSQFdgo2JlbG3MKL9tUSelDUjiKjyWH3lCMDr2Pg3NM02TCV28F7dx8ZUenim87Bt95w== Received: from google.com (161.126.77.34.bc.googleusercontent.com. [34.77.126.161]) by smtp.gmail.com with ESMTPSA id cl3-20020a5d5f03000000b0033b7ce8b496sm10424662wrb.108.2024.02.14.08.29.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 08:29:47 -0800 (PST) Date: Wed, 14 Feb 2024 16:29:45 +0000 From: Sebastian Ene To: Oliver Upton 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> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240214_082949_599057_8ACB6AB3 X-CRM114-Status: GOOD ( 36.35 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Feb 13, 2024 at 05:10:30PM +0000, Oliver Upton wrote: > 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. > Allright, I will create separate entries for getting the ipa_space and the start level which will be exposed in the vm debugfs dir. > > > > + 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. > Ack, will stick to this approach in this case. > > > > 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. > Right, I see what you mean, thanks for the clarification. > > > 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 Thanks for the feedback, Seb _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel