Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1104899ybv; Fri, 7 Feb 2020 14:37:21 -0800 (PST) X-Google-Smtp-Source: APXvYqxzqOZFRKP5jnOwcbt5uGoTHNH3DrJwSakoGr2d7tqYLoTR8b/Zi33cwy+XOZUUtiQYWT24 X-Received: by 2002:aca:ab0f:: with SMTP id u15mr3686063oie.26.1581115041289; Fri, 07 Feb 2020 14:37:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581115041; cv=none; d=google.com; s=arc-20160816; b=WNRjjuxL4ggVaOghtfVoK6I4L+xZCuXRjMgQj6uZ1mCmk7PUHuiMbg4RYSVskkfA0D fZlo8m890h3qA6D1/zVex+SxppptG4MOm/bQBDNr+ea+mAAWlcoYLzzdPa6467rGy5TS qZt+NZWONMw4aff1xUsd+e6WsIf5958aMC+ANOhmVMuSb03QepK/YVqR/iyZl41KtBaF h0s/9HZhdhQraVW2QgaX/tfekn5+XdKTQsyLNByn2wBHFAkXxr5AgW9ImLsPPhWQcmUW i/pTaxXdrFYn+8v5ZKSRa+W5qpyDsXHAjTGo8PMmSgWh8TTob4GwZ5z34sAn5DqrkYuQ vKPA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=8BwOjosBD3aan9vZqA1/XtTiViONk3Y9UUF8NI7mgRo=; b=tXAA6fiPruWDVlNWEaiXFR/5zQxf5FVFULy+40sMjnMUKdBQPrVAzggHuvJlaNcHyv xtAZjwFGB2WvbnJv9mDsZWdFS5waNq3y2j1U7OOWdJL7L5ZV5jgp08mrr3XeWCfAGTOi Opo2OhXZXaF3t7iQV0S/LoyGrYGe8XlXqBFbXI9Z0bJap/nUByhN+fCFUNfZYiRGvHgP d1vfZ3z3xcrPTeNmBzLsFz7AJFy7xioE3cbWF4NG7wr/4awLD1rnQ/MG33/e9mM2avl0 ZcCU6CEfq8Nogn2XGpr3JZov3tBiKduBMz249ATnB6OuxHCLXRdgKoJ+Lv9/OGnpwGWz mVuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CNzMrAp2; 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=pass (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 s21si392835otr.304.2020.02.07.14.37.09; Fri, 07 Feb 2020 14:37:21 -0800 (PST) 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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CNzMrAp2; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727453AbgBGWfa (ORCPT + 99 others); Fri, 7 Feb 2020 17:35:30 -0500 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:27191 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727068AbgBGWf2 (ORCPT ); Fri, 7 Feb 2020 17:35:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581114927; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8BwOjosBD3aan9vZqA1/XtTiViONk3Y9UUF8NI7mgRo=; b=CNzMrAp2t/XbYnhlGTPEcX3kqBU20BSZ7NvTW7ANuCfz5/NU7xnQyyammZfzuiOCw6W4zG pfMhX6vkk0PYqzGU0nPU6tp3OgtUk04KFl9PoXLdAAnjPwnf0iAkkFwgQaWaSu4pAa3+77 mWY0fL5vQ4UdtBIevg8QxjOoTCZNmQ4= Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-408-E8XtL9cOMPaR6BfvHgdSvQ-1; Fri, 07 Feb 2020 17:35:26 -0500 X-MC-Unique: E8XtL9cOMPaR6BfvHgdSvQ-1 Received: by mail-qk1-f198.google.com with SMTP id d134so500985qkc.0 for ; Fri, 07 Feb 2020 14:35:26 -0800 (PST) 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:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8BwOjosBD3aan9vZqA1/XtTiViONk3Y9UUF8NI7mgRo=; b=YB3m1PHnTBIEMfnkXEkQmjU9PYZv9GT8sLctitylBwB2dccdlwq+fJpRHdT8R6XLLl /ZdrErAGQnAtXAudAdoxt2Z1gJplM9ahZl41tS/ihHGpn5zDQ45ztIWh/W1okRfiQzjz lu31Io506+F5PyXB2JbOYMz0iZHXzXX/a4NzKd8mLm/8K5ghNSuJfzZAnA+qweP1YvNW wisJZGoBkD0Vp5v2sw2hwvGwhWVrUbstLeJ/Rnd73lMIOV5jTvLkOPpQyy/mMLbHukvo 4qQx8J0yyLEEtFqaqWmlHwvLBPDQVfkDedWnFWcE4M5Uiw728gAeCpOQ+zH9BCNmMTd+ IoJw== X-Gm-Message-State: APjAAAXXyhtzBVzdMGDCLFDqQT3x8COMpIBjOW/OjAqfW19KK7lGyr4Q fYMMub4c3ny73Isqt7VU6Tm8d6gFI8OhNiGtHu2XVhYQvfRlDPH0hqNf4ZQHHAJebhzr3sgzFVU wzdbKAlUZRznKBdS0Iqy+4B87 X-Received: by 2002:aed:3e13:: with SMTP id l19mr560579qtf.103.1581114925267; Fri, 07 Feb 2020 14:35:25 -0800 (PST) X-Received: by 2002:aed:3e13:: with SMTP id l19mr560554qtf.103.1581114925041; Fri, 07 Feb 2020 14:35:25 -0800 (PST) Received: from xz-x1.redhat.com ([2607:9880:19c8:32::2]) by smtp.gmail.com with ESMTPSA id u12sm2178736qtj.84.2020.02.07.14.35.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Feb 2020 14:35:24 -0800 (PST) From: Peter Xu To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: Sean Christopherson , Paolo Bonzini , linux-mips@vger.kernel.org, peterx@redhat.com, Vitaly Kuznetsov Subject: [PATCH RFC 1/4] KVM: Provide kvm_flush_remote_tlbs_common() Date: Fri, 7 Feb 2020 17:35:17 -0500 Message-Id: <20200207223520.735523-2-peterx@redhat.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200207223520.735523-1-peterx@redhat.com> References: <20200207223520.735523-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It's exactly kvm_flush_remote_tlbs() now but a internal wrapper of the common code path. With this, an arch can then optionally select CONFIG_HAVE_KVM_ARCH_TLB_FLUSH_ALL=y and will be able to use the common flushing code. Signed-off-by: Peter Xu --- include/linux/kvm_host.h | 1 + virt/kvm/kvm_main.c | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 6d5331b0d937..915df64125f9 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -798,6 +798,7 @@ int kvm_vcpu_yield_to(struct kvm_vcpu *target); void kvm_vcpu_on_spin(struct kvm_vcpu *vcpu, bool usermode_vcpu_not_eligible); void kvm_flush_remote_tlbs(struct kvm *kvm); +void kvm_flush_remote_tlbs_common(struct kvm *kvm); void kvm_reload_remote_mmus(struct kvm *kvm); bool kvm_make_vcpus_request_mask(struct kvm *kvm, unsigned int req, diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index eb3709d55139..9c7b39b7bb21 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -302,8 +302,7 @@ bool kvm_make_all_cpus_request(struct kvm *kvm, unsigned int req) return called; } -#ifndef CONFIG_HAVE_KVM_ARCH_TLB_FLUSH_ALL -void kvm_flush_remote_tlbs(struct kvm *kvm) +void kvm_flush_remote_tlbs_common(struct kvm *kvm) { /* * Read tlbs_dirty before setting KVM_REQ_TLB_FLUSH in @@ -327,6 +326,13 @@ void kvm_flush_remote_tlbs(struct kvm *kvm) ++kvm->stat.remote_tlb_flush; cmpxchg(&kvm->tlbs_dirty, dirty_count, 0); } +EXPORT_SYMBOL_GPL(kvm_flush_remote_tlbs_common); + +#ifndef CONFIG_HAVE_KVM_ARCH_TLB_FLUSH_ALL +void kvm_flush_remote_tlbs(struct kvm *kvm) +{ + kvm_flush_remote_tlbs_common(kvm); +} EXPORT_SYMBOL_GPL(kvm_flush_remote_tlbs); #endif -- 2.24.1