Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp7498871ybp; Wed, 16 Oct 2019 09:31:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqwBKWgieifi/X+4RUma8KhEZHBM+ud2eA2yaN/MozLjjul6MHa+YbTVxBHDB1cU60IA+Pll X-Received: by 2002:a17:907:119c:: with SMTP id uz28mr41131580ejb.115.1571243506317; Wed, 16 Oct 2019 09:31:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571243506; cv=none; d=google.com; s=arc-20160816; b=i5E/DDR7YmgcHJ8nwaa0Jmew3Wewugq5VXG808ebjRZgEonHNAiNqnBmEFlm7zk2tf zcE6/J3iAHO6wUbqOplDptAo8+IvZd0tG86mcMMCHHZMJAPpnAt9LJTPvfTeUZYLHJrY rF0ly0tLere5YnbL5mCWtAJH4N0cu6Uy1Qcg0d5gACTBvR/ekZ8hYwhWx/Pp/93uvNe7 PEkRizR4/jQCm05bF81ctbWlHWsEmlbqDsXuk2GfIPobmgTKhXoPCVxCsuZoSaxDrT16 vXQnAR7wkTNaA1p1DUeUjWzHHRlLq6WQME+9BE1mRb9biUTyeVosYdsXjvJmivfex8ze FwyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=7RFiifdMsdogpPjdR9aPD+2eQvqoFRvRJ6rrF4QYACc=; b=TaVOFb01rZdbldGfQ3fnJVJf/+KRdJ8/lITy5T80GSAD8pGpC6LLL3ceN2MNgj/TZU P8JAPxSaxxWVv4er1vNTiPIn3QNNL/ZQXKRBhZT9NZz1DEXOlvEWkYpFQ54VS0f668Wt lQJ5TuL12UXt3ekWe7l47d3VlzzpAfLkN+b27CjY1p6SfMHoVmKHgk0/QISK+Gj3KgWA WqkZcp/MnYQyz3ldOcqYShS+lrrXsmRy+C6z7AnIHVLVnrNwK+sdebdR/5kUGZBB6JaX F893Vo4Z+Nhj5hnsPnOS00IIot2ikLS5uQn5QOfzdJtyNelFWfr1MOHncBvXg27OAOfF C1AA== 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 w24si17164298ejk.57.2019.10.16.09.31.23; Wed, 16 Oct 2019 09:31:46 -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 S2393260AbfJPOus (ORCPT + 99 others); Wed, 16 Oct 2019 10:50:48 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:50475 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388751AbfJPOus (ORCPT ); Wed, 16 Oct 2019 10:50:48 -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 1iKkdJ-00073D-B5; Wed, 16 Oct 2019 16:50:37 +0200 Date: Wed, 16 Oct 2019 16:50:36 +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: 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> <3a12810b-1196-b70a-aa2e-9fe17dc7341a@redhat.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:58 PM, Paolo Bonzini wrote: > > > With your proposal you render #AC useless even on hosts which have SMT > > > disabled, which is just wrong. There are enough good reasons to disable > > > SMT. > > > > My lazy "solution" only applies to SMT enabled. When SMT is either not > > supported, or disabled as in "nosmt=force", we can virtualize it like > > the posted patches have done so far. > > > > Do we really need to divide it into two cases of SMT enabled and SMT disabled? Yes. See the matrix I just sent. > > > I agree that with SMT enabled the situation is truly bad, but we surely > > > can > > > be smarter than just disabling it globally unconditionally and forever. > > > > > > Plus we want a knob which treats guests triggering #AC in the same way as > > > we treat user space, i.e. kill them with SIGBUS. > > > > Yes, that's a valid alternative. But if SMT is possible, I think the > > only sane possibilities are global disable and SIGBUS. SIGBUS (or > > better, a new KVM_RUN exit code) can be acceptable for debugging guests too. > > If SIGBUS, why need to globally disable? See the matrix I just sent. > When there is an #AC due to split-lock in guest, KVM only has below two > choices: > 1) inject back into guest. > - If kvm advertise this feature to guest, and guest kernel is latest, and > guest kernel must enable it too. It's the happy case that guest can handler it > on its own purpose. > - Any other cases, guest get an unexpected #AC and crash. That's just wrong for obvious reasons. > 2) report to userspace (I think the same like a SIGBUS) No. What guarantees that userspace qemu handles the SIGBUS sanely? > So for simplicity, we can do what Paolo suggested that don't advertise this > feature and report #AC to userspace when an #AC due to split-lock in guest > *but* we never disable the host's split-lock detection due to guest's > split-lock. No, you can't. Guess what happens when you just boot some existing guest on a #AC enabled host without having updated qemu to handle the exit code/SIGBUS. It simply will crash and burn in nonsensical ways. Same as reinjecting it into the guest and letting it crash. Thanks, tglx