Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2115517imm; Mon, 16 Jul 2018 02:26:39 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfXcuTjfOwm/hUzgGfG85pwPAn/LNRA3XZ14HTGn3EwXDdp3AZUb+7WMp8Z4OYtPEpU/nbJ X-Received: by 2002:a62:a649:: with SMTP id t70-v6mr17333309pfe.149.1531733199919; Mon, 16 Jul 2018 02:26:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531733199; cv=none; d=google.com; s=arc-20160816; b=OQMkD5kn62bUrNoBAcaI4YspKHWNlE7cTDdc6/3C+WKKin2V+ut7AnZ6C6BxXhVlI8 l7a++VPfPS14usSihIr/IUWohSM64v8OtA3LJLyKncjMCq9kr8rlrwOukOslQ0D0kdKL AyumHdVVegTWOpzsgCkyfvsRin7slWZ0zbcnIf+ebng5wO+C3n+NxJuRpY4Qq+3+Mga+ sA7/YJxt42MQAK9n7YLt0cGd0hbXeEcueweVOCTfqxXKJM6Tuco2d+K5UlqxVjXf+AEa GAeBDPFfSowBWdEPpk1P4thWZBFejXDPIfDUuI/w2zrvmZxNHE4wiOGdpWAhXbt08zxq T2sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:arc-authentication-results; bh=1Co50YDFMlOj9iAaXWqVlcMTcecHTWbRMg7H7+BE1c0=; b=EIxTaBoZDeuZsnoLN81K6w5sOG7pJZ9m8sxNv3dLo/IC6NQJFNSCbPHQ0zu8rRtxC/ 8NTU2GwA5W/+JBElH1UbxqMtHCdKMQiMGVn88yhmmi+j9VSn041TGsgDAjX8015/zcZF YxMkPwaQs+kGJWe/4T+olcUu0azo69IYaRzOxC1WIWejTWMZy3PPUkxVoNp9+3qtRWN0 MWHTVVZNfAE0StOJSCz1URyhLlpYfI4ms7Q/vkaFCaxx2IIf0wKK0etlgS08oByE27qe 6s3T8mk6/ppS8bqBKhBjM7ABKqyMURJUmzu1fsyVLYppHgjvldXoj0RNnWEWyOt0NrJD ou/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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n1-v6si14851667pge.57.2018.07.16.02.26.25; Mon, 16 Jul 2018 02:26:39 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729965AbeGPJwO (ORCPT + 99 others); Mon, 16 Jul 2018 05:52:14 -0400 Received: from terminus.zytor.com ([198.137.202.136]:37493 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727848AbeGPJwO (ORCPT ); Mon, 16 Jul 2018 05:52:14 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id w6G9PXn51084044 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 16 Jul 2018 02:25:33 -0700 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w6G9PX861084041; Mon, 16 Jul 2018 02:25:33 -0700 Date: Mon, 16 Jul 2018 02:25:33 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Vitaly Kuznetsov Message-ID: Cc: mikelley@microsoft.com, tglx@linutronix.de, mingo@kernel.org, hpa@zytor.com, haiyangz@microsoft.com, sthemmin@microsoft.com, kys@microsoft.com, linux-kernel@vger.kernel.org, vkuznets@redhat.com, Michael.H.Kelley@microsoft.com Reply-To: vkuznets@redhat.com, Michael.H.Kelley@microsoft.com, kys@microsoft.com, sthemmin@microsoft.com, hpa@zytor.com, haiyangz@microsoft.com, linux-kernel@vger.kernel.org, mingo@kernel.org, tglx@linutronix.de, mikelley@microsoft.com In-Reply-To: <20180709174012.17429-3-vkuznets@redhat.com> References: <20180709174012.17429-3-vkuznets@redhat.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/hyperv] x86/hyper-v: Check for VP_INVAL in hyperv_flush_tlb_others() Git-Commit-ID: 110d2a7fc39725d2c29d2fede4f34a35a4f98882 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, T_DATE_IN_FUTURE_96_Q autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 110d2a7fc39725d2c29d2fede4f34a35a4f98882 Gitweb: https://git.kernel.org/tip/110d2a7fc39725d2c29d2fede4f34a35a4f98882 Author: Vitaly Kuznetsov AuthorDate: Mon, 9 Jul 2018 19:40:12 +0200 Committer: Thomas Gleixner CommitDate: Mon, 16 Jul 2018 11:19:49 +0200 x86/hyper-v: Check for VP_INVAL in hyperv_flush_tlb_others() Commit 1268ed0c474a ("x86/hyper-v: Fix the circular dependency in IPI enlightenment") pre-filled hv_vp_index with VP_INVAL so it is now (theoretically) possible to observe hv_cpu_number_to_vp_number() returning VP_INVAL. We need to check for that in hyperv_flush_tlb_others(). Not checking for VP_INVAL on the first call site where we do if (hv_cpu_number_to_vp_number(cpumask_last(cpus)) >= 64) goto do_ex_hypercall; is OK, in case we're eligible for non-ex hypercall we'll catch the issue later in for_each_cpu() cycle and in case we'll be doing ex- hypercall cpumask_to_vpset() will fail. It would be nice to change hv_cpu_number_to_vp_number() return value's type to 'u32' but this will likely be a bigger change as all call sites need to be checked first. Fixes: 1268ed0c474a ("x86/hyper-v: Fix the circular dependency in IPI enlightenment") Signed-off-by: Vitaly Kuznetsov Signed-off-by: Thomas Gleixner Reviewed-by: Michael Kelley Cc: "K. Y. Srinivasan" Cc: Haiyang Zhang Cc: Stephen Hemminger Cc: "Michael Kelley (EOSG)" Cc: devel@linuxdriverproject.org Cc: "H. Peter Anvin" Link: https://lkml.kernel.org/r/20180709174012.17429-3-vkuznets@redhat.com --- arch/x86/hyperv/mmu.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/x86/hyperv/mmu.c b/arch/x86/hyperv/mmu.c index 453d2355cd61..1147e1fed7ff 100644 --- a/arch/x86/hyperv/mmu.c +++ b/arch/x86/hyperv/mmu.c @@ -111,6 +111,11 @@ static void hyperv_flush_tlb_others(const struct cpumask *cpus, for_each_cpu(cpu, cpus) { vcpu = hv_cpu_number_to_vp_number(cpu); + if (vcpu == VP_INVAL) { + local_irq_restore(flags); + goto do_native; + } + if (vcpu >= 64) goto do_ex_hypercall;