From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 35E12606A68B for ; Tue, 1 Dec 2026 16:25:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key, unprotected) header.d=suse.cz header.i=@suse.cz header.a=rsa-sha256 header.s=susede2_rsa header.b=pzhoUYl3; dkim=fail reason="signature verification failed" header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=lGsS4Ffk; dkim=fail reason="signature verification failed" (1024-bit key) header.d=suse.cz header.i=@suse.cz header.a=rsa-sha256 header.s=susede2_rsa header.b=o7d1ByWm; dkim=neutral header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=vgTZWI52 Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 5ED4E3EB77C for ; Tue, 1 Dec 2026 17:25:07 +0100 (CET) Received: from in-6.smtp.seeweb.it (in-6.smtp.seeweb.it [217.194.8.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id D2A0C3E7FA9 for ; Tue, 1 Dec 2026 17:24:51 +0100 (CET) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-6.smtp.seeweb.it (Postfix) with ESMTPS id 0107A140013F for ; Tue, 1 Dec 2026 17:24:50 +0100 (CET) Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id B55AF1F449; Tue, 1 Dec 2026 16:24:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1796142290; h=from:from:reply-to:reply-to: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=Q5Ob4tljAQ19iN399YbGEl7qEEa4oGeVeZot6Zql7rA=; b=pzhoUYl3dJ6DzWKfTf7TMwcwf9Eg2q52Z+dVWV7ixuMH85LirjR5T8UAjm+MWi4eYNyGet eb4lDbpOsBylMoZKqgXbJyItODjw7h9mm4hEzqkGCIZ/9DtqrUIH5SQ+IqXyLkSlmtZYO4 6sEN7Vs+7H7QDtHZboyd/gr+dMGkirQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1796142290; h=from:from:reply-to:reply-to: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=Q5Ob4tljAQ19iN399YbGEl7qEEa4oGeVeZot6Zql7rA=; b=lGsS4FfkvHHZbWuK4hCc1lQftfCoc+0TTVpFnsZi3ED50Fszid0t9UCNG6+T6hWQy7Sqsu O+F4AYN6jcUjNBAw== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=o7d1ByWm; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=vgTZWI52 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1796142288; h=from:from:reply-to:reply-to: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=Q5Ob4tljAQ19iN399YbGEl7qEEa4oGeVeZot6Zql7rA=; b=o7d1ByWmu4mw28Hf2ZBj5I3cEDAclH/TMkmOT+pgN/b6mGe2P+0xsU4SwWPkIgQz9J7jFm 4l5waYV2FyQFYW+FT44oY5Lx6ky1RDXrW816y7qli/l/PQ6qF9OMyoKuitLuV4NMGHu3CZ PCBUDYHTpDEKc+ozE+7Tyhj4zeBfcYI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1796142288; h=from:from:reply-to:reply-to: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=Q5Ob4tljAQ19iN399YbGEl7qEEa4oGeVeZot6Zql7rA=; b=vgTZWI52zib1JJ7fYuvY1McyGZDm9+ssTEy0B3omnu2pzX+/EnJl6InCBX7JdQ4LIKG4yN tHHDaxKiQ0cTILBg== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 1788D134E9; Tue, 1 Dec 2026 16:24:48 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id DEzVLs/0DmuEdwAAD6G6ig (envelope-from ); Tue, 01 Dec 2026 16:24:48 +0000 Date: Tue, 1 Dec 2026 17:24:41 +0100 From: Petr Vorel To: Hubert Mazur Message-ID: <20261201162441.GA80775@pevik> References: <20261120093444.609481-1-hmazur@google.com> X-Archived-By: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20261120093444.609481-1-hmazur@google.com> X-Rspamd-Queue-Id: B55AF1F449 X-Spam-Level: X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Action: no action X-Spamd-Result: default: False [-12.71 / 50.00]; SUSE_INTERNAL_BYPASS(-9.00)[]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_RHS_NOT_FQDN(0.50)[]; HAS_REPLYTO(0.30)[pvorel@suse.cz]; R_DKIM_ALLOW(-0.20)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; TO_DN_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.cz:email,suse.cz:dkim,suse.cz:replyto,imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo,linux-test-project.readthedocs.io:url]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; ARC_NA(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DKIM_TRACE(0.00)[suse.cz:+]; MISSING_XM_UA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; RCPT_COUNT_SEVEN(0.00)[9]; RCVD_VIA_SMTP_AUTH(0.00)[]; REPLYTO_EQ_FROM(0.00)[] X-Spam-Score: -12.71 X-Spam-Status: No, score=-18.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 X-Virus-Scanned: clamav-milter 1.0.9 at in-6.smtp.seeweb.it X-Virus-Status: Clean Subject: Re: [LTP] [PATCH] sys_cpu_topology02: Drop upper bound on core_id X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Petr Vorel Cc: Wake Liu , Kazuhiro Inaba , Grzegorz Jaszczyk , Linux Test Project Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "ltp" Hi Hubert, > sys_cpu_topology02 currently checks that each online CPU's > /sys/devices/system/cpu/cpuN/topology/core_id is in the range > [0, poss_max_id], assuming that core_id is a dense 0-based index bounded > by the highest possible CPU id. > Per Linux Documentation/ABI/stable/sysfs-devices-system-cpu, core_id is: > "Typically it is the hardware platform's identifier (rather than the > kernel's). The actual value is architecture and platform dependent." > - On x86, arch/x86/kernel/cpu/topology_common.c derives core_id from the > hardware APIC ID domain bits. On Intel hybrid CPUs, APIC IDs are > sparsely allocated across core types and clusters; for example, on an > 8-CPU Intel hybrid system (possible: 0-7), core_id values are > 0, 4, 8, 12, 32, 33, 34, 35, causing sys_cpu_topology02 to fail on > cpu2..cpu7: Good catch, thanks! > sys_cpu_topology02.c:83: TFAIL: > /sys/devices/system/cpu/cpu2/topology/core_id = 8 out of range [0, 7] > /sys/devices/system/cpu/cpu3/topology/core_id = 12 out of range [0, 7] > /sys/devices/system/cpu/cpu4/topology/core_id = 32 out of range [0, 7] > - On arm64 with ACPI PPTT, drivers/acpi/pptt.c populates core_id from > the firmware ACPI processor UID or the PPTT table byte offset, neither > of which is bounded by the CPU count. > Drop the upper bound on core_id to LONG_MAX (preserving the >= 0 > sanity check), update the test documentation comment accordingly, and > remove the now-unused poss_max_id parameter from check_cpu_topology(). Indeed, the test gets fixed by this on my laptop. I'm ok with it, @Cyril WDYT? The main concern I have is that you left poss_max_id variable which is now useless. This part is not needed any more: if (tst_is_virt(VIRT_ANY)) pkg_max_id = LONG_MAX; else pkg_max_id = poss_max_id; (and the variable declaration itself, of course). With that removed you may add my RBT: Reviewed-by: Petr Vorel > Fixes: d19bf8f7dede ("testcases: sysfs: Add sys_cpu_topology02") > Signed-off-by: Hubert Mazur > --- > .../kernel/sysfs/devices/system/cpu/sys_cpu_topology02.c | 14 +++++++++----- > 1 file changed, 9 insertions(+), 5 deletions(-) > diff --git a/testcases/kernel/sysfs/devices/system/cpu/sys_cpu_topology02.c b/testcases/kernel/sysfs/devices/system/cpu/sys_cpu_topology02.c > index 7098da9f3..57353d9d1 100644 > --- a/testcases/kernel/sysfs/devices/system/cpu/sys_cpu_topology02.c > +++ b/testcases/kernel/sysfs/devices/system/cpu/sys_cpu_topology02.c > @@ -22,8 +22,12 @@ > * in sync on every architecture, and avoids a spurious failure if a > * sibling CPU is hot-unplugged concurrently with this test running. > * - the CPU itself is contained in its own thread_siblings_list > - * - core_id is in [0, highest possible CPU id], since there can be at most > - * as many cores as possible CPUs (every core has at least one thread) > + * - core_id is non-negative. Per > + * Documentation/ABI/stable/sysfs-devices-system-cpu, core_id is typically Please instead of plain Documentation/ABI/stable/sysfs-devices-system-cpu use :kernel_tree:`Documentation/ABI/stable/sysfs-devices-system-cpu` which links it in our doc [1] to kernel doc URL [2]. We could even use official kernel doc generated from Documentation/ABI/stable/sysfs-devices-system-cpu [3], but :kernel_tree: would be good for now. Also, I updated formatting of the docs, please rebase for v2. Kind regards, Petr [1] https://linux-test-project.readthedocs.io/en/latest/users/test_catalog.html#sys-cpu-topology02 [2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/ABI/stable/sysfs-devices-system-cpu [3] https://docs.kernel.org/admin-guide/abi-stable.html#abi-sys-devices-system-cpu-cpux-topology-core-id > + * the hardware platform's identifier rather than a dense kernel index, so > + * it is not bounded by the highest possible CPU id (e.g. x86 derives it > + * from the hardware APIC ID, which is sparse on Intel hybrid CPUs, and > + * arm64 ACPI PPTT may export a firmware UID or table byte offset). > * - physical_package_id is in [-1, highest possible CPU id] on physical > * hardware, or just at least -1 under virtualization (see below). -1 is a > * legitimate value here, not just a range extension for safety: per > @@ -66,7 +70,7 @@ static void check_self_in_threads(int cpu) > PATH_SYS_CPU "/cpu%d/topology/thread_siblings_list", cpu); > } > -static void check_cpu_topology(int cpu, int poss_max_id, long pkg_max_id) > +static void check_cpu_topology(int cpu, long pkg_max_id) > { > char sub[PATH_MAX], super[PATH_MAX]; > @@ -80,7 +84,7 @@ static void check_cpu_topology(int cpu, int poss_max_id, long pkg_max_id) > tst_res(TINFO, "Checking cpu%d topology", cpu); > - TST_SYSFS_ASSERT_RANGELL(0, poss_max_id, > + TST_SYSFS_ASSERT_RANGELL(0, LONG_MAX, > PATH_SYS_CPU "/cpu%d/topology/core_id", cpu); > TST_SYSFS_ASSERT_RANGELL(-1, pkg_max_id, > @@ -124,7 +128,7 @@ static void do_test(void) > pkg_max_id = poss_max_id; > for (cpu = 0; cpu <= max_id; cpu++) > - check_cpu_topology(cpu, poss_max_id, pkg_max_id); > + check_cpu_topology(cpu, pkg_max_id); > } > static struct tst_test test = { -- Mailing list info: https://lists.linux.it/listinfo/ltp