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 EE37DC3DA59 for ; Fri, 19 Jul 2024 11:45:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=PqiXhGjOSYu1xQZgH96GVDYB8na0EBhm6a6MmbmS/gs=; b=OsLvQHHcvSKDFd0RN2LHzZwPQl aTP2M2SQI61NPap31V6hvxCcdgIX0iWhRwvghoQ1mZVPSwGRUludZI549oQCox1bET306kPc3loUq lrrWjv7fFLOycI8gXwrDMn/GCHX3iifujOQSTjqeabotLiiiZaT51dn9yZ0LNcBzwXogY8h9FkyhA MvX/4LBB0I2efjqoGkc7Bek/Er7kfi4N+8xRI3+8NEBEKYxEz3Evf7jSnqtXq9bJWJLpDPAipI5Gz vdUwY52aLz1+K3kQTTKmAwDTJH8Cx297J5qvsTpVCtwT8nX6mm4yGagCQs/1ZCnRTJX/xACEVwfBf XbCdGGsA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sUm2v-00000002XsV-3bRX; Fri, 19 Jul 2024 11:45:09 +0000 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sUm2Z-00000002XoD-2WFO for linux-arm-kernel@lists.infradead.org; Fri, 19 Jul 2024 11:44:49 +0000 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-4266edcc54cso40215e9.0 for ; Fri, 19 Jul 2024 04:44:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1721389485; x=1721994285; 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=PqiXhGjOSYu1xQZgH96GVDYB8na0EBhm6a6MmbmS/gs=; b=l5WW9aZreLblcHfbVg3ak0lX6YzEU1OlxHinswTr751lD+b3cspojxljeWZgGnC6Pu IVuyu4XTC61Tbtv4i+zMlzzfbcjnLk8HoLYdNYMXEsL8lriIP0DgMmH1PNwM39r9Dr3V Ntw7+lopJeE8RN0tu2L6rtk1gZ8JCwVPu60x0UrGoEz19IzkTBlbtV68Udx8550BYWkf uNgv2+2+w40WNrZqxYGSUwkppEzMMQ8pI5eAN9eSz+2eAjpKxekYTYj+T8Yj7CCchAxn FDK6kCd/uz9a0ojfTl6R/MKvqUfzQjVBgkmRU2a1kOOaSAmKxI/jihuEJ9PrnC2f5pYx TWCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721389485; x=1721994285; 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=PqiXhGjOSYu1xQZgH96GVDYB8na0EBhm6a6MmbmS/gs=; b=PaetNHMnewXRtWuHW4DVCqftw4sv7ILcM2D4Rs+G6Ze3GHdmTO2N7gu8xaTmi8JqK2 /LUCM8tNxbQz+mxWI+4Ip7V3asTORhllditCXCEFlf9V5roU7/fgvaa/UQAzGx5VXAyT poZTFYHKuJL0tL+DLk/nJzv+w6wnagAg54y7h0KOCm+Bxub3qVs9Wt83eD6Ow57dNT5S S820uMJO/HJmZ3jfm0tk38kBM9E8ziNRw/t4p6Mp3Sq10mIcmjpRbz0A6fOVqrQ+NSBI sFOUkbZx1u4rS0oTwnX23CZciaqrOiZyCJAtHtcQP82zNJueGSE/4G4/o4sh3XeOP9GF TeRQ== X-Forwarded-Encrypted: i=1; AJvYcCUHa/XIyXoQBwBvDcWdeQmS8ZpWPHB2JajdQJ087S5rtYFojjzGyMx+QoL5rpJkkipoXeCzaY3jsNTqmWnGDcZDtATC9IFwHZ62viK5IqroGsT/jmk= X-Gm-Message-State: AOJu0YyPDKDv8io6DyPqw3nz/q2pDp2kxRUTbbxjr5Arw/h6ZGfUr+JO 6KLnbmi+jjY+sUxj4psZLBpdMaBKfQSwbi9zGTzNzh/qXbLETDV8HfWjNnhHwg== X-Google-Smtp-Source: AGHT+IFU0Zkx2Sq301T9KLS1Qev+gl2hXlS+YMiIjix2LoeRgr3gvV/t6LaUnZWd6GxnVJkmx3HXGQ== X-Received: by 2002:a05:600c:511e:b0:426:5ef2:cd97 with SMTP id 5b1f17b1804b1-427d5812246mr1214575e9.2.1721389484609; Fri, 19 Jul 2024 04:44:44 -0700 (PDT) Received: from google.com (49.222.77.34.bc.googleusercontent.com. [34.77.222.49]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-427d2a95099sm47533645e9.48.2024.07.19.04.44.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jul 2024 04:44:44 -0700 (PDT) Date: Fri, 19 Jul 2024 11:44:42 +0000 From: Sebastian Ene To: Will Deacon Cc: akpm@linux-foundation.org, alexghiti@rivosinc.com, ankita@nvidia.com, ardb@kernel.org, catalin.marinas@arm.com, christophe.leroy@csgroup.eu, james.morse@arm.com, vdonnefort@google.com, mark.rutland@arm.com, maz@kernel.org, oliver.upton@linux.dev, rananta@google.com, ryan.roberts@arm.com, shahuang@redhat.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kernel-team@android.com Subject: Re: [PATCH v7 2/6] arm64: ptdump: Expose the attribute parsing functionality Message-ID: References: <20240621123230.1085265-1-sebastianene@google.com> <20240621123230.1085265-3-sebastianene@google.com> <20240705110747.GA9231@willie-the-truck> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240705110747.GA9231@willie-the-truck> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240719_044447_700101_4934578A X-CRM114-Status: GOOD ( 24.62 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Jul 05, 2024 at 12:07:48PM +0100, Will Deacon wrote: > On Fri, Jun 21, 2024 at 12:32:26PM +0000, Sebastian Ene wrote: > > Reuse the descriptor parsing functionality to keep the same output format > > as the original ptdump code. In order for this to happen, move the state > > tracking objects into a common header. > > > > Signed-off-by: Sebastian Ene > > --- > > arch/arm64/include/asm/ptdump.h | 41 ++++++++++++++++++++++++++++++++- > > arch/arm64/mm/ptdump.c | 37 ++--------------------------- > > 2 files changed, 42 insertions(+), 36 deletions(-) > > > > diff --git a/arch/arm64/include/asm/ptdump.h b/arch/arm64/include/asm/ptdump.h > > index 5b1701c76d1c..c550b2afcab7 100644 > > --- a/arch/arm64/include/asm/ptdump.h > > +++ b/arch/arm64/include/asm/ptdump.h > > @@ -9,6 +9,7 @@ > > > > #include > > #include > > +#include > > > > struct addr_marker { > > unsigned long start_address; > > @@ -21,14 +22,52 @@ struct ptdump_info { > > unsigned long base_addr; > > }; > > > > +struct prot_bits { > > + u64 mask; > > + u64 val; > > + const char *set; > > + const char *clear; > > +}; > > + > > +struct pg_level { > > + const struct prot_bits *bits; > > + char name[4]; > > + int num; > > + u64 mask; > > +}; > > + > > +/* > > + * The page dumper groups page table entries of the same type into a single > > + * description. It uses pg_state to track the range information while > > + * iterating over the pte entries. When the continuity is broken it then > > + * dumps out a description of the range. > > + */ > > +struct pg_state { > > + struct ptdump_state ptdump; > > + struct seq_file *seq; > > + const struct addr_marker *marker; > > + const struct mm_struct *mm; > > + unsigned long start_address; > > + int level; > > + u64 current_prot; > > + bool check_wx; > > + unsigned long wx_pages; > > + unsigned long uxn_pages; > > +}; Hello Will, > > Minor nit, but if we're moving these structure definitions into the > header then I'd be inclined to give them some more specific names (e.g. > prefix them with 'ptdump_'). Granted, this header isn't used widely, but > it's included by arch/arm64/mm/mmu.c and claiming 'struct prot_bits' is > a bit over-reaching imo! > > Will Thanks for having a look. I applied the prefix. Cheers, Seb