All of lore.kernel.org
 help / color / mirror / Atom feed
From: Charlie Jenkins <charlie@rivosinc.com>
To: "Maciej W. Rozycki" <macro@orcam.me.uk>
Cc: Paul Walmsley <paul.walmsley@sifive.com>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Huacai Chen <chenhuacai@kernel.org>,
	WANG Xuerui <kernel@xen0n.name>,
	Thomas Gleixner <tglx@linutronix.de>,
	Peter Zijlstra <peterz@infradead.org>,
	Andy Lutomirski <luto@kernel.org>,
	Alexandre Ghiti <alexghiti@rivosinc.com>,
	linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
	loongarch@lists.linux.dev
Subject: Re: [PATCH 1/4] riscv: entry: Convert ret_from_fork() to C
Date: Mon, 27 Jan 2025 12:55:40 -0800	[thread overview]
Message-ID: <Z5fyzMjj_5gqOupB@ghost> (raw)
In-Reply-To: <alpine.DEB.2.21.2501272017140.56843@angie.orcam.me.uk>

On Mon, Jan 27, 2025 at 08:20:56PM +0000, Maciej W. Rozycki wrote:
> On Sun, 26 Jan 2025, Charlie Jenkins wrote:
> 
> > >  Wouldn't it make sense to save a jump here and make it a tail call, i.e.:
> > > 
> > > 	la ra, ret_from_exception
> > > 	tail ret_from_fork
> > > 
> > 
> > I don't believe so due to the return address stack. It was shown in this
> > patch [1] that a 7% performance improvement can be seen on existing
> > riscv hardware by performing the extra jump. Doing tail calls should be
> > avoided on riscv since the hardware can be expected to predict the
> > return address incorrectly every time if the return address is manually
> > changed.
> 
>  Fair enough, thanks.  Though no link to said patch given.

Oops! Here it is:
https://lore.kernel.org/linux-riscv/20240607061335.2197383-1-cyrilbur@tenstorrent.com/.

> 
>   Maciej

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

WARNING: multiple messages have this Message-ID (diff)
From: Charlie Jenkins <charlie@rivosinc.com>
To: "Maciej W. Rozycki" <macro@orcam.me.uk>
Cc: Paul Walmsley <paul.walmsley@sifive.com>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Huacai Chen <chenhuacai@kernel.org>,
	WANG Xuerui <kernel@xen0n.name>,
	Thomas Gleixner <tglx@linutronix.de>,
	Peter Zijlstra <peterz@infradead.org>,
	Andy Lutomirski <luto@kernel.org>,
	Alexandre Ghiti <alexghiti@rivosinc.com>,
	linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
	loongarch@lists.linux.dev
Subject: Re: [PATCH 1/4] riscv: entry: Convert ret_from_fork() to C
Date: Mon, 27 Jan 2025 12:55:40 -0800	[thread overview]
Message-ID: <Z5fyzMjj_5gqOupB@ghost> (raw)
In-Reply-To: <alpine.DEB.2.21.2501272017140.56843@angie.orcam.me.uk>

On Mon, Jan 27, 2025 at 08:20:56PM +0000, Maciej W. Rozycki wrote:
> On Sun, 26 Jan 2025, Charlie Jenkins wrote:
> 
> > >  Wouldn't it make sense to save a jump here and make it a tail call, i.e.:
> > > 
> > > 	la ra, ret_from_exception
> > > 	tail ret_from_fork
> > > 
> > 
> > I don't believe so due to the return address stack. It was shown in this
> > patch [1] that a 7% performance improvement can be seen on existing
> > riscv hardware by performing the extra jump. Doing tail calls should be
> > avoided on riscv since the hardware can be expected to predict the
> > return address incorrectly every time if the return address is manually
> > changed.
> 
>  Fair enough, thanks.  Though no link to said patch given.

Oops! Here it is:
https://lore.kernel.org/linux-riscv/20240607061335.2197383-1-cyrilbur@tenstorrent.com/.

> 
>   Maciej

  reply	other threads:[~2025-01-27 20:55 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-22 22:56 [PATCH 0/4] entry: Move ret_from_fork() to C and inline syscall_exit_to_user_mode() Charlie Jenkins
2025-01-22 22:56 ` Charlie Jenkins
2025-01-22 22:56 ` [PATCH 1/4] riscv: entry: Convert ret_from_fork() to C Charlie Jenkins
2025-01-22 22:56   ` Charlie Jenkins
2025-01-24  7:09   ` Alexandre Ghiti
2025-01-24  7:09     ` Alexandre Ghiti
2025-01-24  7:56     ` Charlie Jenkins
2025-01-24  7:56       ` Charlie Jenkins
2025-01-25 23:30   ` Maciej W. Rozycki
2025-01-25 23:30     ` Maciej W. Rozycki
2025-01-26 19:51     ` Charlie Jenkins
2025-01-26 19:51       ` Charlie Jenkins
2025-01-27 20:20       ` Maciej W. Rozycki
2025-01-27 20:20         ` Maciej W. Rozycki
2025-01-27 20:55         ` Charlie Jenkins [this message]
2025-01-27 20:55           ` Charlie Jenkins
2025-01-22 22:56 ` [PATCH 2/4] riscv: entry: Split ret_from_fork() into user and kernel Charlie Jenkins
2025-01-22 22:56   ` Charlie Jenkins
2025-01-22 22:56 ` [PATCH 3/4] loongarch: entry: Migrate ret_from_fork() to C Charlie Jenkins
2025-01-22 22:56   ` Charlie Jenkins
2025-01-23 17:12   ` kernel test robot
2025-01-23 17:12     ` kernel test robot
2025-01-22 22:56 ` [PATCH 4/4] entry: Inline syscall_exit_to_user_mode() Charlie Jenkins
2025-01-22 22:56   ` Charlie Jenkins
2025-01-23 17:12   ` kernel test robot
2025-01-23 17:12     ` kernel test robot
2025-01-23 17:34   ` kernel test robot
2025-01-23 17:34     ` kernel test robot

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=Z5fyzMjj_5gqOupB@ghost \
    --to=charlie@rivosinc.com \
    --cc=alexghiti@rivosinc.com \
    --cc=chenhuacai@kernel.org \
    --cc=kernel@xen0n.name \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=loongarch@lists.linux.dev \
    --cc=luto@kernel.org \
    --cc=macro@orcam.me.uk \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.