From mboxrd@z Thu Jan 1 00:00:00 1970 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=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 545F3FA372A for ; Wed, 16 Oct 2019 14:43:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 341D0218DE for ; Wed, 16 Oct 2019 14:43:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404778AbfJPOnr (ORCPT ); Wed, 16 Oct 2019 10:43:47 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:50458 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727291AbfJPOnq (ORCPT ); Wed, 16 Oct 2019 10:43:46 -0400 Received: from [5.158.153.52] (helo=nanos.tec.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1iKkWM-0006wq-TK; Wed, 16 Oct 2019 16:43:26 +0200 Date: Wed, 16 Oct 2019 16:43:26 +0200 (CEST) From: Thomas Gleixner To: Xiaoyao Li cc: Paolo Bonzini , 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 Subject: Re: [PATCH v9 09/17] x86/split_lock: Handle #AC exception for split lock In-Reply-To: <8808c9ac-0906-5eec-a31f-27cbec778f9c@intel.com> Message-ID: 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> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 16 Oct 2019, Xiaoyao Li wrote: > On 10/16/2019 7:26 PM, Paolo Bonzini wrote: > > Old guests are prevalent enough that enabling split-lock detection by > > default would be a big usability issue. And even ignoring that, you > > would get the issue you describe below: > > Right, whether enabling split-lock detection is made by the administrator. The > administrator is supposed to know the consequence of enabling it. Enabling it > means don't want any split-lock happens in userspace, of course VMM softwares > are under control. I have no idea what you are talking about, but the whole thing is trivial enough to describe in a decision matrix: 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 | | | | | | 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 | | | | | | 4 | Y | Y | Y | Y | N | A) Disable globally on | | | | | | host. Store in vCPU/guest | | | | | | state and evtl. reenable | | | | | | when guest goes away. | | | | | | | | | | | | B) SIGBUS or KVM exit code [234] need proper accounting and tracepoints in KVM [34] need a policy decision in KVM Now there are a two possible state transitions: #AC enabled on host during runtime Existing guests are not notified. Nothing changes. #AC disabled on host during runtime That only affects state #2 from the above table and there are two possible solutions: 1) Do nothing. 2) Issue a notification to the guest. This would be doable at least for Linux guests because any guest kernel which handles #AC is at least the same generation as the host which added #AC. Whether it's worth it, I don't know, but it makes sense at least for consistency reasons. For a first step I'd go for 'Do nothing' SMT state transitions could be handled in a similar way, but I don't think it's worth the trouble. The above should cover everything at least on a best effort basis. Thanks, tglx