lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Yk5Rk4JALK0hsYym@iweiny-desk3>
Date:   Wed, 6 Apr 2022 19:50:59 -0700
From:   Ira Weiny <ira.weiny@...el.com>
To:     Dave Hansen <dave.hansen@...ux.intel.com>,
        "H. Peter Anvin" <hpa@...or.com>,
        Dan Williams <dan.j.williams@...el.com>
Cc:     Fenghua Yu <fenghua.yu@...el.com>,
        Rick Edgecombe <rick.p.edgecombe@...el.com>,
        "Shankar, Ravi V" <ravi.v.shankar@...el.com>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH V9 24/45] entry: Split up irqentry_exit_cond_resched()

On Thu, Mar 10, 2022 at 09:19:58AM -0800, Ira wrote:
> From: Ira Weiny <ira.weiny@...el.com>
> 
> Auxiliary pt_regs space needs to be manipulated by the generic
> entry/exit code.

Because of fix to the irqentry_exit_cond_resched() code[1] this patch needed
rework upon rebasing to 5.18-rc1

This basic design of this patch remains but the code is different.  The
irqentry_exit_cond_resched() still needs to have pt_regs passed into it.

However, this could be safely ignored for this review cycle as well.

As soon as I have a series based on 5.18 I'll resend the full series.

Thanks for understanding,
Ira

[1] 4624a14f4daa ("sched/preempt: Simplify irqentry_exit_cond_resched()
callers") 

> 
> Normally irqentry_exit() would take care of handling any auxiliary
> pt_regs on exit.  Unfortunately, the call to
> irqentry_exit_cond_resched() from xen_pv_evtchn_do_upcall() bypasses the
> normal irqentry_exit() call.  Because of this bypass
> irqentry_exit_cond_resched() will be required to handle any auxiliary
> pt_regs exit handling.  However, this prevents irqentry_exit() from
> being able to call irqentry_exit_cond_resched() and while maintaining
> control of the auxiliary pt_regs.
> 
> Separate out the common functionality of irqentry_exit_cond_resched() so
> that functionality can be used by irqentry_exit().  Add a pt_regs
> parameter in anticipation of having irqentry_exit_cond_resched() handle
> the auxiliary pt_regs separately from irqentry_exit().
> 
> Signed-off-by: Ira Weiny <ira.weiny@...el.com>
> 
> ---
> Changes for V9
> 	Update commit message
> 
> Changes for V8
> 	New Patch
> ---
>  arch/x86/entry/common.c      | 2 +-
>  include/linux/entry-common.h | 3 ++-
>  kernel/entry/common.c        | 9 +++++++--
>  3 files changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c
> index 6c2826417b33..f1ba770d035d 100644
> --- a/arch/x86/entry/common.c
> +++ b/arch/x86/entry/common.c
> @@ -309,7 +309,7 @@ __visible noinstr void xen_pv_evtchn_do_upcall(struct pt_regs *regs)
>  
>  	inhcall = get_and_clear_inhcall();
>  	if (inhcall && !WARN_ON_ONCE(state.exit_rcu)) {
> -		irqentry_exit_cond_resched();
> +		irqentry_exit_cond_resched(regs);
>  		instrumentation_end();
>  		restore_inhcall(inhcall);
>  	} else {
> diff --git a/include/linux/entry-common.h b/include/linux/entry-common.h
> index ddaffc983e62..14fd329847e7 100644
> --- a/include/linux/entry-common.h
> +++ b/include/linux/entry-common.h
> @@ -451,10 +451,11 @@ irqentry_state_t noinstr irqentry_enter(struct pt_regs *regs);
>  
>  /**
>   * irqentry_exit_cond_resched - Conditionally reschedule on return from interrupt
> + * @regs:	Pointer to pt_regs of interrupted context
>   *
>   * Conditional reschedule with additional sanity checks.
>   */
> -void irqentry_exit_cond_resched(void);
> +void irqentry_exit_cond_resched(struct pt_regs *regs);
>  
>  void __irqentry_exit_cond_resched(void);
>  #ifdef CONFIG_PREEMPT_DYNAMIC
> diff --git a/kernel/entry/common.c b/kernel/entry/common.c
> index 490442a48332..f4210a7fc84d 100644
> --- a/kernel/entry/common.c
> +++ b/kernel/entry/common.c
> @@ -395,7 +395,7 @@ void __irqentry_exit_cond_resched(void)
>  DEFINE_STATIC_CALL(__irqentry_exit_cond_resched, __irqentry_exit_cond_resched);
>  #endif
>  
> -void irqentry_exit_cond_resched(void)
> +static void exit_cond_resched(void)
>  {
>  	if (IS_ENABLED(CONFIG_PREEMPTION)) {
>  #ifdef CONFIG_PREEMPT_DYNAMIC
> @@ -406,6 +406,11 @@ void irqentry_exit_cond_resched(void)
>  	}
>  }
>  
> +void irqentry_exit_cond_resched(struct pt_regs *regs)
> +{
> +	exit_cond_resched();
> +}
> +
>  noinstr void irqentry_exit(struct pt_regs *regs, irqentry_state_t state)
>  {
>  	lockdep_assert_irqs_disabled();
> @@ -431,7 +436,7 @@ noinstr void irqentry_exit(struct pt_regs *regs, irqentry_state_t state)
>  		}
>  
>  		instrumentation_begin();
> -		irqentry_exit_cond_resched();
> +		exit_cond_resched();
>  		/* Covers both tracing and lockdep */
>  		trace_hardirqs_on();
>  		instrumentation_end();
> -- 
> 2.35.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