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

Re: [PATCH 4/4] tools/tests/x86_emulator: disable xmm* tests on clang


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Edwin Torok <edwin.torok@xxxxxxxxxx>
  • Date: Tue, 24 Feb 2026 09:34:53 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • 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=yLdHOwTTgqnX5/mIeM6S4siuMYMq9nsgZyCOc+o0Zr4=; b=e5TH2NGoilVxKSPrDM7hLPJ7jW0doKVeatgXIf9sIZVHp2uudJBIpEuzIgfX2HhjgRijSHC8f60RaXQgs0NMl/hQq8YBhM+u6TFvzpiqnX4k/kD280TKLLZ+bOkV8LTS9jTTUBRdsgQwe9lQjXCEmVyre5CyaUB07mXLahW9VT/v3b+pq7Jzsq50oBjSeltdTAYw54Ous3qq12od3U9m2tju5Updh9UEAzQjkOV5hevCrT2Atz3uoDIk+fE/mcD2dAelZeLnyB7T9zpelx3WBZGntVji6kVwAIzG3qgGc7svChPuFbcnK5TfLHlgnalpS2f3SDnQA+R8qo7DniwBhQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=RF4p1y95WdIoPXk4BjVEQmyE5IWI0WEcixnzkmsWKnogktHZPo3Z3jWbiejspimOdC1eWpXBkHAE+oKHQoMQxSCS+5DuaXAzK0HftMhkTxbSQnh4pFlekIIi8jnasIdEKRHetInt3gLf/8y43SAko7roo1uQSU5b9SHmvFW7sJ0aEtbuEH5N9bc8q3EpBF52HIIGvAamiy8a6UzOzdSXl0NHD3do04YW6hpUJtPYWTGpxStz7CjSWKxz4s+SBMlrwQFvHLi5L6cgJDk2G1t6OKgsFcGm0KUnBUiXXAtZZhUzQvXz3lfUIxV/WRdfkKsXUEEtKZs4UgXFBU/RUy49HA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monne <roger.pau@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Tue, 24 Feb 2026 09:35:05 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHcpKvkOO1o8Mk+1keRFSkNkxjvgbWQdKUAgAEjoAA=
  • Thread-topic: [PATCH 4/4] tools/tests/x86_emulator: disable xmm* tests on clang


> On 23 Feb 2026, at 16:10, Jan Beulich <jbeulich@xxxxxxxx> wrote:
> 
> On 23.02.2026 11:04, Edwin Török wrote:
>> clang-21 doesn't support `-ffixed-xmm0`, so `%xmm0` won't have the
>> expected value.
>> Disable these tests on clang.
> 
> I don't think that's what we want, and not only because of the clutter the
> various #ifdef cause. We want to be able to run as many of the tests as
> possible, so the first goal should be to find some alternative mechanism to
> achieve the same effect. A global register variable comes to mind as a
> possible option.
> 
> Further, how did you arrive at which tests need suppressing?

I used gdb to look at the 2 memory areas, and noticed that the XMM region was 
different between emulated and actual when built with clang.
Then I noticed the build failures due to the lack of fixed-xmm0.
Then I added the ifdefs one by one as I ran the test until the whole test 
program passed without failure.
I tried adding some ‘pxor xmm0, xmm0’ into the cpu_has_sse2 sections, but that 
didn’t really work either.

Although I may have been misled by the overlapping region, see below.

> I don't think
> we rely on an "expected value" anywhere. I don't even recall us passing
> -ffixed-xmm0 when compiling test_x86_emulate.c.

Yes, I’m surprised it works with GCC. But maybe only because the emulator 
overwrites the actual FXSAVE area corresponding to XMM.
XMM0 begins at offset 160, and 0x100 - 0x80 = 128.
AFAICT the actual execution stores its result at [0x80, 0x80+0x200), and the 
emulator stores its result into [0x100, 0x100+0x200).
So the emulator will overwrite some of the values from the actual run. 

This only works if the end of the FXSAVE area looks like its beginning (i.e. if 
FCW/FSW/etc. happens to match MM6/etc.)

If I move the regions, such that they are distinct, then this begins to fail 
with GCC too (perhaps due to the lack of fixed-xmm0, I haven’t tried).

Perhaps a better way to fix this would be to make the 2 regions distinct first, 
get it to work with GCC and then see what bugs remain on Clang.
I’ll try that approach, and see how far I get.

Best regards,
—Edwin

> We use that option when
> building various of the test blobs, iirc. And the comment ahead of the
> first use explains why we use the option there. (Later we also use
> -ffixed-ymm<N> and -ffixed-zmm<N>, btw.)
> 
> Jan


 


Rackspace

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