[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: NMI watchdog: BUG: soft lockup



From: David Miller <davem@davemloft.net>
Date: Tue, 25 Oct 2016 13:18:08 -0400 (EDT)

> So the full virtual address comparison is something like:
> 
> 	unsigned long compare = (tag >> 22) << 22; /* Clear CONTEXT bits */
> 
> 	compare |= (tsb_index & (nentries - 1)) << 13;
> 
> 	if (vaddr == compare)
> 		goto match;
> 
> The swapper TSB only stores PAGE_SIZE translations.

Ok, this should work:

static void flush_tsb_kernel_range_scan(unsigned long start, unsigned long end)
{
        unsigned long idx;

        for (idx = 0; idx < KERNEL_TSB_NENTRIES; idx++) {
                struct tsb *ent = &swapper_tsb[idx];
                unsigned long match = idx << 13;

                match |= (ent->tag << 22);
                if (match >= start && match < end)
                        ent->tag = (1UL << TSB_TAG_INVALID_BIT);
        }
}

Bits 13-"21+N" come from the TSB index, and the tag always stores
bits 22 and above.  So simply 'or'ing them together always gives
us a usable match value.


Reply to: