[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAD=FV=XMSsMFpPzBckkWhP6iDR4WM+qdV7J=aQCBbbBit_rDwg@mail.gmail.com>
Date: Sat, 16 May 2020 09:17:21 -0700
From: Doug Anderson <dianders@...omium.org>
To: "liwei (GF)" <liwei391@...wei.com>
Cc: Daniel Thompson <daniel.thompson@...aro.org>,
Jason Wessel <jason.wessel@...driver.com>,
Marc Zyngier <maz@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Masami Hiramatsu <mhiramat@...nel.org>,
David Miller <davem@...emloft.net>,
Will Deacon <will@...nel.org>,
Catalin Marinas <catalin.marinas@....com>,
Linux ARM <linux-arm-kernel@...ts.infradead.org>,
LKML <linux-kernel@...r.kernel.org>, liwei1412@....com
Subject: Re: [PATCH 2/4] arm64: Extract kprobes_save_local_irqflag() and kprobes_restore_local_irqflag()
Hi,
On Sat, May 16, 2020 at 1:47 AM liwei (GF) <liwei391@...wei.com> wrote:
>
> >> - kprobes_save_local_irqflag(kcb, regs);
> >> + kernel_prepare_single_step(&kcb->saved_irqflag, regs);
> >
> > Is there some reason to have two functions? It seems like every time
> > you call kernel_enable_single_step() you'd want to call
> > kernel_prepare_single_step(). ...and every time you call
> > kernel_disable_single_step() you'd want to call
> > kernel_cleanup_single_step().
> >
> > Maybe you can just add the flags parameter to
> > kernel_enable_single_step() / kernel_disable_single_step() and put the
> > code in there?
> >
>
> As kernel_enable_single_step() / kernel_disable_single_step() are also called in
> breakpoint_handler() and watchpoint_handler(), i am not sure it's a right thing
> to put the daif flag prepare/cleanup into them, especially we don't have a context
> to save the flags.
I think you misunderstood what I was suggesting. Maybe better with
examples? I was suggesting doing this:
kcb->saved_irqflag = kernel_enable_single_step(regs);
...
kernel_disable_single_step(kcb->saved_irqflag, regs);
To me that seems better than what you have now:
kcb->saved_irqflag = kernel_prepare_single_step(regs);
kernel_enable_single_step(regs);
...
kernel_cleanup_single_step(kcb->saved_irqflag, regs);
kernel_disable_single_step();
...or am I confused?
-Doug
Powered by blists - more mailing lists