From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f202.google.com (mail-pg1-f202.google.com [209.85.215.202]) (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 C71FA2BE621 for ; Fri, 12 Dec 2025 18:01:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765562496; cv=none; b=amRnPMAISkDWpmvdOdRxBQKnmiNtiB8FwZEhbhfvYq6en+3XA/i4osECV9JaQUp8D7rB+dPIsGV6dOryAgfxbnOvUacnjCxbhu9kTlbYXHYP6upbNGiega8olFNfN/iPteLzrpFmE89IoeQJ1B+GdNz91LW8+TSuv7O6TZBp6bI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765562496; c=relaxed/simple; bh=ZoEjubOAjdQ0I4mKDTjbIEIjvzHhGG3QwAQog6ErYcc=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=ZT7pwqzegFzPSi0cng9r6qeHvKe5jLz54KyMCN/Oq3LVKnLTR/44EsyEI8sOyV9Ws6lxGYzUCnDvEJkmKhOXIqHwJaiu0HnP16gkDC0R8Aj9DkCPryZA/dtcna27b+NBqRJV9JVWqvU/3eUvtawWd16xDEAJbSdio/e2WEryTF0= 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=I06dKC75; arc=none smtp.client-ip=209.85.215.202 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="I06dKC75" Received: by mail-pg1-f202.google.com with SMTP id 41be03b00d2f7-b471737e673so1544446a12.1 for ; Fri, 12 Dec 2025 10:01:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1765562494; x=1766167294; 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=Bo9Rm1dXUYD7l80/8yzy6VKuYdJBg7Dl5IR6XCJePgM=; b=I06dKC75/2bOc5blkuZ+GDpnfBG6qxKOfW9yiqhPG/orBDpHzTi43UNZdV2MXNJX/O exLf4rjIH0K5/+tWDlBvlXLfvA7Z+UBm2t2josfNW6KEc+kxxPSMNAJYvj3FgYsHFX8o 8CjNo9XBa2sksSCRnHE/Pm2AXkRpJUyfRQXQ02tGOcvp6gOjev5AkUn2jYRUhdpkBGoL +n0WFq5mIGYNwlA3BhDtxpSOMnV0432ZseCcTa0hDnoAP7+Ct6+0qVjizpoCwIffVJQ+ gMT5m1Os4GCUlxRbvCjaPlwualfK6KbXgSPllqvMOnpdUV+AMX0MIKUB0X7JhxJr7xfE kHLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765562494; x=1766167294; 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=Bo9Rm1dXUYD7l80/8yzy6VKuYdJBg7Dl5IR6XCJePgM=; b=f3f4cJGQwN4lUS6Btc/CNcGVcrbDJ/NSWoN0O6cXeoR+ijUJS+Izh9Pi7Efkjw1a2F NyIsJO60gWXJtVrLFKak8KM8CS9s41xj5wBezNp64kAb7nnaz1XMV+NSCHZVRLWqIkvl L8Whx6W1hZBronDbugfYeF1yRnIQ7Ip4qM7KRl0zcXG2XjdwyYeyjZOKZFWemO78iL5f ri0wt3ucAS1WEjGETiPqjf8S5v1KYFyPPVtl2UddnI8V6Aq4bnpQVt88PdDBFRp13gBw YZQFecg3ra/0EtrcPVjW8UYkj6BlznQFEXwq3HAHGz8aByr5k7SerrlhG6jrMSNm8tAR BIOA== X-Forwarded-Encrypted: i=1; AJvYcCVkjvtSqIUipz0NnmDNhR1YWtMQT2f693Jh4u5d1nosqeDJpQpD1kIMv9Ftey6njyLMvGQVtE0fsynu+z8=@vger.kernel.org X-Gm-Message-State: AOJu0YwXqSPIJC/0M85M4tAKoewtx/1GHD6nu5bl6ygv4VulG7sBMSQ4 bOTNIpT571ngGSC6m9ugOiWdxBHv0/+7xD0FLOpO/9aV8WKgRxlOLeRb34VZ4V9UG0J5thQl315 oZRQgbg== X-Google-Smtp-Source: AGHT+IG/4+97J2DvkIN9CYSSrtj45Rtx9GE13lZ9oDwNJ9qEfvU5HujDnh8hzt5x4oEkihpsJs4cN5QoWWM= X-Received: from pgcu129.prod.google.com ([2002:a63:7987:0:b0:c0d:af51:bbb5]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a20:7350:b0:366:14ac:e1df with SMTP id adf61e73a8af0-369b05bee25mr3197541637.69.1765562493663; Fri, 12 Dec 2025 10:01:33 -0800 (PST) Date: Fri, 12 Dec 2025 10:01:32 -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: <20251205231913.441872-1-seanjc@google.com> <20251205231913.441872-4-seanjc@google.com> Message-ID: Subject: Re: [PATCH v3 03/10] KVM: selftests: Add a test to verify APICv updates (while L2 is active) From: Sean Christopherson To: Chao Gao Cc: Paolo Bonzini , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Dongli Zhang Content-Type: text/plain; charset="us-ascii" On Fri, Dec 12, 2025, Chao Gao wrote: > On Fri, Dec 05, 2025 at 03:19:06PM -0800, Sean Christopherson wrote: > >+static void bad_ipi_handler(struct ex_regs *regs) > >+{ > >+ TEST_FAIL("Received \"bad\" IPI; ICR MMIO write should have been ignored"); > > is it ok to use TEST_FAIL() in guest code? Doh. Good point. It'll definitely generate a failure, but not a very helpful one. > >+static void l2_vmcall(void) > >+{ > >+ /* > >+ * Exit to L1. Assume all registers may be clobbered as selftests's > >+ * VM-Enter code doesn't preserve L2 GPRs. > >+ */ > >+ asm volatile("push %%rbp\n\t" > >+ "push %%r15\n\t" > >+ "push %%r14\n\t" > >+ "push %%r13\n\t" > >+ "push %%r12\n\t" > >+ "push %%rbx\n\t" > >+ "push %%rdx\n\t" > >+ "push %%rdi\n\t" > >+ "vmcall\n\t" > >+ "pop %%rdi\n\t" > >+ "pop %%rdx\n\t" > >+ "pop %%rbx\n\t" > >+ "pop %%r12\n\t" > >+ "pop %%r13\n\t" > >+ "pop %%r14\n\t" > >+ "pop %%r15\n\t" > >+ "pop %%rbp\n\t" > >+ ::: "rax", "rcx", "rdx", "rsi", "rdx", "r8", "r9", "r10", "r11", "memory"); > >+} > > There's already a vmcall() helper in vmx.h. Why add a new one? Oh, nice, I somehow missed that. > >+int main(int argc, char *argv[]) > >+{ > >+ vm_vaddr_t vmx_pages_gva; > >+ struct vmx_pages *vmx; > >+ struct kvm_vcpu *vcpu; > >+ struct kvm_vm *vm; > >+ struct ucall uc; > >+ > >+ TEST_REQUIRE(kvm_cpu_has(X86_FEATURE_VMX)); > >+ > >+ vm = vm_create_with_one_vcpu(&vcpu, l1_guest_code); > >+ > >+ vmx = vcpu_alloc_vmx(vm, &vmx_pages_gva); > >+ prepare_virtualize_apic_accesses(vmx, vm); > >+ vcpu_args_set(vcpu, 2, vmx_pages_gva); > > s/2/1 > > only one argument here. Gah. Thank you!