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 BD23148125D for ; Thu, 7 May 2026 19:13:29 +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=1778181218; cv=none; b=LQ9chZ3aBEB27ORSc6OxbSWM2MWZbVEzW6g3aA/faks9dh739rVdMzX/VECsAIZfVSiAu6AEfJ+1NLguo1L9YzRPSR7i75xxTy+CAn04o9enfNW4mRin6Y6n73Z+CUooaBqFo2wRJEam3w/KA0PEanZ+IK4+1wRDWWjdc7SlgTc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778181218; c=relaxed/simple; bh=FZbzaU2LUxJzETVXbc9pj0jxkaw7GCMbdBzEzfvdCfU=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=fEltW4rBSfCs09yT362mB+wGOIxtjhWR4sNbzL3yRNLVT363XFlACE7DE1FydclkG1tRJTrCYT5BcHDIJBpUDveqo5NPFDNYt+TN+3CABrV7A4sRUSgmAi5mPLIeaxWVoYgwbqgfu3i3e6klIktj4uiHURolX+nIXLtppwd3Tk4= 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=AK0kYWo8; 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="AK0kYWo8" Received: by mail-pg1-f202.google.com with SMTP id 41be03b00d2f7-c8252a4a1b7so552839a12.3 for ; Thu, 07 May 2026 12:13:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1778181207; x=1778786007; 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=VWh64iTYCNQdm+zuXCNjZRmYSyIHS5N+G4ZxsqlfGdI=; b=AK0kYWo8+3GGKWMTNamOWXKs/VpHdtaEi4St83eKnj/6Q3DchBqCisR4petiLtA01b zXFU1n2QrxaexKe2KR93lHbBe1VSYHeif9dLDUQSLFCMd7hr9In8s9UZnKwtE3GqmRWF Dv9pJ8vBxAJvp4t0CKGSBTWfw8rsI1MwE7Du5XjsGCenoU7nji+sAA3j58GcQWBfo5C+ zJkfoGb7LkDA89nCHLQ3t6x7exiErxD7fEqwi4N0sQm4OamBHr0Cxpq6V4YF7jVcNlew yguqCjc+HJTs0Djl4aC3QAHqkq6OxtuFB5Kd7noIn63S7w0q5qcc2w3fhYPd9gdLCBiZ mPCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778181207; x=1778786007; 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=VWh64iTYCNQdm+zuXCNjZRmYSyIHS5N+G4ZxsqlfGdI=; b=ANjrlr2olOqhrRJ758E4jZsMVGa2opIGKlRqz612hUYRywKJc/a6nEwruo18EGNR2U GNtm5VFDvWUCzZMhdl1s7X4uvQ4YA2SWV6tV90cAd2+W0XhiexcY3RjodR3oXgPD2vg8 Vi4hjqpaackB84JMzbpA+OlYmN1jNFjLtQgxfPDs751NbAC3mFdAZSXW79Mn9gXK/KDt PTGE1T+uPoS2J6Pj7FU3pj3+8O2JKRHjw69gAbBevCESZZKu6kL2ngOzO4xZwMpfK/oF nTDyI9l3KDIkGlimwQio+JeZgL9jSPE/17BaUl79Om1XOtSe20NKU4OJWzZ44sWc+vZs DVMw== X-Gm-Message-State: AOJu0YwIJIYqmeitDPJlnHzSNF3deux8f6zLxJVjpVjCSBk4wyFIterJ 9MnN+MWZwX6rqaBv9qdABJ+ohVhdMvXEWdtXED3loIEWAWXAnKJZoyrkqJXoyxP0G/+j3wtiVo/ 8PU1a+A== X-Received: from pgbcq13.prod.google.com ([2002:a05:6a02:408d:b0:c80:26d4:20ea]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a21:3390:b0:39f:94cb:1bc with SMTP id adf61e73a8af0-3aa5a901f0amr10596349637.1.1778181206910; Thu, 07 May 2026 12:13:26 -0700 (PDT) Date: Thu, 7 May 2026 12:13:26 -0700 In-Reply-To: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260503210917.121840-1-pbonzini@redhat.com> Message-ID: Subject: Re: [PATCH] KVM: x86: use again the flush argument of __link_shadow_page() From: Sean Christopherson To: Paolo Bonzini Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On Tue, May 05, 2026, Paolo Bonzini wrote: > On Mon, May 4, 2026 at 8:36=E2=80=AFPM Sean Christopherson wrote: > > An amendment to that: I thought this was just switching back to the mor= e targeted > > range-based flushed, I didn't realize you applied the version that hard= coded the > > @flush param to kvm_mmu_remote_flush_or_zap() with "true". >=20 > Yes, I was hoping to simplify stable backports a bit. Here is my > version of your comment (yes, I did try adding batched zapping to > shadow_mmu_split_huge_page() and failed): >=20 > /* > * Note: while normally KVM uses a "bool flush" return value to let > * the caller batch flushes, __link_shadow_page() flushes immediately > * immediately before populating the parent PTE with the new shadow page. > * The typical callers, direct_map() and FNAME(fetch)(), are not going > * to zap more than one large SPTE anyway. > * > * The only exception, where @flush can be false, is when a large SPTE Can we use "huge" instead of "large"? KVM has lots of references to both, = but the kernel generally uses "huge", so I've been trying to opportunistically = switch to "huge". > * is replaced with a large SPTE with a fully populated page table, I think you want "a shadow page SPTE" here? > * which can happen from shadow_mmu_split_huge_page(). In this case, > * no memory is unmapped across the change to the page tables and no > * immediate flush is needed for correctness. > * > * Even in that case, calls to kvm_mmu_commit_zap_page() are not > * batched. Doing so would require adding an invalid_list argument > * all the way down to __walk_slot_rmaps(). > */ >=20 > What do you think? Other than the nit and the goof, LGTM.