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 5E5808C1F for ; Tue, 10 Feb 2026 00:03:57 +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=1770681838; cv=none; b=QIaOvOIjk6hUqJyJGMW2PgJA3gxT4DkIEuUx1UR1ccJXTnbDaz16OvwzrbxhiaiV8ChF3InHnpnHonRc/Xrt+NuFfeIqDY/TIavnYinDV0tdBnTBwkeTL09x1QFkxh+rqj3AftGkMVHBqfkMtrae82pJQSmlSQTfmZmc/JMNSzY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770681838; c=relaxed/simple; bh=gjWOfh2oXqfUpw2wDeimGs6kjBD+x4vrWr1zYXsf3kY=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=uGVkL1wVtFq+XDLVe/Y4SQar5sghBA3RWwIdVQG+Q25EzdR4z2E+CwxXfJXz2SyF6+kZjBuGVNnmZlZwmfz+/3AaswYWDlCbXnLaTRfb3gGd8DXQvnz9cF15wcD7pb+G/iDbOHHmJi9IAmVKP9L6lDOrnjurJrZ8zqmjiPeY+5c= 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=T4xwVp77; 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="T4xwVp77" Received: by mail-pj1-f73.google.com with SMTP id 98e67ed59e1d1-35464d7c539so3762952a91.0 for ; Mon, 09 Feb 2026 16:03:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1770681837; x=1771286637; 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=8D+wnxBr88OFAdWjFQqFAuUdOy/p9oRL4Mq3hgfPxZ0=; b=T4xwVp77zxDfX9U/xW0iB7hugA23wL6mFKTJZTf8odrswrjx5UpVFQvFNnMiVjSjPj E06mvZj3Fu8pcWab2U6kijHLr5eX9YtxiJRB9AMO0zc5waAObWJAaXKKMiyK1vn3004/ WWBfUA2hFYR16mA4t9UeDrEy8VF7bfmF/KjzO+/SwMxA4fIjXGsTopAxLFWxI53g1rC+ 76FBQsZnV8fBhfAvMmy+GvOgZJ/Bp4k7CCcZhi8LtgsoFDVM209aZeRm9wJcqFvQPlKy hhsw/uZulZCuIeb0hvOTd6uw3ui4mvvGqD91NhA4J7bz7QgOpA/LARpR6oCQv0NS95Ex BrfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770681837; x=1771286637; 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=8D+wnxBr88OFAdWjFQqFAuUdOy/p9oRL4Mq3hgfPxZ0=; b=oeSr46bb3HetGgWBsHK92gjQgFNcx9+Es5dZFWhyppM0PgZBV24c7Q1tXUxrhO982m r5B16AHHOpgN5vRtViRH4Tv3csKMJ9YVjrmZr31hmhQ7hmh0+LsKoscU68SXqVFv5uqg bXYWn8ipb2nCGoN1a+/Ay7E9UMR5EjpA8cCFzesxa6BDcDIIawpk1hJ6rNjB0/8kP0th CbsuvFrxCfaE001wQ8e0GIFliiMjbjb0I3zADXBWpyzUn9UyEPIUQPkP8qqwfVcHpVM1 xhcs2AYLrf9SL5vqQJeG12nNnzmWXbQT1tiOYQEnX7r7Ubk3xUN7zDvEbfogQOMcyQoz 4P8g== X-Forwarded-Encrypted: i=1; AJvYcCW2UrE0dCevqJ3cBdfw9xiAkAkLWfIKBRXUzPPlKhSAWbUX5Nm/TIOAehFyFH6finjGhQu9r53SenUEUpY=@vger.kernel.org X-Gm-Message-State: AOJu0Yzqc50Zq6+Ic2NQdzu/P59BPG0WIu9n9L01GLmn65c66lt+5wAf 4Y08BwqEqDem8xy6iZIrj2WMhhUuzhwb94w/NwOuArHOyUaXQo/GITovLpx0OMeXMa/G7gqs2WH yBDdspg== X-Received: from pjbse14.prod.google.com ([2002:a17:90b:518e:b0:356:3562:569c]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:58cb:b0:340:b572:3b7d with SMTP id 98e67ed59e1d1-354b3e2b23amr11589908a91.19.1770681836655; Mon, 09 Feb 2026 16:03:56 -0800 (PST) Date: Mon, 9 Feb 2026 16:03:54 -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: <20260129011517.3545883-1-seanjc@google.com> <20260129011517.3545883-21-seanjc@google.com> Message-ID: Subject: Re: [RFC PATCH v5 20/45] KVM: x86/mmu: Allocate/free S-EPT pages using tdx_{alloc,free}_control_page() From: Sean Christopherson To: Dave Hansen Cc: Yan Zhao , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, Kiryl Shutsemau , Paolo Bonzini , linux-kernel@vger.kernel.org, linux-coco@lists.linux.dev, kvm@vger.kernel.org, Kai Huang , Rick Edgecombe , Vishal Annapurve , Ackerley Tng , Sagi Shahar , Binbin Wu , Xiaoyao Li , Isaku Yamahata Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On Mon, Feb 09, 2026, Dave Hansen wrote: > On 2/6/26 07:01, Sean Christopherson wrote: > > /* Bump PAMT refcount for the given page and allocate PAMT memory if n= eeded */ > > int __tdx_pamt_get(u64 pfn, struct tdx_pamt_cache *cache) > > @@ -2272,7 +2272,7 @@ int __tdx_pamt_get(u64 pfn, struct tdx_pamt_cache= *cache) > > if (ret) > > goto out_free; > > =20 > > - scoped_guard(spinlock, &pamt_lock) { > > + scoped_guard(raw_spinlock_irqsave, &pamt_lock) { > > /* > > * Lost race to other tdx_pamt_add(). Other task has al= ready allocated > > * PAMT memory for the HPA. > > @@ -2348,7 +2348,7 @@ void __tdx_pamt_put(u64 pfn) >=20 > Why does this need to be a raw spinlock? irqsave, sure, but raw? Huh, TIL. (And just when I thought I finally had my head wrapped around RT= "spinlocks"): The hard interrupt related suffixes for spin_lock / spin_unlock operation= s (_irq, _irqsave / _irqrestore) do not affect the CPU=E2=80=99s interrupt = disabled state. Ah, and running RCU callbacks from soft IRQ context is straight up disallow= ed for PREEMPT_RT. /* By default, use RCU_SOFTIRQ instead of rcuc kthreads. */ static bool use_softirq =3D !IS_ENABLED(CONFIG_PREEMPT_RT); #ifndef CONFIG_PREEMPT_RT module_param(use_softirq, bool, 0444); #endif So yeah, just spinlock_irqsave should be fine. Though the way things are t= rending, it'll be a moot point if KVM ends up freeing S-EPT page tables from task co= ntext. > The page allocator locks are used in this context and aren't raw.