From: Dave Hansen <dave.hansen@intel.com>
To: Sebastian Sumpf <Sebastian.Sumpf@genode-labs.com>,
Borislav Petkov <bp@alien8.de>
Cc: tglx@linutronix.de, mingo@redhat.com,
dave.hansen@linux.intel.com, x86@kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [Bug report] __arch_hweight32/64 x86
Date: Mon, 26 Jun 2023 15:41:27 -0700 [thread overview]
Message-ID: <02b36386-a18c-8bfb-2c70-c398f6fc964b@intel.com> (raw)
In-Reply-To: <ce1cc0a5-3393-d16f-eaaf-5e7149d5164f@genode-labs.com>
[-- Attachment #1: Type: text/plain, Size: 1148 bytes --]
On 6/26/23 14:42, Sebastian Sumpf wrote:
>
>>> Therefore, these registers will not be restored
>>> upon function return by the compiler. This leads to varying
>>> exceptions/bad behavior caused by the thus corrupted registers later
>>> on.
>>
>> How do I reproduce what you're observing so that I can take a look?
>
> This is hard to tell, I would disable the " X86_FEATURE_POPCNT" feature
> and use the ' CONFIG_ARCH_HAS_FAST_MULTIPLIER' option in order to use
> the multiplier implementation in '__sw_hweight64' in 'lib/hweight.c' At
> least that is what triggered it here.
Looks like you'd also have to be using UML:
$ grep hweight lib/Makefile
obj-$(CONFIG_GENERIC_HWEIGHT) += hweight.o
$ grep -r GENERIC_HWEIGHT arch/x86
arch/x86/um/Kconfig:config GENERIC_HWEIGHT
I'm not even sure that UML needs GENERIC_HWEIGHT. From a quick glance,
it looks like x86 used to use GENERIC_HWEIGHT, but got arch-specific
versions later. UML just never moved over to the arch-specific versions.
I _think_ the attached patch might just fix the problems with the C
version and bring the x86/UML implementation back in line with the rest
of x86.
Thoughts?
[-- Attachment #2: um-hweight.patch --]
[-- Type: text/x-patch, Size: 289 bytes --]
diff --git a/arch/x86/um/Kconfig b/arch/x86/um/Kconfig
index 186f13268401..76d507860be4 100644
--- a/arch/x86/um/Kconfig
+++ b/arch/x86/um/Kconfig
@@ -44,6 +44,3 @@ config ARCH_HAS_SC_SIGNALS
config ARCH_REUSE_HOST_VSYSCALL_AREA
def_bool !64BIT
-
-config GENERIC_HWEIGHT
- def_bool y
next prev parent reply other threads:[~2023-06-26 22:41 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-26 20:49 Sebastian Sumpf
2023-06-26 21:06 ` Borislav Petkov
2023-06-26 21:42 ` Sebastian Sumpf
2023-06-26 22:41 ` Dave Hansen [this message]
2023-06-27 4:25 ` Borislav Petkov
2023-06-27 16:57 ` Sebastian Sumpf
2023-06-29 9:10 ` David Laight
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=02b36386-a18c-8bfb-2c70-c398f6fc964b@intel.com \
--to=dave.hansen@intel.com \
--cc=Sebastian.Sumpf@genode-labs.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®