Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1709461

Re: [Xen-devel] [tip:x86/platform] x86/hyper-v: Use hypercall for remote TLB flush

From Andrew Cooper <andrew.cooper3@citrix.com>
Newsgroups linux.kernel
Subject Re: [Xen-devel] [tip:x86/platform] x86/hyper-v: Use hypercall for remote TLB flush
Date 2017-08-11 13:10 +0200
Message-ID <udfZf-2MM-7@gated-at.bofh.it> (permalink)
References (3 earlier) <ud1jA-1EN-23@gated-at.bofh.it> <ud1jA-1EN-25@gated-at.bofh.it> <ud1jA-1EN-21@gated-at.bofh.it> <udeqt-1IZ-11@gated-at.bofh.it> <udfPA-2tJ-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 11/08/17 11:56, Peter Zijlstra wrote:
> On Fri, Aug 11, 2017 at 11:23:10AM +0200, Vitaly Kuznetsov wrote:
>> Peter Zijlstra <peterz@infradead.org> writes:
>>
>>> On Thu, Aug 10, 2017 at 07:08:22PM +0000, Jork Loeser wrote:
>>>
>>>>>> Subject: Re: [tip:x86/platform] x86/hyper-v: Use hypercall for remote TLB flush
>>>>>> Hold on.. if we don't IPI for TLB invalidation. What serializes our
>>>>>> software page table walkers like fast_gup() ?
>>>>> Hypervisor may implement this functionality via an IPI.
>>>>>
>>>>> K. Y
>>>> HvFlushVirtualAddressList() states:
>>>> This call guarantees that by the time control returns back to the
>>>> caller, the observable effects of all flushes on the specified virtual
>>>> processors have occurred.
>>>>
>>>> HvFlushVirtualAddressListEx() refers to HvFlushVirtualAddressList() as adding sparse target VP lists.
>>>>
>>>> Is this enough of a guarantee, or do you see other races?
>>> That's nowhere near enough. We need the remote CPU to have completed any
>>> guest IF section that was in progress at the time of the call.
>>>
>>> So if a host IPI can interrupt a guest while the guest has IF cleared,
>>> and we then process the host IPI -- clear the TLBs -- before resuming the
>>> guest, which still has IF cleared, we've got a problem.
>>>
>>> Because at that point, our software page-table walker, that relies on IF
>>> being clear to guarantee the page-tables exist, because it holds off the
>>> TLB invalidate and thereby the freeing of the pages, gets its pages
>>> ripped out from under it.
>> Oh, I see your concern. Hyper-V, however, is not the first x86
>> hypervisor trying to avoid IPIs on remote TLB flush, Xen does this
>> too. Briefly looking at xen_flush_tlb_others() I don't see anything
>> special, do we know how serialization is achieved there?
> No idea on how Xen works, I always just hope it goes away :-) But lets
> ask some Xen folks.

How is the software pagewalker relying on IF being clear safe at all (on
native, let alone under virtualisation)?  Hardware has no architectural
requirement to keep entries in the TLB.

In the virtualisation case, at any point the vcpu can be scheduled on a
different pcpu even during a critical region like that, so the TLB
really can empty itself under your feet.

