From mboxrd@z Thu Jan 1 00:00:00 1970 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 493B82ED860 for ; Wed, 14 Jan 2026 19:42:47 +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=1768419768; cv=none; b=DSBloK7y4oKorzm7/7nMUQ8PY1YJeGIxyXm4EZDNEmV3VW2gwV8+XYd1nMhrukhgF5x05qN9a39+6Uk8MH61PVQvcxmrHLiAMelwGpXKmxj4riy2Eh7KF7xdBD+cq46bOhAcDET5wpfJbC5Q75wZbE3nScVlpesEG1AatbFgBio= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768419768; c=relaxed/simple; bh=tJLM3EVPIjwolJnxGvjBiFwtKxPitpUwshSr1wSuMyo=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=ISHC1t06zGO7CmqxxukGINDhKNKZyJbdkGA9kid2LWZFcoMdpwd4+4FYBDULLvqUHPSJrS+gcQGidYcvmtqPXSbG/387SvOjRKwtXjoklr+hj9L9atYfWHkPyFAfzO81jxBc9Dqqm0SEnlDlDat3/T68PHk189aiVS98NFxhjqQ= 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=t6aTq1O3; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="t6aTq1O3" Received: by mail-pg1-f201.google.com with SMTP id 41be03b00d2f7-c52ab75d57cso110979a12.1 for ; Wed, 14 Jan 2026 11:42:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1768419767; x=1769024567; 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=9qi7dt3Dd/aVuAS5ol/gIpMZCnZnmJVwzmEj9I8BYxY=; b=t6aTq1O3lawodb3Y9hM79sXGSqUZk/3obql0wTVJXaxGVBJaBsvD3FK3Abc7SQyhbd gXjMAR9pwN8ZmF7/PJ85kRsaeTVNAjNjuuRZ3ZZxB6QeZYIps4ue/GHQhea0Hw+voiH/ Z0X3qtCKcCZo+7e/H6A0ttvG/iyEoMGjXOkAPldg4XFPap/8dDHzgR+kNVPGFnKlJA5O I9sgVNHHwOczkTSPzTYGZu/sm186TsEP4u/8p+9OCcuHPAOSneVe8cy3OBLVW0XatXV6 45K3xtYIyrogGATQaZ5iU6nOmSwIBWyilJ5/aKjgMEtyV2UAqRoPAdYClUZaVgR7WcyB 3+Gw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768419767; x=1769024567; 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=9qi7dt3Dd/aVuAS5ol/gIpMZCnZnmJVwzmEj9I8BYxY=; b=bsPDWjFDGz104fx/cONxkDExyhQo3rsga11EZyQAIQPfI1YnySQ1MFrLVOzb372qWW ejYpS9UzEQP5f4wnmiO5pjrtj4WW2nR6KBG/sRpjvcj9yyRCiwIYFqNM8NTAU5f5Y6jv rqPTKcK5w+0cFjTRvNRMTXxDUw3oe3/Ip3KSYzPmSONVEiA1T9p7U42/QYUU5iBJNzzK P49mG6t/+zIZO/wmuO54HH/BeXiX9+0JB3mVRu9bZrrGsxlNJlXi/oJihWKvQQoH8iJ+ lHw874d8bdwa3pBpQRLH/vY3ltaFwT1Pu7iFCJQbSjonc+3B1d0HT3lNrW8KGSZhsU9K xFhg== X-Forwarded-Encrypted: i=1; AJvYcCVd5j9Thmpz1gjE3I5jI3mvSyDshwaL/NhWhsuGR3/w4FjQl7De6UIU3ZweyznqLPG+JhQogIe3nOj0i44=@vger.kernel.org X-Gm-Message-State: AOJu0YzRTPyaG5PmaxBv/COMB7Wh0pLaPTAHIgOu+u0HYYulKirXANSX vDPiK/6Rr5/uImcwotUE4w9T6rJUB3Mfp66qiWRsQcMeHb+SXYm0Na2BeSoJb7u6LCNE4Dtduut lSxVwxQ== X-Received: from pjbkb14.prod.google.com ([2002:a17:90a:e7ce:b0:34c:cc12:1613]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90a:e7c1:b0:343:d70e:bef0 with SMTP id 98e67ed59e1d1-3510911fba8mr3604743a91.21.1768419766622; Wed, 14 Jan 2026 11:42:46 -0800 (PST) Date: Wed, 14 Jan 2026 11:42:44 -0800 In-Reply-To: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260112232805.1512361-1-seanjc@google.com> Message-ID: Subject: Re: [PATCH] KVM: SVM: Check vCPU ID against max x2AVIC ID if and only if x2AVIC is enabled From: Sean Christopherson To: Naveen N Rao Cc: Paolo Bonzini , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Suravee Suthikulpanit Content-Type: text/plain; charset="us-ascii" On Wed, Jan 14, 2026, Naveen N Rao wrote: > On Mon, Jan 12, 2026 at 03:28:05PM -0800, Sean Christopherson wrote: > > When allocating the AVIC backing page, only check one of the max AVIC vs. > > x2AVIC ID based on whether or not x2AVIC is enabled. Doing so fixes a bug > > where KVM incorrectly inhibits AVIC if x2AVIC is _disabled_ and any vCPU > > with a non-zero APIC ID is created, as x2avic_max_physical_id is left '0' > > when x2AVIC is disabled. > > > > Fixes: 940fc47cfb0d ("KVM: SVM: Add AVIC support for 4k vCPUs in x2AVIC mode") > > Cc: stable@vger.kernel.org > > Cc: Naveen N Rao (AMD) > > Cc: Suravee Suthikulpanit > > Signed-off-by: Sean Christopherson > > --- > > arch/x86/kvm/svm/avic.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > I think the bad commit is: > f628a34a9d52 ("KVM: SVM: Replace "avic_mode" enum with "x2avic_enabled" boolean") > > ... which introduced x2avic_enabled. No. That commit definitely set a trap for 4k vCPUs support, but there was no functional bug as of that commit. KVM would unnecessarily check @id against X2AVIC_MAX_PHYSICAL_ID, but it's a non-issue because X2AVIC_MAX_PHYSICAL_ID is a constant and greater than AVIC_MAX_PHYSICAL_ID. if ((!x2avic_enabled && id > AVIC_MAX_PHYSICAL_ID) || (id > X2AVIC_MAX_PHYSICAL_ID)) return -EINVAL; So from a "what LTS commits need this fix" perspective, it's just the ones with 940fc47cfb0d.