From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f73.google.com (mail-pj1-f73.google.com [209.85.216.73]) (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 A4BC732B9A0 for ; Tue, 27 Jan 2026 18:59:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.73 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769540367; cv=none; b=WTifmLiqFDX/cZhSuifIFjrHdlDxV3JXf41nG0e84qsLQPLilgHS3NtQhBVXGuD0hxfg6b2zUzNv571oL9Cz4UAlmhGhnodqTQM3iM0QFvyclCcw5Fyd3nkVhahmAoED3s68QqIq4pjPPVMvqFaJX04qcFBAMUqCiFQFcrve9oU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769540367; c=relaxed/simple; bh=m8yzuLzt+5k8xQvyVmplfgseiSn5dLhJEbq3KkkBHOo=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=rINJUVR/v+1l0uY7+vHbbCUC5q2NkFWNou9CapOXgvkLx85nqZLIl5XYmlGDGYnUFMKr5V1Atbt8XaPuDKjXG4hOoPL+Dv3jG1ORFGBhZWUpzMQGOqByckY1mNZYmxivyqTuIWv3CP7eEL/WWY/nrz9Tqh6o0UjE4DIfzLbYkxI= 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=EmbOuYvu; arc=none smtp.client-ip=209.85.216.73 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="EmbOuYvu" Received: by mail-pj1-f73.google.com with SMTP id 98e67ed59e1d1-34c704d5d15so11063610a91.1 for ; Tue, 27 Jan 2026 10:59:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1769540366; x=1770145166; 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=sG+LTRFf1Onf4n7WEEL8aqcN9LibwU8cf6AOwJP4mAE=; b=EmbOuYvud0vwqvqDutf8M1p5xBLrUtlZ3IX+8ztmZqg1FPaqptsv+6vEXg1q4R1kOM AI6KbulTGOTu5tEyW8fIRM9DT3pAw5H3/8DBl5ZYlgviaa7KpSKpR6BD3CxhCH15bu9M F+Dl2s56YcDRFxpjzmFF5vn6lDQUeMt9hHhQcr9mWDvvyUnW7BVoBX88jr8D51CyzGBq wIegL+H8yTnWpQ2uI6VRwQ/hT/IBbgRU+s734qbu9DP3WlCF7kT+J3TtX6dIq4WLORQK 3Sst6Uumk+y3smvM17+kS9o6VEBy75waGEfH3H7WFJuFEFruOczVbCmCW+eYFubpo3C+ 4gLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769540366; x=1770145166; 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=sG+LTRFf1Onf4n7WEEL8aqcN9LibwU8cf6AOwJP4mAE=; b=c4jWF5LNhRRlyGgrYyWPNZVxtZ91xCc54cj1QesU2GIdWf+aNwWpfgCAL3VWq+oIwo HiC1Sx9aCOseBJJ7kA0HgaopuPniMlP/WlQ15R5wllfaBIcAFv6OIUAwgwygYUpJC0ku LTDWRmwOxBuNJS4l/kXYurIQyb3a1uwa+GhvgcIS8CcrtVzWrJGWXXeJIzSKSEQRHcB2 QjPaAco+5iAciBz157/OxHcvl1a9ONqwFx2AO29nuc8b4X2adJWcC47h42XlCpOIqT9T iGpsaN1oH5GNIWr/gnHqUKQsMJE2vBS7aVEGLyUwciEDJPRrVYJ5GOacbdCQkMUtkp5W Nz7w== X-Forwarded-Encrypted: i=1; AJvYcCXLrVpx9gUtsFZAFdQtoSWSM3nNksCpWQOhC90eSrM+0SK4ci/4VEItaMA2iL54aB+HcXad+LLRV5p2hGc=@vger.kernel.org X-Gm-Message-State: AOJu0YwNVUh4OvYZe9yrIKbpP/gUlDwN+l0aGTLAnkTc/5UHgPx7hH1y 2bGiO6jHTB0gkiQXDwT7YuD8LQhs6y2CChSRW+jLNFDLubJnBWYdP+dMwgrRxfjmzw49W2vVv8m lucxT4Q== X-Received: from pjbbr8.prod.google.com ([2002:a17:90b:f08:b0:352:f654:c302]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:5883:b0:34a:adf1:6781 with SMTP id 98e67ed59e1d1-353fecee84dmr2478760a91.9.1769540366026; Tue, 27 Jan 2026 10:59:26 -0800 (PST) Date: Tue, 27 Jan 2026 10:59:24 -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: <20260123221542.2498217-1-seanjc@google.com> <20260123221542.2498217-4-seanjc@google.com> Message-ID: Subject: Re: [PATCH 3/3] KVM: VMX: Print out "bad" offsets+value on VMCS config mismatch From: Sean Christopherson To: Chao Gao Cc: Paolo Bonzini , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Mathias Krause , John Allen , Rick Edgecombe , Binbin Wu , Xiaoyao Li , Jim Mattson Content-Type: text/plain; charset="us-ascii" On Tue, Jan 27, 2026, Chao Gao wrote: > On Mon, Jan 26, 2026 at 06:57:26AM -0800, Sean Christopherson wrote: > >On Fri, Jan 23, 2026, Sean Christopherson wrote: > >> + pr_cont(" Offset %lu REF = 0x%08x, CPU%u = 0x%08x, mismatch = 0x%08x\n", > >> + i * sizeof(u32), gold[i], cpu, mine[i], gold[i] ^ mine[i]); > > > >As pointed out by the kernel bot, sizeof() isn't an unsigned long on 32-bit. > >Simplest fix is to force it to an int. > > > > pr_cont(" Offset %u REF = 0x%08x, CPU%u = 0x%08x, mismatch = 0x%08x\n", > > i * (int)sizeof(u32), gold[i], cpu, mine[i], gold[i] ^ mine[i]); > > Why pr_cont()? The previous line ends with '\n'. so, a plain pr_err() should work. To avoid the "kvm_intel:" formatting. E.g. with pr_cont(): [ 5.355958] kvm_intel: VMCS config on CPU 0 doesn't match reference config: [ 5.355986] Offset 76 REF = 0x107fffff, CPU0 = 0x007fffff, mismatch = 0x10000000 [ 5.356019] Offset 84 REF = 0x0010f3ff, CPU0 = 0x0000f3ff, mismatch = 0x00100000 [ 5.356048] kvm: enabling virtualization on CPU0 failed versus with pr_err(): [ 6.527945] kvm_intel: VMCS config on CPU 0 doesn't match reference config: [ 6.527979] kvm_intel: Offset 76 REF = 0x107fffff, CPU0 = 0x007fffff, mismatch = 0x10000000 [ 6.528013] kvm_intel: Offset 84 REF = 0x0010f3ff, CPU0 = 0x0000f3ff, mismatch = 0x00100000 [ 6.528048] kvm: enabling virtualization on CPU0 failed Ugh, but my use of pr_cont() isn't right, because the '\n' resets to KERN_DEFAULT, i.e. not captured in the above is that the continuations are printed at "warn", not "err" as intended. Ah, and fixing that by shoving the newline into pr_cont(): pr_err("VMCS config on CPU %d doesn't match reference config:", cpu); for (i = 0; i < sizeof(struct vmcs_config) / sizeof(u32); i++) { if (gold[i] == mine[i]) continue; pr_cont("\n Offset %u REF = 0x%08x, CPU%u = 0x%08x, mismatch = 0x%08x", i * (int)sizeof(u32), gold[i], cpu, mine[i], gold[i] ^ mine[i]); } pr_cont("\n"); avoids generating new timestamps too, which is even more desirable. [ 5.239320] kvm_intel: VMCS config on CPU 0 doesn't match reference config: Offset 76 REF = 0x107fffff, CPU0 = 0x007fffff, mismatch = 0x10000000 Offset 84 REF = 0x0010f3ff, CPU0 = 0x0000f3ff, mismatch = 0x00100000 [ 5.239397] kvm: enabling virtualization on CPU0 failed Unless someone strongly prefers re-printing the timestamp+kvm-intel, I'll go with the above approach for v2. Thanks for the reviews!