[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4FBE475F.9080301@intel.com>
Date: Thu, 24 May 2012 22:36:15 +0800
From: Alex Shi <alex.shi@...el.com>
To: Jan Beulich <JBeulich@...e.com>
CC: borislav.petkov@....com, arnd@...db.de, a.p.zijlstra@...llo.nl,
akinobu.mita@...il.com, eric.dumazet@...il.com, fweisbec@...il.com,
rostedt@...dmis.org, hughd@...gle.com, jeremy@...p.org,
len.brown@...el.com, tony.luck@...el.com, yongjie.ren@...el.com,
kamezawa.hiroyu@...fujitsu.com, seto.hidetoshi@...fujitsu.com,
penberg@...nel.org, yinghai@...nel.org, tglx@...utronix.de,
akpm@...ux-foundation.org, ak@...ux.intel.com, luto@....edu,
avi@...hat.com, dhowells@...hat.com, mingo@...hat.com,
riel@...hat.com, cpw@....com, steiner@....com,
linux-kernel@...r.kernel.org, viro@...iv.linux.org.uk,
hpa@...or.com
Subject: Re: [PATCH v7 2/8] x86/flush_tlb: try flush_tlb_single one by one
in flush_tlb_range
On 05/24/2012 05:44 PM, Jan Beulich wrote:
>>>> On 24.05.12 at 10:55, Alex Shi <alex.shi@...el.com> wrote:
>> On 05/24/2012 04:12 PM, Jan Beulich wrote:
>>
>>>>>> On 24.05.12 at 08:41, Alex Shi <alex.shi@...el.com> wrote:
>>>> So, the following change should be more safe for PV?
>>>>
>>>> - if (va == TLB_FLUSH_ALL) {
>>>> - args->op.cmd = MMUEXT_TLB_FLUSH_MULTI;
>>>> - } else {
>>>> - args->op.cmd = MMUEXT_INVLPG_MULTI;
>>>> - args->op.arg1.linear_addr = va;
>>>> - }
>>>> + args->op.cmd = MMUEXT_TLB_FLUSH_MULTI;
>>>
>>> This would be safe ...
>>>
>>>> + if (start != TLB_FLUSH_ALL)
>>>> + args->op.arg1.linear_addr = start;
>>>
>>> ... and then this superfluous, but it'd result in an unconditional
>>> full TLB flush. When start and end (or perhaps end-1, assuming
>>> end is not inclusive) are on the same page, MMUEXT_INVLPG_MULTI
>>> should be used; MMUEXT_TLB_FLUSH_MULTI might need to be
>>> used in all other cases, unless you want to split multi-page, non-
>>> global invalidations into multiple MMUEXT_INVLPG_MULTI-s (which
>>> would appear to be what the whole patch aims at).
>>
>>
>> args->op.cmd = MMUEXT_TLB_FLUSH_MULTI;
>> - if (start != TLB_FLUSH_ALL)
>> + if (start != TLB_FLUSH_ALL && (end - start) < PAGE_SIZE) {
>
> Assuming 'end' is not inclusive (you didn't clarify that),
>
> if (start != TLB_FLUSH_ALL && (end - start) <= PAGE_SIZE) {
>
> (and only if 'start' is guaranteed to be page aligned).
I still a idiot for xen and a newbie for kernel. :)
AFAIK, if system just flush one page, it won't set end there. But anyway
using '<=' has no problem.
>
>> + args->op.cmd = MMUEXT_INVLPG_MULTI;
>> args->op.arg1.linear_addr = start;
>> + }
>>
>> So, above it correct code for xen?
>> As to the xen optimisation of flush range, it is may better to be done
>> in a separate patch.
>
> Agreed.
Thanks for all comments!
>
> Jan
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists