2015-02-03 11:05:22

by David Vrabel

[permalink] [raw]
Subject: Re: [Xen-devel] [PATCH v5 1/2] xen: add xen_is_preemptible_hypercall()

On 27/01/15 01:51, Luis R. Rodriguez wrote:
>
> +#ifndef CONFIG_PREEMPT
> +extern struct { char _entry[32]; } preemptible_hypercall_page[];
> +
> +static inline bool xen_is_preemptible_hypercall(struct pt_regs *regs)
> +{
> + return !user_mode_vm(regs) &&
> + regs->ip >= (unsigned long)preemptible_hypercall_page &&
> + regs->ip < (unsigned long)preemptible_hypercall_page + PAGE_SIZE;

I asked for this test to be optimized.

return (regs->ip >> PAGE_SHIFT)
== ((unsigned long)preemptible_hypercall_page >> PAGE_SHIFT)
&& !user_mode_vm(regs);

David


2015-02-03 18:03:40

by Luis Chamberlain

[permalink] [raw]
Subject: Re: [Xen-devel] [PATCH v5 1/2] xen: add xen_is_preemptible_hypercall()

On Tue, Feb 03, 2015 at 11:05:15AM +0000, David Vrabel wrote:
> On 27/01/15 01:51, Luis R. Rodriguez wrote:
> >
> > +#ifndef CONFIG_PREEMPT
> > +extern struct { char _entry[32]; } preemptible_hypercall_page[];
> > +
> > +static inline bool xen_is_preemptible_hypercall(struct pt_regs *regs)
> > +{
> > + return !user_mode_vm(regs) &&
> > + regs->ip >= (unsigned long)preemptible_hypercall_page &&
> > + regs->ip < (unsigned long)preemptible_hypercall_page + PAGE_SIZE;
>
> I asked for this test to be optimized.
>
> return (regs->ip >> PAGE_SHIFT)
> == ((unsigned long)preemptible_hypercall_page >> PAGE_SHIFT)
> && !user_mode_vm(regs);

It didn't seem you were so sure about it and I asked some
clarifications about it but you had not replied:

http://www.gossamer-threads.com/lists/xen/devel/363565?page=last

Luis