Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5921CC4CECE for ; Mon, 16 Sep 2019 16:23:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3ACDB2184D for ; Mon, 16 Sep 2019 16:23:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729670AbfIPQXE (ORCPT ); Mon, 16 Sep 2019 12:23:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39968 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729110AbfIPQXD (ORCPT ); Mon, 16 Sep 2019 12:23:03 -0400 Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CD061C054907 for ; Mon, 16 Sep 2019 16:23:02 +0000 (UTC) Received: by mail-wr1-f71.google.com with SMTP id o16so117532wru.10 for ; Mon, 16 Sep 2019 09:23:02 -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:date:message-id:mime-version :content-transfer-encoding; bh=FDgjsWSDn6xBrhx6U+9m9Eu+qyYKBG2MdOtlO9XcnZA=; b=FLOspzaHvSOQa+gMkpzisxSWdG+ohzaru9T05QyF6QEjG3ui7fQR/ku9M1R0wkIDzO g0mIt7NpnfdpiKXHldS4AIwLzoOyUyXrjvPHvG34EhJeQoYzoj69SF455m2O3QGU763h nbIVZinIQvcjyGCheTrbg7blA1ZeREJYdz7ovyk93qs0+ilykpXXWWIqm1I1kAqBU/zY c6dSfRCQdr+bYdJuvHsAh/oSDFOzfxmArOvNRb3D1hilhKA5jUS2rAaYNqG4jTOYFrs+ wl+FlYQuynAMhv03C+FJUrZxGHrPpav7g+o8vy6gY1ag/RxEzx2bBMHUzb01Y6PqzskK 005g== X-Gm-Message-State: APjAAAWIaggFb0J0MVpjjcNtVOsb2x1thZzpUW2vlaZ+mchqjmT04VQX b2nlcDE+zo6ggpB9q6L/SJRM6n/BGdUM/589Q96ObElqLv481tmAiIGbMEBo162VAaEGEH4djOW BWKlsHMdNdFo5 X-Received: by 2002:a05:600c:295d:: with SMTP id n29mr42845wmd.36.1568650981046; Mon, 16 Sep 2019 09:23:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqxHalXeJGi+RCuzUK9rmpW00UqDDt5f6sreleDyRFkD/UPh7GhVb0E++elsWy8IafgPDqQgOA== X-Received: by 2002:a05:600c:295d:: with SMTP id n29mr42826wmd.36.1568650980794; Mon, 16 Sep 2019 09:23:00 -0700 (PDT) Received: from vitty.brq.redhat.com (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id q10sm78370575wrd.39.2019.09.16.09.22.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Sep 2019 09:22:59 -0700 (PDT) From: Vitaly Kuznetsov To: kvm@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, x86@kernel.org, Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= , Sean Christopherson , Jim Mattson , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , "Peter Zijlstra (Intel)" , Michael Kelley , Roman Kagan Subject: [PATCH 0/3] KVM: x86: hyper-v: make L2 Hyper-V 2019 on KVM guests see MD_CLEAR Date: Mon, 16 Sep 2019 18:22:55 +0200 Message-Id: <20190916162258.6528-1-vkuznets@redhat.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org [The series is KVM specific but the first patch of the series likely requires someone else's ACK. hyperv-tlfs.h gets a small addition too.] It was discovered that L2 guests on Hyper-V 2019 on KVM don't see MD_CLEAR bit (and thus think they're MDS vulnerable) even when it is present on the host. Turns out, Hyper-V is filtering it out because it is not sure the topology L0 is exposing is trustworthy and generally it is not. In some specific cases (e.g. when SMT is unsupported or forcesully disabled) it is and we can tell this to userspace hoping that it'll pass this info to L1. See PATCH2 of the series for additional details. The series can be tested with QEMU-4.1+ and 'hv-passthrough' CPU flag. Vitaly Kuznetsov (3): cpu/SMT: create and export cpu_smt_possible() KVM: x86: hyper-v: set NoNonArchitecturalCoreSharing CPUID bit when SMT is impossible KVM: selftests: hyperv_cpuid: add check for NoNonArchitecturalCoreSharing bit arch/x86/include/asm/hyperv-tlfs.h | 7 +++++ arch/x86/kvm/hyperv.c | 4 ++- include/linux/cpu.h | 2 ++ kernel/cpu.c | 11 ++++++-- .../selftests/kvm/x86_64/hyperv_cpuid.c | 27 +++++++++++++++++++ 5 files changed, 48 insertions(+), 3 deletions(-) -- 2.20.1