Re: [tip:x86/platform] x86/hyper-v: Use hypercall for remote TLB flush
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- Subject: Re: [tip:x86/platform] x86/hyper-v: Use hypercall for remote TLB flush
- From: Juergen Gross <jgross@xxxxxxxx>
- Date: Fri, 11 Aug 2017 14:46:41 +0200
- Cc: Vitaly Kuznetsov <vkuznets@xxxxxxxxxx>, Jork Loeser <Jork.Loeser@xxxxxxxxxxxxx>, KY Srinivasan <kys@xxxxxxxxxxxxx>, Simon Xiao <sixiao@xxxxxxxxxxxxx>, Haiyang Zhang <haiyangz@xxxxxxxxxxxxx>, Stephen Hemminger <sthemmin@xxxxxxxxxxxxx>, "torvalds@xxxxxxxxxxxxxxxxxxxx" <torvalds@xxxxxxxxxxxxxxxxxxxx>, "luto@xxxxxxxxxx" <luto@xxxxxxxxxx>, "hpa@xxxxxxxxx" <hpa@xxxxxxxxx>, "linux-kernel@xxxxxxxxxxxxxxx" <linux-kernel@xxxxxxxxxxxxxxx>, "rostedt@xxxxxxxxxxx" <rostedt@xxxxxxxxxxx>, "andy.shevchenko@xxxxxxxxx" <andy.shevchenko@xxxxxxxxx>, "tglx@xxxxxxxxxxxxx" <tglx@xxxxxxxxxxxxx>, "mingo@xxxxxxxxxx" <mingo@xxxxxxxxxx>, "linux-tip-commits@xxxxxxxxxxxxxxx" <linux-tip-commits@xxxxxxxxxxxxxxx>, boris.ostrovsky@xxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx
- In-reply-to: <20170811123534.quyckfyspl5fqdrg@hirez.programming.kicks-ass.net>
- References: <20170802160921.21791-8-vkuznets@redhat.com> <tip-2ffd9e33ce4af4e8cfa3e17bf493defe8474e2eb@git.kernel.org> <20170810185646.GI6524@worktop.programming.kicks-ass.net> <DM5PR21MB0476915D204F850F7F7C1475A0880@DM5PR21MB0476.namprd21.prod.outlook.com> <CY4PR21MB06313B9D59F8846CDDE443F0F1880@CY4PR21MB0631.namprd21.prod.outlook.com> <20170810192742.GJ6524@worktop.programming.kicks-ass.net> <87lgmqqwzl.fsf@vitty.brq.redhat.com> <20170811105625.hmdfnp3yh72zut33@hirez.programming.kicks-ass.net> <b369bcb0-49e6-2f50-574e-4a66ced9e05d@suse.com> <20170811123534.quyckfyspl5fqdrg@hirez.programming.kicks-ass.net>
- User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1
On 11/08/17 14:35, Peter Zijlstra wrote:
> On Fri, Aug 11, 2017 at 02:22:25PM +0200, Juergen Gross wrote:
>> Wait - the TLB can be cleared at any time, as Andrew was pointing out.
>> No cpu can rely on an address being accessible just because IF is being
>> cleared. All that matters is the existing and valid page table entry.
>>
>> So clearing IF on a cpu isn't meant to secure the TLB from being
>> cleared, but just to avoid interrupts (as the name of the flag is
>> suggesting).
>
> Yes, but by holding off the TLB invalidate IPI, we hold off the freeing
> of the concurrently unhooked page-table.
>
>> In the Xen case the hypervisor does the following:
>>
>> - it checks whether any of the vcpus specified in the cpumask of the
>> flush request is running on any physical cpu
>> - if any running vcpu is found an IPI will be sent to the physical cpu
>> and the hypervisor will do the TLB flush there
>
> And this will preempt a vcpu which could have IF cleared, right?
>
>> - any vcpu addressed by the flush and not running will be flagged to
>> flush its TLB when being scheduled the next time
>>
>> This ensures no TLB entry to be flushed can be used after return of
>> xen_flush_tlb_others().
>
> But that is not a sufficient guarantee. We need the IF to hold off the
> TLB invalidate and thereby hold off the freeing of our page-table pages.
Aah, okay. Now I understand the problem. The TLB isn't the issue but the
IPI is serving two purposes here: TLB flushing (which is allowed to
happen at any time) and serialization regarding access to critical pages
(which seems to be broken in the Xen case as you suggest).
Juergen
>
--
To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
[Index of Archives]
[Linux Stable Commits]
[Linux Stable Kernel]
[Linux Kernel]
[Linux USB Devel]
[Linux Video &Media]
[Linux Audio Users]
[Yosemite News]
[Linux SCSI]