Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2694883imm; Fri, 20 Jul 2018 03:19:29 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd5bxYSGD1RZy1jKuXLanQ4ieERuDPbKJWyQmokvFrORj5A88fsizO7Z7hKBFIGrWeh7883 X-Received: by 2002:a17:902:82c7:: with SMTP id u7-v6mr1503170plz.83.1532081969378; Fri, 20 Jul 2018 03:19:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532081969; cv=none; d=google.com; s=arc-20160816; b=ASFIG1vufbQCmh/sjttAp2ItS51YMZxNSYxZ+Ra0+53qovJXB1OZlSpl6N6FbYopPA OGNPshIDq+1LMfnSeI/SO4sJDbmRMiikJPJpA+CAp9fnYtgbzl7D1s0mvDfovPowLWa5 dE/PLOw3uUxt/XMxsPbdxL7/uFSW0V6ea+74O0IAYUuG0NbcotOPYuIcCDexYmpVrPFI egfQgm85fI6dp3kP+6CQ0IWdq2ib2QWN847xk53cMYm6QZC+tPJhdfNO5UX3JUU95ZkP uL6nG4qIXIutaW5nzStYHOt8UhNWtNa7lE3jKVCwlLbwv+nR0Y/0bjs23EcfWG3jiYZ9 qPKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from :arc-authentication-results; bh=i0r0BY9Q88/4nguUIHOHJ4YiPhvLUpnhzG4v3PjG0hQ=; b=0Wy0lcdWcQwqYk6wsUOwdkvAsjD04c7/6/AKtAcHg7pGnVOB166xtuT5qI4DzB6N67 fm2C+0c8Yfr1h2GRebjrWDurA36nwGp5KSYnCEp6SP1MLTIlNQcFH0TuusdOFh0HN7t8 9ewQLvioVoAEKAOyFTgUM4eg0AVCaCPhJJbldkd6Xx6c7j378NQ1G1lOrveNoJ3WCGxV AnClv5YrChKVgv4HtMZGfD4jYnkciRLyMnj8QOf9XC3t0WQBOa7/chqFwct9lTkSnPiH xcCMdtFe6SxDYgetfJISXlNqsFRJnsmolCEdooThj6LQc1xCejwzxnPcGKaZ5jthR9pY OrKg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n4-v6si1388881plp.128.2018.07.20.03.19.14; Fri, 20 Jul 2018 03:19:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728242AbeGTLGG (ORCPT + 99 others); Fri, 20 Jul 2018 07:06:06 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:36926 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727179AbeGTLGG (ORCPT ); Fri, 20 Jul 2018 07:06:06 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A93A081A4EB7; Fri, 20 Jul 2018 10:18:32 +0000 (UTC) Received: from vitty.brq.redhat.com.redhat.com (ovpn-204-189.brq.redhat.com [10.40.204.189]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 723CA1C5B4; Fri, 20 Jul 2018 10:18:29 +0000 (UTC) From: Vitaly Kuznetsov To: Peter Zijlstra Cc: Andy Lutomirski , Rik van Riel , Andy Lutomirski , LKML , X86 ML , Mike Galbraith , kernel-team , Ingo Molnar , Dave Hansen Subject: Re: [PATCH 4/7] x86,tlb: make lazy TLB mode lazier References: <20180716190337.26133-1-riel@surriel.com> <20180716190337.26133-5-riel@surriel.com> <87muumtjwd.fsf@vitty.brq.redhat.com> <20180720094906.GP2494@hirez.programming.kicks-ass.net> Date: Fri, 20 Jul 2018 12:18:28 +0200 In-Reply-To: <20180720094906.GP2494@hirez.programming.kicks-ass.net> (Peter Zijlstra's message of "Fri, 20 Jul 2018 11:49:06 +0200") Message-ID: <87fu0etdl7.fsf@vitty.brq.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Fri, 20 Jul 2018 10:18:32 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Fri, 20 Jul 2018 10:18:32 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'vkuznets@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Peter Zijlstra writes: > On Fri, Jul 20, 2018 at 10:02:10AM +0200, Vitaly Kuznetsov wrote: >> Andy Lutomirski writes: >> >> > [I added PeterZ and Vitaly -- can you see any way in which this would >> > break something obscure? I don't.] >> >> Thanks for CCing me, >> >> I don't see how this can break things either. At first glance, however, >> I'm afraid we can add performance penalty to virtualized guests which >> don't use native_flush_tlb_others() (Hyper-V, KVM): we will be reloading >> CR3 without a need as we don't look at lazy mode in PV tlb flush >> functions. >> >> We can either check to switch_mm_irqs_off() that >> native_flush_tlb_others() is in use or teach PV tlb flush functions to >> look at lazy mode too. > > As Rik noted elsewhere in the thread, kvm_flush_tlb_others() ends up > calling native_tlb_flush_others() for all running vcpu threads. Ah, right! > > The Hyper-V thing is magical, we can't really do anything about it > there. Let them worry about it. Well, we kinda know how this magic works: we just ask the hypervisor to flush TLB for us (if the particular vCPU is running) :-) Anyway, nothing stops us from duplicating the logic regarding lazy mode from native_flush_tlb_others() to hyperv_flush_tlb_others(): if TLB state is lazy omit TLB flush. -- Vitaly