Received: by 2002:ab2:6c55:0:b0:1fd:c486:4f03 with SMTP id v21csp149768lqp; Tue, 11 Jun 2024 18:42:24 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXQ0+rXbROq+rRE5RXHHQH1Jx6LO/LCT+h9/ifMpSPAyUS9ER/XUeiYYht0AL3lLJVqfrV3w0aXO/LiomJahWv9yMMaEsBtesFmfrK6mw== X-Google-Smtp-Source: AGHT+IHxtdhiyVzPcMwJ7qmy/BkfQ6HQlGGXO31rxFikQ3/vJ4PPuWVpSsUwWFuqkXJLCfT+46uZ X-Received: by 2002:a05:6808:f8a:b0:3d2:2b8e:a7e2 with SMTP id 5614622812f47-3d23e114116mr622030b6e.48.1718156544115; Tue, 11 Jun 2024 18:42:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718156544; cv=pass; d=google.com; s=arc-20160816; b=kX6mmVPLT1u5NUVJ+BG6MNw5S1/1dU4/UWv+AW1+na0E/DpKHQh6pFmsLZS1GpBnj7 ZA6+p8zXWHtRJtXwBOF+dbmrSaTfGGpPf8z53rx9mD0RCI89iQJZoM5nxc77Ijnf4YLQ 0Vu7kFoEORNS0c15aQf4ANRX/HbNe8QWHNvXy1eiuVm2ud+uO1IuGoJznYZILHft8LXz 3ArjzPb0dOBMDgIdY4TYlXyHc/CvOYVsm1FOfjopf7lvMznXrOxoc7eER1uPb1yaMR3q pcEb/269LUWiz8+ZjYbR8R6tMiL8B1WDy76hLoUHkVU1YR/5X1JcrbUpvjXsl1qwhr22 rUXQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:references:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:in-reply-to:date :dkim-signature; bh=b2bEF7pu3oPrudxp2KioWHyLS9XD0CdHx5hvKW6tPyc=; fh=r4Vsvsp6BcXBr7WjXeG+6vCVa20FEa9JOFhq7jRe1ng=; b=GKhhuTXn4+p9m5y6liVAofLny9rS0TNsaZdBSHx2KHANQ3HOCdrjouM+exhkqK/GG9 GzACJmmJfet5NhL2F6XSNei5tgtanE6Hyz4LAgOcgEZV4tlc7Dl3Tv3yZWjsvCV+D4v8 e4Kx80PqbV6t6Qr+GLAHcM3JppvCdMfzMegXsIMBK5JIElGcZ4p/LDqNe06FHiaYOqsI bzNXnIHAY2psDhPDLXeY/b24RIcJNxMb9bo6jFbW9LRfrcMY2ZhAKDqYGsEsclHcbHhM ClbzQwriQlbXaquwszgdvCikpH8dRHi2GrkZwF6KLzhgp6fF/2Vfq1CIc+YvEqUdpd04 YWvg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=CUnoC5Py; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-210773-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-210773-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 41be03b00d2f7-6e58515f10fsi6977542a12.847.2024.06.11.18.42.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 18:42:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-210773-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=CUnoC5Py; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-210773-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-210773-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id B45DF285189 for ; Wed, 12 Jun 2024 01:42:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D86C4847C; Wed, 12 Jun 2024 01:42:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="CUnoC5Py" Received: from mail-pg1-f201.google.com (mail-pg1-f201.google.com [209.85.215.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BFEB54C63 for ; Wed, 12 Jun 2024 01:42:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718156535; cv=none; b=ph99UpyvraKMLjdcxoJSchf+4AuIAW/+ZHCAeb+6Wm29TDeymkEYH3srdHG9Ow8S0YErcNLRzEhypaxj70SJirQ1eL4WVvd3gElYV632OWyJWv+HeW9qrDMkG8eNfm03Uw8cixySELZLm8++B0PBLBeV6Ri0HvsO2hjDUpBYHg0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718156535; c=relaxed/simple; bh=xZ7SLDZDURI3AX35VLIjN64dL8veo1J6qAgedm8anvs=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=lYAPIohnzlLvJNIqb7bHEVq1YF7clkfj+CDPRsXIVtp8Abd2NJkZhjs0ZIYUs5bxep4b1Gl19WxAlMmj7wU7o5DviZUHdu0Hi8Zh1Fn2f2+E84ZoJKqG8PVJhEHnFRDE2bcCGgyyV/sbplK+d2JNZjw6/uOuqoUKFnN6LQ0VaZc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=CUnoC5Py; arc=none smtp.client-ip=209.85.215.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Received: by mail-pg1-f201.google.com with SMTP id 41be03b00d2f7-667fd2bf4feso5553539a12.3 for ; Tue, 11 Jun 2024 18:42:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1718156533; x=1718761333; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=b2bEF7pu3oPrudxp2KioWHyLS9XD0CdHx5hvKW6tPyc=; b=CUnoC5PyBVDM56OyBhQ1ln1HnW8WcVgGFQAxd3KIk+PlfftX0g9M51R7UzRufltzit XEh/L5oF6qXS10uZjnxmhJ3Z1wbkTP4QC2wCCpFhHmSMHGjMaY1l8lnTZfn0WbDtAy0L cQWYPSc4mufBxh7O/J7js7b0dLRDPQ6pnYBh7Dvuhb24PCSXxEMraSGxEAMyL7Ldwsc/ rLqKxqOesqsSJq3+GtdUnF9hRiq0yfccZHAOaCR3p3FXr2WWoALBx5kz54PJxuGZtTPv y0k6UogXnYe98JhuWkVVf4MHpOK+yWeoDGf1YL80UtNlxtizXI8ODaddmQ2+QmCmqUq5 0rRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718156533; x=1718761333; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=b2bEF7pu3oPrudxp2KioWHyLS9XD0CdHx5hvKW6tPyc=; b=k6+3K1kXF3M0zRi0e01f8zU/eXZIQX0UGOTcXNg3eKrCeRADaNfGI6M36/pYBNu6s1 fX4lEMcFLo9U5dIdBsXBjPYoo4jfV6tk4e3+rz28fPsz01PDQDilMKG7UgEv126ky/gm Ooq7sB7jfO32A2cTIVTYJBa/MytZ/7WrgoRI4uhl9l+82D3IxTsCq7oh6DmYCjh8CKDN igWGz+T5ZHH0g2isaYfADBJW7+A9hgCyHaD6O+iDQdzsiwnOGpaDakTlNb8KtN2EPzoE ca1hMrMZLbLZuyeYPusjH2fhcgFY2alA+Hgy9IRrkWBcUxWLfjqlpaNS+Xjoj1oTKFC6 9W/w== X-Forwarded-Encrypted: i=1; AJvYcCWPwmD6LzbLyyo/GZ7X0ufBkkDamYajc9GWy3TYlygklDWAT8tNJwiaeLI1Mq0BckT7Ad6EU42GsEzhPxILy0TRFqrGBXPi+qNhCAZY X-Gm-Message-State: AOJu0YzsapUz3z+pBkK5/9ycj811ci7+dyr4XGZQIodwhG4qIx0dtMQ+ ndcvup6ixNiT513sNdfHjMe2GIaa0h+F1b3jOArJAcJ4zZgMUIzha7/DUZXES9GFyOCr1ZVc0KR QNg== X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a63:4c4f:0:b0:673:9f86:3f2f with SMTP id 41be03b00d2f7-6fae6d65861mr937a12.9.1718156532733; Tue, 11 Jun 2024 18:42:12 -0700 (PDT) Date: Tue, 11 Jun 2024 18:42:11 -0700 In-Reply-To: <59381f4f-94de-4933-9dbd-f0fbdc5d5e4a@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240429060643.211-1-ravi.bangoria@amd.com> <20240429060643.211-4-ravi.bangoria@amd.com> <59381f4f-94de-4933-9dbd-f0fbdc5d5e4a@amd.com> Message-ID: Subject: Re: [PATCH 3/3] KVM SVM: Add Bus Lock Detect support From: Sean Christopherson To: Ravi Bangoria Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, pbonzini@redhat.com, thomas.lendacky@amd.com, hpa@zytor.com, rmk+kernel@armlinux.org.uk, peterz@infradead.org, james.morse@arm.com, lukas.bulwahn@gmail.com, arjan@linux.intel.com, j.granados@samsung.com, sibs@chinatelecom.cn, nik.borisov@suse.com, michael.roth@amd.com, nikunj.dadhania@amd.com, babu.moger@amd.com, x86@kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, santosh.shukla@amd.com, ananth.narayan@amd.com, sandipan.das@amd.com Content-Type: text/plain; charset="us-ascii" On Wed, Jun 05, 2024, Ravi Bangoria wrote: > On 6/5/2024 8:38 PM, Sean Christopherson wrote: > > Some of the problems on Intel were due to the awful FMS-based feature detection, > > but those weren't the only hiccups. E.g. IIRC, we never sorted out what should > > happen if both the host and guest want bus-lock #DBs. > > I've to check about vcpu->guest_debug part, but keeping that aside, host and > guest can use Bus Lock Detect in parallel because, DEBUG_CTL MSR and DR6 > register are save/restored in VMCB, hardware cause a VMEXIT_EXCEPTION_1 for > guest #DB(when intercepted) and hardware raises #DB on host when it's for the > host. I'm talking about the case where the host wants to do something in response to bus locks that occurred in the guest. E.g. if the host is taking punitive action, say by stalling the vCPU, then the guest kernel could bypass that behavior by enabling bus lock detect itself. Maybe it's moot point in practice, since it sounds like Bus Lock Threshold will be available at the same time. Ugh, and if we wanted to let the host handle guest-induced #DBs, we'd need code to keep Bus Lock Detect enabled in the guest since it resides in DEBUG_CTL. Bah. So I guess if the vcpu->guest_debug part is fairly straightforward, it probably makes to virtualize Bus Lock Detect because the only reason not to virtualize it would actually require more work/code in KVM. I'd still love to see Bus Lock Threshold support sooner than later though :-)