lkml.org 
[lkml]   [2021]   [May]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    SubjectRe: [RFC PATCH v2 1/2] x86/speculation: Allow per-process control of when to issue IBPB
    Date
    Anand,

    On Thu, Apr 29 2021 at 18:44, Anand K. Mistry wrote:
    >
    > -static inline unsigned long mm_mangle_tif_spec_ib(struct task_struct *next)
    > +static inline unsigned long mm_mangle_tif_spec_ib_on_leave(
    > + struct task_struct *next)
    > {
    > unsigned long next_tif = task_thread_info(next)->flags;
    > - unsigned long ibpb = (next_tif >> TIF_SPEC_IB) & LAST_USER_MM_IBPB;
    > + unsigned long spec_disabled =
    > + (next_tif >> TIF_SPEC_IB) & ~(next_tif >> TIF_NO_IBPB_LEAVE);
    > + unsigned long ibpb = spec_disabled & LAST_USER_MM_IBPB;
    >
    > return (unsigned long)next->mm | ibpb;
    > }
    >
    > +static inline bool ibpb_on_entry(struct task_struct *next)
    > +{
    > + unsigned long next_tif = task_thread_info(next)->flags;
    > + unsigned long spec_disabled =
    > + (next_tif >> TIF_SPEC_IB) & ~(next_tif >> TIF_NO_IBPB_ENTRY);
    > + return spec_disabled & 1;
    > +}

    Why exactly do we need _three_ TIF bits and this non-intuitive inverted
    logic?

    The existing mode is: Issue IBPB when scheduling in and when scheduling out.

    Ergo the obvious approach for making it more finegrained is to split the
    existing TIF_SPEC_IB into TIF_SPEC_IB_IN and TIF_SPEC_IB_OUT and have
    the existing mode both bits set.

    Thanks,

    tglx


    \
     
     \ /
      Last update: 2021-05-03 10:49    [W:7.119 / U:0.052 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site