Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp909923ybp; Thu, 17 Oct 2019 05:27:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqz5UD/So4iVeGmiphCJaBTF7SvVyimXtShMyZYcY0ir81Cq2FvjFIHK03yyKCE3yIMo8O10 X-Received: by 2002:a50:fd16:: with SMTP id i22mr3429196eds.154.1571315267217; Thu, 17 Oct 2019 05:27:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571315267; cv=none; d=google.com; s=arc-20160816; b=mNBX6tndnp7rHJeSWJqeAkMuSFhlMXB98naT3jaim4i+R+8JGLhQ00VtJJTvXuvr3I 1CjSJj7hlGpev3e/A4yU94qfmom0ywHPNUd3PspF+YJ/BnZAbQJgsGqJHylIshhO7H4v vHG0bmP1uTx4PammT7Bu5xOou2bW0Ot1dTYTof4XWBQDcX/a/f3yUEyQYowoNMQw2qB/ 6XdphKLi87wKTYSr9BGurXjyKtjKVsrSddX6lHMhHXxTtnuacGSFzWujTfi4+25pwFVp aB1gg6dgFmw7Fw1oKq6jMY8HjrlgqwGo7FE6csZkiqI6JxbltlvlmozDwbERrWUr30PX EcEg== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=Jon2HmqSbAAKcKBF7gbyeqpMX1Li19J6aJYzT7uWXLo=; b=Y3HnwbpyrMgHj6bPZIAhPUWTiKdHLSVGMQAoPeIHgIkLHyL4e6NLZDy1jg8bakTu1W N1EOZPqT2jfSm6voruiKJq5cDE9qrtbk3UA3I4haa53QNJjJ0JdwcY9Wl/MdjlVwL6hz e0Op5uAtmaVZmj6DbRYeQ7C/4UgklIj/d2NqTFt0QwEqdySu/mTsfbG3aRW+AzDoW0Xm qUlXlv/PruzFAQMujB//GjC1KT3YLQJUAcuKMr/3+DWanbMVkrP3V3cOCCSl5jPQRD78 pPHufEwgCFH4khIOb+43EhEqG8mM7fnTY+O0IgGbfDrOztG75U9VIFr54bjjNNjX5wIc jnaA== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x45si1450307edd.388.2019.10.17.05.27.24; Thu, 17 Oct 2019 05:27:47 -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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406271AbfJPQZe (ORCPT + 99 others); Wed, 16 Oct 2019 12:25:34 -0400 Received: from mga17.intel.com ([192.55.52.151]:53038 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392349AbfJPQZe (ORCPT ); Wed, 16 Oct 2019 12:25:34 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Oct 2019 09:25:33 -0700 X-IronPort-AV: E=Sophos;i="5.67,304,1566889200"; d="scan'208";a="189729232" Received: from xiaoyaol-mobl.ccr.corp.intel.com (HELO [10.255.31.58]) ([10.255.31.58]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/AES256-SHA; 16 Oct 2019 09:25:29 -0700 Subject: Re: [PATCH v9 09/17] x86/split_lock: Handle #AC exception for split lock To: Paolo Bonzini , Thomas Gleixner Cc: Sean Christopherson , Fenghua Yu , Ingo Molnar , Borislav Petkov , H Peter Anvin , Peter Zijlstra , Andrew Morton , Dave Hansen , Radim Krcmar , Ashok Raj , Tony Luck , Dan Williams , Sai Praneeth Prakhya , Ravi V Shankar , linux-kernel , x86 , kvm@vger.kernel.org References: <1560897679-228028-1-git-send-email-fenghua.yu@intel.com> <1560897679-228028-10-git-send-email-fenghua.yu@intel.com> <20190626203637.GC245468@romley-ivt3.sc.intel.com> <20190925180931.GG31852@linux.intel.com> <3ec328dc-2763-9da5-28d6-e28970262c58@redhat.com> <57f40083-9063-5d41-f06d-fa1ae4c78ec6@redhat.com> <8808c9ac-0906-5eec-a31f-27cbec778f9c@intel.com> From: Xiaoyao Li Message-ID: Date: Thu, 17 Oct 2019 00:25:27 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/16/2019 11:37 PM, Paolo Bonzini wrote: > On 16/10/19 16:43, Thomas Gleixner wrote: >> >> N | #AC | #AC enabled | SMT | Ctrl | Guest | Action >> R | available | on host | | exposed | #AC | >> --|-----------|-------------|-----|---------|-------|--------------------- >> | | | | | | >> 0 | N | x | x | N | x | None >> | | | | | | >> 1 | Y | N | x | N | x | None > > So far so good. > >> 2 | Y | Y | x | Y | Y | Forward to guest >> >> 3 | Y | Y | N | Y | N | A) Store in vCPU and >> | | | | | | toggle on VMENTER/EXIT >> | | | | | | >> | | | | | | B) SIGBUS or KVM exit code > > (2) is problematic for the SMT=y case, because of what happens when #AC > is disabled on the host---safe guests can start to be susceptible to > DoS. > > For (3), which is the SMT=n case,, the behavior is the same independent of > guest #AC. > > So I would change these two lines to: > > 2 | Y | Y | Y | N | x | On first guest #AC, > | | | | | | disable globally on host. > | | | | | | > 3 | Y | Y | N | Y | x | Switch MSR_TEST_CTRL on > | | | | | | enter/exit, plus: > | | | | | | A) #AC forwarded to guest. > | | | | | | B) SIGBUS or KVM exit code > I just want to get confirmed that in (3), we should split into 2 case: a) if host has it enabled, still apply the constraint that guest is forcibly enabled? so we don't switch MSR_TEST_CTL. b) if host has it disabled, we can switch MSR_TEST_CTL on enter/exit.