linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Tiezhu Yang <yangtiezhu@loongson.cn>
To: Josh Poimboeuf <jpoimboe@kernel.org>
Cc: Philip Li <philip.li@intel.com>,
	kernel test robot <lkp@intel.com>,
	Guenter Roeck <linux@roeck-us.net>,
	oe-kbuild-all@lists.linux.dev,
	Andrew Morton <akpm@linux-foundation.org>,
	Linux Memory Management List <linux-mm@kvack.org>,
	Alessandro Carminati <acarmina@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	linux-kernel@vger.kernel.org, loongarch@lists.linux.dev
Subject: Re: [linux-next:master 12681/13861] drivers/i2c/i2c-core-base.o: warning: objtool: __i2c_transfer+0x120: stack state mismatch: reg1[24]=-1+0 reg2[24]=-2-24
Date: Tue, 8 Apr 2025 17:32:02 +0800	[thread overview]
Message-ID: <35f7eac8-a970-5fd3-25f4-55f417e8e15e@loongson.cn> (raw)
In-Reply-To: <ozfqe7ppl6q632nzyimsxvs2vh2uanjaranc3kj4pca5uwzt7g@hmhmjvtvrmb2>

On 04/08/2025 02:29 PM, Josh Poimboeuf wrote:
> On Tue, Apr 08, 2025 at 10:45:51AM +0800, Tiezhu Yang wrote:
>> So this is a run-time bug rather than a compile-time warning, it should
>> put the option "-fno-shrink-wrap" outside CONFIG_OBJTOOL in
>> arch/loongarch/Makefile as a workaround, like this:
>
> If loongarch folks agree it's a compiler bug, it should be reported to
> GCC, so the issue is better understood (and can get fixed).
>
> Without understanding the root cause, we don't know if -fno-shrink-wrap
> fixes it, or just makes this particular occurrence go away.

OK, thank you. I have discussed offline with the developers
Rui Wang and Lulu Cheng who are familiar with compiler, the
root cause may be that if a jump label's control flow path
exactly matches the caller's epilogue, the compiler may omit
restoring saved registers, it needs to be confirmed by GCC
developers.

By the way, add an empty inline assembly can also work around
the problem, like this:

diff --git a/arch/loongarch/include/asm/jump_label.h 
b/arch/loongarch/include/asm/jump_label.h
index 8a924bd69d19..dbc105e62380 100644
--- a/arch/loongarch/include/asm/jump_label.h
+++ b/arch/loongarch/include/asm/jump_label.h
@@ -34,6 +34,7 @@ static __always_inline bool arch_static_branch(struct 
static_key * const key, co
         return false;

  l_yes:
+       asm volatile("");
         return true;
  }

@@ -47,6 +48,7 @@ static __always_inline bool 
arch_static_branch_jump(struct static_key * const ke
         return false;

  l_yes:
+       asm volatile("");
         return true;
  }

We will fix this issue once the root cause is clear.

Thanks,
Tiezhu



      reply	other threads:[~2025-04-08  9:32 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-01  2:44 kernel test robot
2025-04-01  4:38 ` Philip Li
2025-04-01 19:45   ` Josh Poimboeuf
2025-04-03  9:35     ` Tiezhu Yang
2025-04-03  9:40       ` Huacai Chen
2025-04-03 14:37       ` Josh Poimboeuf
2025-04-07 10:52         ` Tiezhu Yang
2025-04-08  1:23           ` Josh Poimboeuf
2025-04-08  2:45             ` Tiezhu Yang
2025-04-08  6:29               ` Josh Poimboeuf
2025-04-08  9:32                 ` Tiezhu Yang [this message]

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=35f7eac8-a970-5fd3-25f4-55f417e8e15e@loongson.cn \
    --to=yangtiezhu@loongson.cn \
    --cc=acarmina@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=jpoimboe@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux@roeck-us.net \
    --cc=lkp@intel.com \
    --cc=loongarch@lists.linux.dev \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=peterz@infradead.org \
    --cc=philip.li@intel.com \
    /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