public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: Valentin Obst <kernel@valentinobst.de>
Cc: "Borislav Petkov" <bp@alien8.de>,
	"Dave Hansen" <dave.hansen@linux.intel.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	"Ingo Molnar" <mingo@kernel.org>,
	"Ingo Molnar" <mingo@redhat.com>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	"Andreas Hindborg" <a.hindborg@samsung.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"John Baublitz" <john.m.baublitz@gmail.com>,
	"Masami Hiramatsu" <mhiramat@kernel.org>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Peter Zijlstra" <peterz@infradead.org>,
	"Sergio González Collado" <sergio.collado@gmail.com>,
	linux-kernel@vger.kernel.org, x86@kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH v3] x86/tools: fix line number reported for malformed lines
Date: Wed, 3 Apr 2024 09:17:48 +0900	[thread overview]
Message-ID: <20240403091748.ee180a7a1d4bf92e0c46fb8a@kernel.org> (raw)
In-Reply-To: <20240329-x86-insn-decoder-line-fix-v3-1-ec97e21d63bf@valentinobst.de>

On Fri, 29 Mar 2024 12:31:58 +0100
Valentin Obst <kernel@valentinobst.de> wrote:

> Commit 35039eb6b199 ("x86: Show symbol name if insn decoder test failed")
> included symbol lines in the post-processed objdump output consumed by
> the insn decoder test. This broke the `instuction lines == total lines`
> property that `insn_decoder_test.c` relied upon to print the offending
> line's number in error messages. This has the consequence that the line
> number reported on a test failure is unreated to, and much smaller than,
> the line that actually caused the problem.
> 
> Add a new variable that counts the combined (insn+symbol) line count and
> report this in the error message.

This looks good to me. Thanks!

Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>

> 
> Fixes: 35039eb6b199 ("x86: Show symbol name if insn decoder test failed")
> Cc: stable@vger.kernel.org
> Reviewed-by: Miguel Ojeda <ojeda@kernel.org>
> Tested-by: Miguel Ojeda <ojeda@kernel.org>
> Reported-by: John Baublitz <john.m.baublitz@gmail.com>
> Debugged-by: John Baublitz <john.m.baublitz@gmail.com>
> Signed-off-by: Valentin Obst <kernel@valentinobst.de>
> ---
> See v2's commit message and [1] for context why this bug made debugging a
> test failure harder than necessary.
> 
> [1]: https://rust-for-linux.zulipchat.com/#narrow/stream/291565-Help/topic/insn_decoder_test.20failure/near/421075039
> 
> Changes in v3:
> - Add Cc stable tag in sign-off area.
> - Make commit message less verbose.
> - Link to v2: https://lore.kernel.org/r/20240223-x86-insn-decoder-line-fix-v2-1-cde49c69f402@valentinobst.de
> 
> Changes in v2:
> - Added tags 'Reviewed-by', 'Tested-by', 'Reported-by', 'Debugged-by',
>   'Link', and 'Fixes'.
> - Explain why this patch fixes the commit mentioned in the 'Fixes' tag.
> - CCed the stable list and sent to all x86 maintainers.
> - Link to v1: https://lore.kernel.org/r/20240221-x86-insn-decoder-line-fix-v1-1-47cd5a1718c6@valentinobst.de
> ---
>  arch/x86/tools/insn_decoder_test.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/tools/insn_decoder_test.c b/arch/x86/tools/insn_decoder_test.c
> index 472540aeabc2..727017a3c3c7 100644
> --- a/arch/x86/tools/insn_decoder_test.c
> +++ b/arch/x86/tools/insn_decoder_test.c
> @@ -114,6 +114,7 @@ int main(int argc, char **argv)
>  	unsigned char insn_buff[16];
>  	struct insn insn;
>  	int insns = 0;
> +	int lines = 0;
>  	int warnings = 0;
> 
>  	parse_args(argc, argv);
> @@ -123,6 +124,8 @@ int main(int argc, char **argv)
>  		int nb = 0, ret;
>  		unsigned int b;
> 
> +		lines++;
> +
>  		if (line[0] == '<') {
>  			/* Symbol line */
>  			strcpy(sym, line);
> @@ -134,12 +137,12 @@ int main(int argc, char **argv)
>  		strcpy(copy, line);
>  		tab1 = strchr(copy, '\t');
>  		if (!tab1)
> -			malformed_line(line, insns);
> +			malformed_line(line, lines);
>  		s = tab1 + 1;
>  		s += strspn(s, " ");
>  		tab2 = strchr(s, '\t');
>  		if (!tab2)
> -			malformed_line(line, insns);
> +			malformed_line(line, lines);
>  		*tab2 = '\0';	/* Characters beyond tab2 aren't examined */
>  		while (s < tab2) {
>  			if (sscanf(s, "%x", &b) == 1) {
> 
> ---
> base-commit: 4cece764965020c22cff7665b18a012006359095
> change-id: 20240221-x86-insn-decoder-line-fix-7b1f2e1732ff
> 
> Best regards,
> --
> Valentin Obst <kernel@valentinobst.de>
> 


-- 
Masami Hiramatsu (Google) <mhiramat@kernel.org>

  reply	other threads:[~2024-04-03  0:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-29 11:31 [PATCH v3] x86/tools: fix line number reported for malformed lines Valentin Obst
2024-04-03  0:17 ` Masami Hiramatsu [this message]
2024-05-15 18:17   ` Valentin Obst

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=20240403091748.ee180a7a1d4bf92e0c46fb8a@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=a.hindborg@samsung.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hpa@zytor.com \
    --cc=john.m.baublitz@gmail.com \
    --cc=kernel@valentinobst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=mingo@redhat.com \
    --cc=ojeda@kernel.org \
    --cc=peterz@infradead.org \
    --cc=sergio.collado@gmail.com \
    --cc=stable@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