Received: by 10.213.65.68 with SMTP id h4csp526422imn; Wed, 4 Apr 2018 02:43:12 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+ZDvfmtibO+Ak5ayzKfeDuPgU8UDHqaNA4TRfD7XAGRTdPrT1OROSNVEx/9CgPaZ7ZrR38 X-Received: by 2002:a17:902:8501:: with SMTP id bj1-v6mr18244522plb.239.1522834992165; Wed, 04 Apr 2018 02:43:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522834992; cv=none; d=google.com; s=arc-20160816; b=HAGNNGmep7ML2FKAlc8uTmEYJUSvdOAvKuVAmcGuQwz54ilJtXDg+gMCR6KfX4mhjv GTYt3fawPrGiUizfSeHKjLFdXtYT6XlWv81I+8rQgaSKHkvWwhTWeGs66hxbqi9CajJR CcrnGpM/ghVpOYdcCSiORaqvjlS0t6ImAc5CSsMkeXaxwpTPJYwFNSzTD74DUYMtTZfe rkvnskoeisDMhSKKr2bOoCBWRYFMg5LuOungpgEJHopufu1pPmiGOtacMYTPfrFdXIhi CuNSW3Y6JkGIpwBH19lnmyoXtDDOmEPHIUpgvRQAcYN0pAIF3TiD+qPh6DdInYkUuy5C vJgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:message-id:in-reply-to:date:references:subject:cc:to :from:arc-authentication-results; bh=+qPLCSiaMxRXJxASlNaacvENj5UqA+SQw+1FyEW6smA=; b=RUsyqAkFvEL8nnNoOa8MuXmQz33lOnbCL2sL0UkVhvH9OShqxiM8sSo3hgLsrZhXYu aRoC+w2+DEkwkOL2jj6z1MyRZZuLKuaih/BfAi+/ETMieKTRjOK3iq48Ng68RCTh45ep elc1rAlMeDdP8YbX+gHNKrCmUFXePVMSqMC5GIgu7SKBby/Sg2uxoWOlUoWKHuHlJAbV E8frBTpTLjnR01VX+V4HfAPpUpjq3Ldkyjo/BiWXVoQS1E2hmmxmnRs0iM2yZrd7yfGo H2lVothprFAR3T7LBkAGA8mS+5YSUPx204qq3rGkp+mab40AyqZdgNIVGKD3HHyfpOOP ue/A== 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 s5-v6si4925611plp.28.2018.04.04.02.42.57; Wed, 04 Apr 2018 02:43:12 -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 S1751212AbeDDJlv (ORCPT + 99 others); Wed, 4 Apr 2018 05:41:51 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:47764 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750812AbeDDJlu (ORCPT ); Wed, 4 Apr 2018 05:41:50 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 96AB6722E8; Wed, 4 Apr 2018 09:41:49 +0000 (UTC) Received: from vitty.brq.redhat.com.redhat.com (unknown [10.43.2.155]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DEBAF215CDAF; Wed, 4 Apr 2018 09:41:47 +0000 (UTC) From: Vitaly Kuznetsov To: Radim =?utf-8?B?S3LEjW3DocWZ?= Cc: kvm@vger.kernel.org, x86@kernel.org, Paolo Bonzini , Roman Kagan , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , "Michael Kelley \(EOSG\)" , Mohammed Gamal , Cathy Avery , linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/5] KVM: x86: hyperv: simplistic HVCALL_FLUSH_VIRTUAL_ADDRESS_{LIST,SPACE} implementation References: <20180402161059.8488-1-vkuznets@redhat.com> <20180402161059.8488-4-vkuznets@redhat.com> <20180403191508.GA7386@flask> <87d0zfcoed.fsf@vitty.brq.redhat.com> Date: Wed, 04 Apr 2018 11:41:46 +0200 In-Reply-To: <87d0zfcoed.fsf@vitty.brq.redhat.com> (Vitaly Kuznetsov's message of "Wed, 04 Apr 2018 11:27:22 +0200") Message-ID: <878ta3cnqd.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; charset=utf-8 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Wed, 04 Apr 2018 09:41:49 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Wed, 04 Apr 2018 09:41:49 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.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 Vitaly Kuznetsov writes: > Radim Krčmář writes: > >> 2018-04-02 18:10+0200, Vitaly Kuznetsov: >>> + if (vcpu != current_vcpu) >>> + kvm_vcpu_kick(vcpu); >> >> The spec says that >> >> "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." >> >> Other KVM code doesn't assume that kvm_vcpu_kick() and a delay provides >> that guarantee; kvm_make_all_cpus_request waits for the target CPU to >> exit before saying that TLB has been flushed. >> >> I am leaning towards the safer variant here as well. (Anyway, it's a >> good time to figure out if we really need it.) > > Ha, it depends on how we define "observable effects" :-) > > I think kvm_vcpu_kick() is enough as the corresponding vCPU can't > actually observe old mapping after being kicked (even if we didn't flush > yet we're not running). Or do you see any possible problem with such > definition? > Oh, now I see it myself -- native_smp_send_reschedule() only does apic->send_IPI() so this is indeed unsafe. We need something like kvm_make_all_cpus_request() with a mask (and, to make it fast, we'll probably have to pre-allocate these). Will do in v2, thanks! -- Vitaly