Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1549156pxk; Tue, 1 Sep 2020 01:12:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxM/USwV7tYQl9epDs9uWCfzECMlD8Pq3Wh2D6DGUjacvoL9/ODV8nOcNsHrXUzZsdXx7do X-Received: by 2002:a05:6000:83:: with SMTP id m3mr520233wrx.165.1598947965154; Tue, 01 Sep 2020 01:12:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598947965; cv=none; d=google.com; s=arc-20160816; b=CApXsIcYFLGjBnV8NGQKCtSMwc9nz9tcn5P6HlAgmOuZ+f2YtcJIX+6khAdHWxIPC+ NEtWpeSAkRY0mI3D/xXt5dvUPKvIIqSZa+U6oGSKI16iJK2wH9AftHYztxJLyFPIIDXY 8Uvjrnz0K2a6Af2vxvBLA+48Skvaedqe7Bf/faUaNCE9+cqCWnYo8Jx6ztxcR6FN/Azo lBVcyOXbmZ+IkdI9smmadC6K4Yv2ghVtbsIMq+D+k2fUp8aXyTvtrXs/yKgezOQPobkH bT35TqojcaUGY4iyjugOyA4NTT9SMkf/kHBcpnmHXkYWZ2KTgX8P6MafWh6oSNgQMZgj IYCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=ywbzOyojoAfTL6CSiMEtbtQG/UWMpLz/fFs6teic35M=; b=Axo3lRR51gGGzSscinHf8jFfh/3kORdAAPzxAb6Na9kMNP7guwNUqzU+c1z3wyRFIb FaZPGiNoy9PWa/CHOQUgBikGBWNkwFY47OwkSAW6jNteepOmSlshI9UkEjKINcJoVg7/ S1Y1aLGJYiItq2en848mL+pQ89YyNZxIDnTSGRAggbyo3m1KVNLGjMkhjK+fOUE+gW2B q+X0S13jjkLHM+incS+bR3XM5GckXGsl5HoZdB+MINnI6c+08H4EUVv8u33j/kCxujUK dOwAZw4gmsiKP/uC0G9Mm3H3BoRiVjM/hXZYNtJ5JHI/2ADgKtxSnyT+VekqQYQwxeAR QhLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=asHEft0U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a25si253955eje.44.2020.09.01.01.12.22; Tue, 01 Sep 2020 01:12:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=asHEft0U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726269AbgIAILB (ORCPT + 99 others); Tue, 1 Sep 2020 04:11:01 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:52138 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726107AbgIAIK7 (ORCPT ); Tue, 1 Sep 2020 04:10:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1598947857; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ywbzOyojoAfTL6CSiMEtbtQG/UWMpLz/fFs6teic35M=; b=asHEft0UNqUe8bG9GJ2cPQatCMykMwuQ5YT7O3legygmB2qWYfqmwkhoxb4FUs723QLSjK JxPkOIVe5VAjNIfB7ChF8U0QJ845fF1wIUst27uACi9eNuztP2OAmaOPnAeoGy4upmLEBC qQz0Ltsbd4elQ42X6qtEOzM8A+W5ZF0= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-24-HSVVKrY1Mqucc9pI8HeXCw-1; Tue, 01 Sep 2020 04:10:54 -0400 X-MC-Unique: HSVVKrY1Mqucc9pI8HeXCw-1 Received: by mail-wr1-f72.google.com with SMTP id k11so251055wrw.16 for ; Tue, 01 Sep 2020 01:10:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=ywbzOyojoAfTL6CSiMEtbtQG/UWMpLz/fFs6teic35M=; b=meNZwwaB8XMONFjwAx/L/5eWfovT5+gzl4XNY8VvjOw3Yxds8XwTtZygUoXYAqx+6G EctuT/imi46azbWubeeXOBJYKwmLq36vShsMimHV/ERmpjttnfbvSqqa4VxdFC8L7Oi/ fcpbMvxttWsmnZVI0g5wR2w3WWeYyr/tBqLGgZn45PHHaN9Gh94AGDEdj4w8KgYKsHSB vGayjJGMYPdhavx+frEV1DWtUDVMGqmTyKCK06OuxiXlKt0pjh6icANDk3YQhyjdITLO vzdxxesba6zSufbqY7prbIyjhzRd5njiyY7hEuwmAOHH6m0lA2mur7T5PWF5A18u0agb QE1g== X-Gm-Message-State: AOAM532G3x8AWf9UDBRYS7pIIXg4FX7w9OfIckZougP/zT0SLabvqI7X IAygB5hqV0bawNRwCB3eqMWFzBUu12+DSw4UMHC8AeKEps7rqyHMB16wlx9hUS+2mULEztPNdpp U78lokMfseXdxWi9oTptriXFO X-Received: by 2002:a5d:420b:: with SMTP id n11mr526477wrq.11.1598947852915; Tue, 01 Sep 2020 01:10:52 -0700 (PDT) X-Received: by 2002:a5d:420b:: with SMTP id n11mr526450wrq.11.1598947852620; Tue, 01 Sep 2020 01:10:52 -0700 (PDT) Received: from vitty.brq.redhat.com (g-server-2.ign.cz. [91.219.240.2]) by smtp.gmail.com with ESMTPSA id n21sm705241wmi.21.2020.09.01.01.10.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Sep 2020 01:10:52 -0700 (PDT) From: Vitaly Kuznetsov To: Lai Jiangshan Cc: LKML , Sean Christopherson , Lai Jiangshan , Paolo Bonzini , Wanpeng Li , Jim Mattson , Joerg Roedel , Thomas Gleixner , Ingo Molnar , Borislav Petkov , X86 ML , "H. Peter Anvin" , kvm@vger.kernel.org Subject: Re: [PATCH] kvm x86/mmu: use KVM_REQ_MMU_SYNC to sync when needed In-Reply-To: References: <20200824101825.4106-1-jiangshanlai@gmail.com> <875z8zx8qs.fsf@vitty.brq.redhat.com> Date: Tue, 01 Sep 2020 10:10:50 +0200 Message-ID: <87y2ltx6gl.fsf@vitty.brq.redhat.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Lai Jiangshan writes: > On Mon, Aug 31, 2020 at 9:09 PM Vitaly Kuznetsov wrote: >> >> Lai Jiangshan writes: >> >> > Ping @Sean Christopherson >> > >> >> Let's try 'Beetlejuice' instead :-) >> >> > On Mon, Aug 24, 2020 at 5:18 PM Lai Jiangshan wrote: >> >> >> >> From: Lai Jiangshan >> >> >> >> 8c8560b83390("KVM: x86/mmu: Use KVM_REQ_TLB_FLUSH_CURRENT for MMU specific flushes) >> >> changed it without giving any reason in the changelog. >> >> >> >> In theory, the syncing is needed, and need to be fixed by reverting >> >> this part of change. >> >> Even if the original commit is not wordy enough this is hardly >> better. > > Hello, > Thank you for reviewing it. > > I'm sorry that when I said "reverting this part of change", > I meant "reverting this line of code". This line of code itself > is quite clear that it is not related to the original commit > according to its changelog. > >> Are you seeing a particular scenario when a change in current >> vCPU's MMU requires flushing TLB entries for *other* contexts, ... (see >> below) > > So I don't think the patch needs to explain this because the patch > does not change/revert anything about it. > > Anyway, using a "revert" in the changelog is misleading, when it > is not really reverting the whole targeted commit. I would > remove this wording. > > For the change in my patch, when kvm_mmu_get_page() gets a > page with unsync children, the host side pagetable is > unsynchronized with the guest side pagedtable, and the > guest might not issue a "flush" operation on it. It is > all about the host's emulation of the pagetable. So the host > has the responsibility to synchronize the pagetables. > Ah, I see now, so it seems Sean's commit has a stray change in it: the intention was to change KVM_REQ_TLB_FLUSH -> KVM_REQ_TLB_FLUSH_CURRENT so we don't unneedlesly flush other contexts but one of the hunks changed KVM_REQ_MMU_SYNC instead. Syncronizing MMU roots can't be replaced with a TLB flush, we need to revert back the change. This sounds reasonable to me, please send out v2 with the updated description. Thanks! -- Vitaly