• B
    ppc: Do some batching of TCG tlb flushes · cd0c6f47
    Benjamin Herrenschmidt 提交于
    On ppc64 especially, we flush the tlb on any slbie or tlbie instruction.
    
    However, those instructions often come in bursts of 3 or more (context
    switch will favor a series of slbie's for example to an slbia if the
    SLB has less than a certain number of entries in it, and tlbie's can
    happen in a series, with PAPR, H_BULK_REMOVE can remove up to 4 entries
    at a time.
    
    Doing a tlb_flush() each time is a waste of time. We end up doing a memset
    of the whole TLB, reloading it for the next instruction, memset'ing again,
    etc...
    
    Those instructions don't have to take effect immediately. For slbie, they
    can wait for the next context synchronizing event. For tlbie, the next
    tlbsync.
    
    This implements batching by keeping a flag that indicates that we have a
    TLB in need of flushing. We check it on interrupts, rfi's, isync's and
    tlbsync and flush the TLB if needed.
    
    This reduces the number of tlb_flush() on a boot to a ubuntu installer
    first dialog screen from roughly 360K down to 36K.
    Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
    [clg: added a 'CPUPPCState *' variable in h_remove() and
          h_bulk_remove() ]
    Signed-off-by: NCédric Le Goater <clg@kaod.org>
    [dwg: removed spurious whitespace change, use 0/1 not true/false
          consistently, since tlb_need_flush has int type]
    Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
    cd0c6f47
helper.h 26.4 KB