From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f74.google.com (mail-pj1-f74.google.com [209.85.216.74]) (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 774F932A3C8 for ; Mon, 2 Mar 2026 14:53:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772463215; cv=none; b=kjyVhPi7zU+3n0SVGaEEcIFV0zUQ0dOKFWUuBkOGts/Xo22FQneRLLZ3EVKSlOolb3ZYwnI1n/njls6WbDcoX5LWbrEukd/L3hUgDn49SADnGYUY7RTMsj4pZymUSGVuODjSoLknS2x+qEqdW/YR7PAz7/7VLFN3yE+tGb6YOv0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772463215; c=relaxed/simple; bh=6ExRMPFgIfFtm73b8MmQlt2f6XqOd4ntkJPefGvIjkk=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=hhrU5fIYOOf3cMOUPeT/k6QzL3oU3LLYmjhR4KqJLxIHrp1gDcDhY0ISmpN6b2WECr1L2sKSFFSBeHXXWV9B4TcEaVFagPP5o/SaEj5t87yBFvyEx7mxpHWSkxXldNrb1b1nSjQx+LgeLKvrUOH2Qz5P5Gw2x5HwsZvxOrzjTEM= 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=Eppqsdpe; arc=none smtp.client-ip=209.85.216.74 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="Eppqsdpe" Received: by mail-pj1-f74.google.com with SMTP id 98e67ed59e1d1-3568090851aso27740450a91.1 for ; Mon, 02 Mar 2026 06:53:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1772463214; x=1773068014; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:from:to:cc:subject:date:message-id :reply-to; bh=Hp04vGRTMSOv92SowVVT4dSiJozA1zhnX0e0dsa/0Oo=; b=EppqsdpemHwPiT97Vjztdbott2L/6s3eyjTL6aM9WGegGV7XzS96XZF8PeMOvJnPGA CL9BjjuP/qtbvjfLmRtDI6PJApSBUmSG5HryIf7X8oCTGUR6JUaOcGuI8uZ9vvROs1jO 6nprj/ZhVCJKQhbRp0b6jzYDsXPwOiD09GPhzTwIcduVmOK0TC1XQN9vC+bPNs0N6YEm TnZQ4o5P3Vf+338W23muIm6vL5XyXAh68GSkziq/epXjXocJ7+pjwGoZCbbpoWImvcKw z4Cwtk15Pf7nQ/oUSuzLDaiIq51CxLaPJyyrG4CXGAOcHTfQiFI2EzA6tKlxm1oMK3xo y2mA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772463214; x=1773068014; h=content-transfer-encoding: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=Hp04vGRTMSOv92SowVVT4dSiJozA1zhnX0e0dsa/0Oo=; b=jOuB0ZWX8k49/nACM9WuZ84ASgQDvbqXGXsqGuKzLcHaKTgHrSd0DCY8RCe3Nzwg4B yDEMmmagUhmJaZj5Yx9NnmADXNhdXvCaM2xSrZCkxZ3FjM92FDEYcv7COSyF6vEFXDve Tn60W5XTnNn9TCGk08fFe/OYpU6H1w3PXVYeP8jk87U/piHvZaraMe/JlDPzI3FWny11 fPZLkNdsLFqxUmVLvG3St5SkRe6MLWyMA+tQCfNH7PonKurIsW7Ccp22wFeQ9MwXf1Rj kuAZXKkRJu2kpf6o845jhe23MjP7BwZVjHe7QLCpEW13eVnoLx6ghfkl4TTXjTV1k7UI co+g== X-Forwarded-Encrypted: i=1; AJvYcCWeD828DxK3M1XIu8BeHKnmLXA8PdKiYBa4ANFE218QOwdZRhc0Ps0PYxd5dehQmeEW2/laGKRZMUDkIkQ=@vger.kernel.org X-Gm-Message-State: AOJu0YzYIbo6j6CaGtbU7urHxcPMfvYwvOkZbAoJ0KJzbkZeMX3TYAib 65DOtbMLHXJ1zVdLFCcFxc2y+MDD88SH1E79QRaK6eMzOumS+inH7/rAsNuU1RfYFyh/1afewjr vpWwDGw== X-Received: from pjev23.prod.google.com ([2002:a17:90a:e17:b0:359:7984:d6f]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:4d8d:b0:354:a546:5edd with SMTP id 98e67ed59e1d1-35965c49839mr11157040a91.11.1772463213614; Mon, 02 Mar 2026 06:53:33 -0800 (PST) Date: Mon, 2 Mar 2026 06:53:30 -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: <20260207041011.913471-1-seanjc@google.com> <20260207041011.913471-3-seanjc@google.com> Message-ID: Subject: Re: [GIT PULL] KVM: Generic changes for 6.20 From: Sean Christopherson To: Paolo Bonzini Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On Sat, Feb 28, 2026, Paolo Bonzini wrote: > On Sat, Feb 28, 2026 at 12:21=E2=80=AFAM Sean Christopherson wrote: > > Finally got around to prepping a v2, and I realized that vcpu->mutex is= n't held > > when kvm_alloc_apic_access_page() is called, and thus isn't (currently)= taken > > outside kvm->slots_arch_lock. >=20 > It is, via kvm_mmu_new_pgd (kvm_mmu_reload -> kvm_mmu_load -> > mmu_alloc_shadow_roots -> mmu_first_shadow_root_alloc). In fact > commit b10a038e added slots_arch_lock exactly to have something that > could be taken within the SRCU critical section, and thus within > vcpu->mutex :) Oh, right, duh. I was fixated on kvm_alloc_apic_access_page() and didn't t= hink about the "other" side of the lock (i.e. the whole reason the lock exists..= .). Oof, and it's also taken via kvm_inhibit_apic_access_page() | -> __x86_set_memory_region() | -> kvm_set_internal_memslot() | -> kvm_set_memory_region() | -> kvm_set_memslot() So I was right about kvm_alloc_apic_access_page(), and wrong about everythi= ng else. Go me. > (slots_arch_lock is also taken inside slots_lock, and therefore it > must be taken inside vcpu->mutex transitively; but more to the point > it exists specifically to be taken during KVM_RUN).