From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f201.google.com (mail-pl1-f201.google.com [209.85.214.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 45B3D2F9D94 for ; Fri, 21 Nov 2025 18:56:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763751377; cv=none; b=jo0cS8Aqioty6kDE6bVihKTyCyjXfBQO0HDFIKsKON0rS9PZ1aUlDENO/RSGG/h9QfStcJty+cWgyZU0LHiAPegsZxYJf/f11QghJL5vld9bJV0PvLhsabFGqPgPXmC7dXgXjMt2QGcZUQyMgRCqGW8N0j0j7hEUxtk1LkMw0LU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763751377; c=relaxed/simple; bh=pA6HhH8cYu8tFmUOKlzpU3Wp08scGDLJ7KsfyRnftss=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=VoFfKwBLkdmRpvjP38ydi3mJ5M6CFjSmyqVEQxeiJDBWUGpkquTwotvlwQu/44JnkDCzfTfJx/wrksptyRVad8tU9JbZZGobcWnl+oB/pASoODFe+wReOroey/221WZFaQVsI1mNNZ+8wceiAR0b3a+vZHrjKJwkRx7I9n9ACDA= 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=WhKJwt7Y; arc=none smtp.client-ip=209.85.214.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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="WhKJwt7Y" Received: by mail-pl1-f201.google.com with SMTP id d9443c01a7336-29b760316a8so4167655ad.2 for ; Fri, 21 Nov 2025 10:56:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1763751374; x=1764356174; 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=dyfHUqL6df9F6XiTb90JYkfND1n7NtpKe8YZliaM9OQ=; b=WhKJwt7Yi/tk83E1p5vgoMJAtxBtfjJLaq3FfrKLBmhJPbR+1+tX3SF+TfRuez6PZq FTOLSi7EJR/rO4Sh7y2cwNsY0WlZbvo1Ag6QZi209K58YQoGzFKb7tht+86y4IuZrY0F B8ytTiZwgn+YXlytd8c6GribZKFjKnqdzrDrcth5oQ9c2oN6xHuvm+aM1zBQc/QgROl0 M/yFaEz14HoNnHp6gCilL+lgr0idCe4lWwKApYbarxACX4H5RFHhtGIgRkXaxNKdpGA1 WsFA2mALZalPeCDRhvoH2SoM6LxEKapoVdu2r5UwwF478D8sUV5y8U8TuwJG4luboEeI 1fHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763751374; x=1764356174; 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=dyfHUqL6df9F6XiTb90JYkfND1n7NtpKe8YZliaM9OQ=; b=ZARH7zQEBAbWo4PjjgUsX35UBFfksnexIZiIMoGACVCp2x4uTjMrxNB5t9H5zWNLc5 q6LajCv2VLBYJ87cwaEJp/vULZrspr3/kS/xkri4C5VPOH+yXn0V/78G/z1wZCz0lNqO L6I8cbeCOrSDcbPcZajacQPrL1GwBh5V5l8kET8+PSRbkzXaBibEkatPU+6KiG9ypoBx ma1DBjtfkgsT/vbTGOCj9WuxQsNa4OaG8oJM47GyD7+JhO5hHN7qsD1ugGKMJc6/gAJZ qNjWqgC7FA7QZdNrZaCwwZAK7+4mRhxFD773EcKOEATj2iUpeH0cVgC1sFL1ESr/dvsl eV+A== X-Forwarded-Encrypted: i=1; AJvYcCV4vWFQtbHV5uMAc+g6IjXREWM6IN0Frg9IeM9rRnX6n3pKr4Q25ehDlCdwsGz1itZ0nYpkVFiixszlxTk=@vger.kernel.org X-Gm-Message-State: AOJu0Yz4jBCfteq5DSEJnfR6mfARmOj5l8PIQpmeJY6NifeYQcdrxeLc NSE3anhHO0Lf26SDDt9AKGwER0w3n1xwGR0PjJb9XJCoVfcBA++nktVjc8unbW2BFfEaYuPXJSd GEhVXUw== X-Google-Smtp-Source: AGHT+IGGb1aHI5E6UaxYSqn4n/1r9BCGdlieziJtcx6wMic5y2PJaDDWne0NG5Ox3KhGZrA49vtPf+i99x4= X-Received: from plhy6.prod.google.com ([2002:a17:902:d646:b0:298:1181:af51]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:903:46c8:b0:24c:965a:f94d with SMTP id d9443c01a7336-29b6c699252mr39885405ad.46.1763751374581; Fri, 21 Nov 2025 10:56:14 -0800 (PST) Date: Fri, 21 Nov 2025 10:55:31 -0800 In-Reply-To: <20251118222328.2265758-1-seanjc@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20251118222328.2265758-1-seanjc@google.com> X-Mailer: git-send-email 2.52.0.rc2.455.g230fcf2819-goog Message-ID: <176375129628.290245.2248166569099413567.b4-ty@google.com> Subject: Re: [PATCH v2 0/4] KVM: x86: Cleanup #MC and XCR0/XSS/PKRU handling From: Sean Christopherson To: Sean Christopherson , Paolo Bonzini , "Kirill A. Shutemov" Cc: kvm@vger.kernel.org, x86@kernel.org, linux-coco@lists.linux.dev, linux-kernel@vger.kernel.org, Rick Edgecombe , Jon Kohler , Tony Lindgren Content-Type: text/plain; charset="utf-8" On Tue, 18 Nov 2025 14:23:24 -0800, Sean Christopherson wrote: > Optimize XCR0/XSS loads that are currently done on every VM-Enter and VM-Exit, > by handling them outside of KVM's fastpath inner loop. > > Context switching at entry/exit is unnecessary behavior inherited from a > hack-a-fix that papered over an egregious #MC handling bug where the kernel #MC > handler would call schedule() from atomic contexts. The resulting #GP due to > trying to swap FPU state with a guest XCR0/XSS was "fixed" by loading the host > values before handling #MCs from the guest. > > [...] Applied to kvm-x86 misc, thanks! [1/4] KVM: SVM: Handle #MCs in guest outside of fastpath https://github.com/kvm-x86/linux/commit/ebd1a3365500 [2/4] KVM: VMX: Handle #MCs on VM-Enter/TD-Enter outside of the fastpath https://github.com/kvm-x86/linux/commit/63669bd1d50f [3/4] KVM: x86: Load guest/host XCR0 and XSS outside of the fastpath run loop https://github.com/kvm-x86/linux/commit/75c69c82f211 [4/4] KVM: x86: Load guest/host PKRU outside of the fastpath run loop https://github.com/kvm-x86/linux/commit/7649412af3ea -- https://github.com/kvm-x86/linux/tree/next