Re: [PATCH v4 14/39] perf/x86: Rename get_segment_base() and make it global

2025-01-24 Thread Josh Poimboeuf
On Fri, Jan 24, 2025 at 03:09:27PM -0500, Steven Rostedt wrote:
> On Tue, 21 Jan 2025 18:31:06 -0800
> Josh Poimboeuf  wrote:
> 
> > diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c
> > index c75c482d4c52..23ac6343cf86 100644
> > --- a/arch/x86/events/core.c
> > +++ b/arch/x86/events/core.c
> > @@ -2790,7 +2790,7 @@ valid_user_frame(const void __user *fp, unsigned long 
> > size)
> > return __access_ok(fp, size);
> >  }
> >  
> > -static unsigned long get_segment_base(unsigned int segment)
> > +unsigned long segment_base_address(unsigned int segment)
> >  {
> > struct desc_struct *desc;
> > unsigned int idx = segment >> 3;
> 
> As this requires interrupts disabled, and if you do move this out of this
> file, you probably should add:
> 
>   lockdep_assert_irqs_disabled();

Indeed...

-- 
Josh



Re: [PATCH v4 14/39] perf/x86: Rename get_segment_base() and make it global

2025-01-24 Thread Steven Rostedt
On Tue, 21 Jan 2025 18:31:06 -0800
Josh Poimboeuf  wrote:

> diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c
> index c75c482d4c52..23ac6343cf86 100644
> --- a/arch/x86/events/core.c
> +++ b/arch/x86/events/core.c
> @@ -2790,7 +2790,7 @@ valid_user_frame(const void __user *fp, unsigned long 
> size)
>   return __access_ok(fp, size);
>  }
>  
> -static unsigned long get_segment_base(unsigned int segment)
> +unsigned long segment_base_address(unsigned int segment)
>  {
>   struct desc_struct *desc;
>   unsigned int idx = segment >> 3;

As this requires interrupts disabled, and if you do move this out of this
file, you probably should add:

lockdep_assert_irqs_disabled();

-- Steve



Re: [PATCH v4 14/39] perf/x86: Rename get_segment_base() and make it global

2025-01-22 Thread Josh Poimboeuf
On Wed, Jan 22, 2025 at 01:51:54PM +0100, Peter Zijlstra wrote:
> On Tue, Jan 21, 2025 at 06:31:06PM -0800, Josh Poimboeuf wrote:
> > get_segment_base() will be used by the unwind_user code, so make it
> > global and rename it so it doesn't conflict with a KVM function of the
> > same name.
> 
> Should it not also get moved out of the perf code in this case?

True, I'll try to find it a better home.

-- 
Josh



Re: [PATCH v4 14/39] perf/x86: Rename get_segment_base() and make it global

2025-01-22 Thread Peter Zijlstra
On Tue, Jan 21, 2025 at 06:31:06PM -0800, Josh Poimboeuf wrote:
> get_segment_base() will be used by the unwind_user code, so make it
> global and rename it so it doesn't conflict with a KVM function of the
> same name.

Should it not also get moved out of the perf code in this case?