[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [DISCUSS] xen/arm: CLIDR Ctype scan order in get_llc_way_size()


  • To: Mykola Kvach <xakep.amatop@xxxxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: "Orzel, Michal" <michal.orzel@xxxxxxx>
  • Date: Tue, 13 Jan 2026 09:46:05 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=gmail.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=4s8yzkIgbumej70kjP3ByTRzIi6fvqlQRmrtmuUF1AE=; b=jy6apFIVKnw5HBZdKao8tRuHrksyT/bOJ5NOh407a82K6As4MOPZeusijdWvFEHkTMRlHtwaifydRdVO3ePLli9JJ3tLPn5xKikgm1r9mP7twOGO86YGlQcc6SbvRgQwYUPMoZAIOg173ctlhP5J63Da09OnkPMGQYOvw2Bo2HxILi9newOTth5YNpqRwfbvYe+JiiNyuyZdsORyJ1O8EEw0fdKbfK3kdXc189ghdRNbDBeNcdw94qKBk/RfwfDYrvTUPpA8cOiCNhYPiTt1Ueh3+xIouClXmyqtwCFjvcTRJ9N68J8j7hrnzWqurs4A+Vz2jMFPEvAdlt3E80HLVw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=C7rPML9cHNdAOEpITlNSARhe+FYyhRKAvGUWhcYjfzJxjVmI0QR01Z6Pa5t3MCTG5DxXo9T3He9X7kBZFLdutROXsH5/eKdGHc1qoCnX3Ux8HPdKqjDpRgNRzuxh19CuPU+SCNFbBiVRuqtBBhtp8ioUPzJnNdPvBZfjJw1DMOP9Ri9FiWXIWWaMVdgRQ0uRzC8dmhZ/udqTvLxl3CwzOI2jlF37r9FtO8BhvO7BDHBGDTp91VNY4Tu6pI4MmAggchIqsYhU+EcajHPCeXuQrQJlc9oyZgOIysrroFkjmJeDLgU6rLpbx1TtKLkD8ruWTmj1otkMqLvPPOsqjF1E+w==
  • Cc: <andrea.bastoni@xxxxxxxxxxxxxxx>, <marco.solieri@xxxxxxxxxxxxxxx>, "Andrew Cooper" <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Carlo Nonato <carlo.nonato@xxxxxxxxxxxxxxx>
  • Delivery-date: Tue, 13 Jan 2026 08:47:30 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>


On 13/01/2026 08:00, Mykola Kvach wrote:
> Hi all,
> 
> While investigating current Xen code, I noticed that get_llc_way_size()
> scans CLIDR_EL1 Cache Type (CtypeN) fields in reverse order to locate
> a unified cache level.
> 
> According to the Arm ARM (DDI 0487J.a, D19.2.27):
> 
> If software reads the Cache Type fields from Ctype1 upwards, once it has
> seen a value of 000, no caches that can be managed using the architected
> cache maintenance instructions that operate by set/way exist at
> further-out levels of the hierarchy. So, for example, if Ctype3 is the
> first Cache Type field with a value of 000, the values of Ctype4 to
> Ctype7 must be ignored.
> 
> This reads to me as an architectural constraint on software: fields above
> the first 0b000 are not architecturally meaningful for decisions (regardless
> of what bit patterns might appear there in a given implementation). With our
> current reverse scan, we could (at least in theory) mis-detect a "unified
> cache" at a level whose Ctype field is required to be ignored.
> 
> Discussion points:
> 1. Is the reverse scan intentional? In particular, do we rely on the
> assumption that Ctype fields above the first 0b000 are effectively
> RES0 in practice, or that they may legitimately describe caches which
> exist but are not manageable via the architected set/way maintenance
> instructions?
It is intentional in the sense that it makes the implementation easier
but it looks like we did not pay too much attention to the statement you 
provided.

> 2. Would it be more correct to scan from Ctype1 upwards and stop at the
> first 0b000, tracking the outermost unified cache seen prior to that
> point?
Maybe it would. At the same time I don't necessarily view this as a hard
requirement (the sentence starts from "IF the software reads from upwards" which
does not mean that reading downwards should not be done). I'm ok if you want to
change the implementation.

>
> If there is agreement, I can send a small fix patch with "Fixes:" adjusting
> the scan order/termination accordingly.
> 
> Thanks,
> Mykola

~Michal




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.