From: "David Rheinsberg" <david@readahead.eu>
To: "Ingo Molnar" <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org,
"H. Peter Anvin" <hpa@zytor.com>,
x86@kernel.org, "Dave Hansen" <dave.hansen@linux.intel.com>,
"Borislav Petkov" <bp@alien8.de>,
"Ingo Molnar" <mingo@redhat.com>,
"Thomas Gleixner" <tglx@linutronix.de>
Subject: Re: [PATCH] x86/insn_decoder_test: allow longer symbol-names
Date: Fri, 27 Jan 2023 11:27:25 +0100 [thread overview]
Message-ID: <16641a56-9139-4396-a5a8-89606bedd1f1@app.fastmail.com> (raw)
In-Reply-To: <Y9ES4UKl/+DtvAVS@gmail.com>
Hi Ingo!
On Wed, Jan 25, 2023, at 12:30 PM, Ingo Molnar wrote:
> * David Rheinsberg <david@readahead.eu> wrote:
>> diff --git a/arch/x86/tools/insn_decoder_test.c b/arch/x86/tools/insn_decoder_test.c
>> index 472540aeabc2..366e07546344 100644
>> --- a/arch/x86/tools/insn_decoder_test.c
>> +++ b/arch/x86/tools/insn_decoder_test.c
>> @@ -106,7 +106,7 @@ static void parse_args(int argc, char **argv)
>> }
>> }
>>
>> -#define BUFSIZE 256
>> +#define BUFSIZE 4096
>
> That hard-coded constant is a bit lame and will cause trouble the minute
> *that* size is exceeded - don't we have some more natural figure, such as
> KSYM_SYMBOL_LEN?
Thanks for the hint! I tried mentioning this in the commit-message. I am unsure whether a fixed-size limit is the correct thing to do. However, given that this is a compile-time test-tool, I thought bumping the limit for this stack buffer to be sufficient. I am open to other suggestions.
The input to this tool is the output of objdump, so effectively annotated x86-assembly. To get a proper estimate of how long such a line could be, I would have to audit all instructions and know what kind of arguments are possible. Can some of them take multiple symbols as argument? Are there other possibly long encodings of arguments to consider?
Lastly, shouldn't this use KSYM_NAME_LEN rather than KSYM_SYMBOL_LEN? And then how much room for normal instruction-encoding should I calculate? I feel like whatever I do (even with those constants), I would end up with only an estimate and wouldn't actually end up closing this issue.
The current workaround is to just disable CONFIG_X86_DECODER_SELFTEST, which I thought is a sad state. I can gladly use `256 + KSYM_NAME_LEN` and add a comment ala "room for insn-encoding and a symbol name". Would that be acceptable? The alternative would be to try to dyn-alloc a buffer and increase it to the actual line-length?
Open to suggestions!
Thanks
David
next prev parent reply other threads:[~2023-01-27 10:28 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-24 11:04 David Rheinsberg
2023-01-25 11:30 ` Ingo Molnar
2023-01-27 10:27 ` David Rheinsberg [this message]
2024-02-20 17:07 ` Miguel Ojeda
2024-04-08 12:51 ` Danilo Krummrich
2024-04-08 15:22 ` Sergio González Collado
2024-04-08 15:30 ` Sergio González Collado
2024-11-29 15:40 Richard W.M. Jones
2024-12-24 15:24 ` Andrew Halaney
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=16641a56-9139-4396-a5a8-89606bedd1f1@app.fastmail.com \
--to=david@readahead.eu \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=mingo@redhat.com \
--cc=rust-for-linux@vger.kernel.org \
--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®