public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Jones <andrew.jones@linux.dev>
To: Nicholas Piggin <npiggin@gmail.com>
Cc: kvm@vger.kernel.org, kvm-riscv@lists.infradead.org,
	 pbonzini@redhat.com, thuth@redhat.com, kvmarm@lists.linux.dev,
	 linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org,
	lvivier@redhat.com,  frankja@linux.ibm.com,
	imbrenda@linux.ibm.com, nrb@linux.ibm.com
Subject: Re: [kvm-unit-tests PATCH 03/13] treewide: lib/stack: Fix backtrace
Date: Thu, 29 Feb 2024 12:48:11 +0100	[thread overview]
Message-ID: <20240229-b470bcfe6538d0fea44ab3e3@orel> (raw)
In-Reply-To: <CZH8V1T0Z3QN.1ZVFAXR4B96BZ@wheely>

On Thu, Feb 29, 2024 at 01:31:52PM +1000, Nicholas Piggin wrote:
> On Thu Feb 29, 2024 at 1:04 AM AEST, Andrew Jones wrote:
...
> > diff --git a/lib/stack.h b/lib/stack.h
> > index 10fc2f793354..6edc84344b51 100644
> > --- a/lib/stack.h
> > +++ b/lib/stack.h
> > @@ -11,17 +11,27 @@
> >  #include <asm/stack.h>
> >  
> >  #ifdef HAVE_ARCH_BACKTRACE_FRAME
> > -extern int backtrace_frame(const void *frame, const void **return_addrs,
> > -			   int max_depth);
> > +extern int arch_backtrace_frame(const void *frame, const void **return_addrs,
> > +				int max_depth, bool current_frame);
> > +
> > +static inline int backtrace_frame(const void *frame, const void **return_addrs,
> > +				  int max_depth)
> > +{
> > +	return arch_backtrace_frame(frame, return_addrs, max_depth, false);
> > +}
> > +
> > +static inline int backtrace(const void **return_addrs, int max_depth)
> > +{
> > +	return arch_backtrace_frame(NULL, return_addrs, max_depth, true);
> > +}
> >  #else
> > -static inline int
> > -backtrace_frame(const void *frame __unused, const void **return_addrs __unused,
> > -		int max_depth __unused)
> > +extern int backtrace(const void **return_addrs, int max_depth);
> > +
> > +static inline int backtrace_frame(const void *frame, const void **return_addrs,
> > +				  int max_depth)
> >  {
> >  	return 0;
> >  }
> >  #endif
> >  
> > -extern int backtrace(const void **return_addrs, int max_depth);
> > -
> >  #endif
> 
> Is there a reason to add the inline wrappers rather than just externs
> and drop the arch_ prefix?

Only reason is to avoid duplicating the functions in each arch, but
since they're oneliners which won't likely change, then we could
duplicate them instead, if preferred, but I'm not sure what the
benefit of that over the static inlines would be.

> 
> Do we want to just generally have all arch specific functions have an
> arch_ prefix? Fine by me.

We've been slowly doing that over in 'KVM selftests', which has improved
readability, so slowly adopting it here too in kvm-unit-tests would be
nice.

> 
> Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
> 
> I'm fine to rebase the powerpc patch on top of this if it goes in first.
> Thanks for the heads up.
> 

Thanks,
drew

  reply	other threads:[~2024-02-29 11:48 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-28 15:04 [kvm-unit-tests PATCH 00/13] Enable EFI support Andrew Jones
2024-02-28 15:04 ` [kvm-unit-tests PATCH 01/13] riscv: Call abort instead of assert on unhandled exceptions Andrew Jones
2024-02-28 15:04 ` [kvm-unit-tests PATCH 02/13] riscv: show_regs: Prepare for EFI images Andrew Jones
2024-02-28 15:04 ` [kvm-unit-tests PATCH 03/13] treewide: lib/stack: Fix backtrace Andrew Jones
2024-02-28 17:33   ` Claudio Imbrenda
2024-02-29  3:31   ` Nicholas Piggin
2024-02-29 11:48     ` Andrew Jones [this message]
2024-02-28 15:04 ` [kvm-unit-tests PATCH 04/13] treewide: lib/stack: Make base_address arch specific Andrew Jones
2024-02-29  3:49   ` Nicholas Piggin
2024-02-29 11:54     ` Andrew Jones
2024-02-28 15:04 ` [kvm-unit-tests PATCH 05/13] riscv: Import gnu-efi files Andrew Jones
2024-02-28 15:04 ` [kvm-unit-tests PATCH 06/13] riscv: Tweak the gnu-efi imported code Andrew Jones
2024-02-28 15:04 ` [kvm-unit-tests PATCH 07/13] riscv: Enable building for EFI Andrew Jones
2024-02-28 15:04 ` [kvm-unit-tests PATCH 08/13] riscv: efi: Switch stack in _start Andrew Jones
2024-02-28 15:04 ` [kvm-unit-tests PATCH 09/13] efi: Add support for obtaining the boot hartid Andrew Jones
2024-02-28 15:04 ` [kvm-unit-tests PATCH 10/13] riscv: Refactor setup code Andrew Jones
2024-02-28 15:04 ` [kvm-unit-tests PATCH 11/13] riscv: Enable EFI boot Andrew Jones
2024-02-28 15:04 ` [kvm-unit-tests PATCH 12/13] riscv: efi: Add run script Andrew Jones
2024-02-28 15:04 ` [kvm-unit-tests PATCH 13/13] riscv: efi: Use efi-direct by default Andrew Jones

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=20240229-b470bcfe6538d0fea44ab3e3@orel \
    --to=andrew.jones@linux.dev \
    --cc=frankja@linux.ibm.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=kvm-riscv@lists.infradead.org \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.linux.dev \
    --cc=linux-s390@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=lvivier@redhat.com \
    --cc=npiggin@gmail.com \
    --cc=nrb@linux.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=thuth@redhat.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