~Andrew

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v10 0/9] Hyper-V: paravirtualized remote TLB flushing and hypercall improvements Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-08-02 18:10 +0200
  [PATCH v10 1/9] x86/hyper-v: include hyperv/ only when CONFIG_HYPERV is set Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-08-02 18:10 +0200
    [tip:x86/platform] x86/hyper-v: Include hyperv/ only when  CONFIG_HYPERV is set tip-bot for Vitaly Kuznetsov <tipbot@zytor.com> - 2017-08-10 18:50 +0200
  [PATCH v10 3/9] x86/hyper-v: fast hypercall implementation Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-08-02 18:10 +0200
    [tip:x86/platform] x86/hyper-v: Introduce fast hypercall  implementation tip-bot for Vitaly Kuznetsov <tipbot@zytor.com> - 2017-08-10 18:50 +0200
  [PATCH v10 7/9] x86/hyper-v: use hypercall for remote TLB flush Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-08-02 18:20 +0200
    [tip:x86/platform] x86/hyper-v: Use hypercall for remote TLB flush tip-bot for Vitaly Kuznetsov <tipbot@zytor.com> - 2017-08-10 18:50 +0200
    [tip:x86/platform] x86/hyper-v: Use hypercall for remote TLB flush tip-bot for Vitaly Kuznetsov <tipbot@zytor.com> - 2017-08-10 20:30 +0200
      Re: [tip:x86/platform] x86/hyper-v: Use hypercall for remote TLB  flush Peter Zijlstra <peterz@infradead.org> - 2017-08-10 21:00 +0200
        Re: [tip:x86/platform] x86/hyper-v: Use hypercall for remote TLB  flush Peter Zijlstra <peterz@infradead.org> - 2017-08-10 21:30 +0200
          Re: [tip:x86/platform] x86/hyper-v: Use hypercall for remote TLB  flush Peter Zijlstra <peterz@infradead.org> - 2017-08-11 11:10 +0200
            Re: [tip:x86/platform] x86/hyper-v: Use hypercall for remote TLB  flush "Kirill A. Shutemov" <kirill@shutemov.name> - 2017-08-11 13:30 +0200
            Re: [tip:x86/platform] x86/hyper-v: Use hypercall for remote TLB flush Linus Torvalds <torvalds@linux-foundation.org> - 2017-08-11 18:20 +0200
              Re: [tip:x86/platform] x86/hyper-v: Use hypercall for remote TLB  flush Peter Zijlstra <peterz@infradead.org> - 2017-08-11 18:30 +0200
          Re: [tip:x86/platform] x86/hyper-v: Use hypercall for remote TLB flush Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-08-11 11:30 +0200
            Re: [tip:x86/platform] x86/hyper-v: Use hypercall for remote TLB  flush Peter Zijlstra <peterz@infradead.org> - 2017-08-11 13:00 +0200
              Re: [Xen-devel] [tip:x86/platform] x86/hyper-v: Use hypercall for  remote TLB flush Andrew Cooper <andrew.cooper3@citrix.com> - 2017-08-11 13:10 +0200
                Re: [Xen-devel] [tip:x86/platform] x86/hyper-v: Use hypercall for  remote TLB flush Peter Zijlstra <peterz@infradead.org> - 2017-08-11 14:10 +0200
              Re: [tip:x86/platform] x86/hyper-v: Use hypercall for remote TLB  flush Juergen Gross <jgross@suse.com> - 2017-08-11 14:30 +0200
                Re: [tip:x86/platform] x86/hyper-v: Use hypercall for remote TLB  flush Peter Zijlstra <peterz@infradead.org> - 2017-08-11 14:40 +0200
                Re: [tip:x86/platform] x86/hyper-v: Use hypercall for remote TLB  flush Juergen Gross <jgross@suse.com> - 2017-08-11 14:50 +0200
                Re: [tip:x86/platform] x86/hyper-v: Use hypercall for remote TLB  flush Peter Zijlstra <peterz@infradead.org> - 2017-08-11 15:00 +0200
                Re: [tip:x86/platform] x86/hyper-v: Use hypercall for remote TLB  flush Juergen Gross <jgross@suse.com> - 2017-08-11 15:10 +0200
                Re: [tip:x86/platform] x86/hyper-v: Use hypercall for remote TLB  flush Peter Zijlstra <peterz@infradead.org> - 2017-08-11 15:50 +0200
  [PATCH v10 4/9] hyper-v: use fast hypercall for HVCALL_SIGNAL_EVENT Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-08-02 18:20 +0200
    [tip:x86/platform] hyper-v: Use fast hypercall for  HVCALL_SIGNAL_EVENT tip-bot for Vitaly Kuznetsov <tipbot@zytor.com> - 2017-08-10 18:50 +0200
  [PATCH v10 5/9] x86/hyper-v: implement rep hypercalls Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-08-02 18:20 +0200
    [tip:x86/platform] x86/hyper-v: Implement rep hypercalls tip-bot for Vitaly Kuznetsov <tipbot@zytor.com> - 2017-08-10 18:50 +0200
  [PATCH v10 8/9] x86/hyper-v: support extended CPU ranges for TLB flush hypercalls Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-08-02 18:20 +0200
  [PATCH v10 9/9] tracing/hyper-v: trace hyperv_mmu_flush_tlb_others() Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-08-02 18:20 +0200
  [PATCH v10 6/9] hyper-v: globalize vp_index Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-08-02 18:20 +0200
    [tip:x86/platform] hyper-v: Globalize vp_index tip-bot for Vitaly Kuznetsov <tipbot@zytor.com> - 2017-08-10 18:50 +0200
  Re: [PATCH v10 0/9] Hyper-V: paravirtualized remote TLB flushing and hypercall improvements Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-08-10 14:00 +0200
    Re: [PATCH v10 0/9] Hyper-V: paravirtualized remote TLB flushing and  hypercall improvements Ingo Molnar <mingo@kernel.org> - 2017-08-10 17:20 +0200
      Re: [PATCH v10 0/9] Hyper-V: paravirtualized remote TLB flushing and hypercall improvements Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-08-10 17:20 +0200
  Re: [PATCH v10 0/9] Hyper-V: paravirtualized remote TLB flushing and hypercall improvements Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-08-10 19:10 +0200

csiph-web