From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f201.google.com (mail-pg1-f201.google.com [209.85.215.201]) (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 4747022538F for ; Thu, 28 Aug 2025 21:34:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756416896; cv=none; b=pQa2US9S5OgRmt0qircwbDTVCKGOWmP/zaIHBfo00EovKIWtAqSnUGlstPD80eDT1ePQTS0tK+3sEZgjJJ5tHVKgcI2fnMMzWlJycvacpy+BCeV+N2Ez0NcVbjhLmKO3hJZ85BAxOeOOSRkOVU9wQa85Y0+cGPgICFc1hkHmVPE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756416896; c=relaxed/simple; bh=OFGxQkja66u6g4m+YfBQP4bX3XbJCT3HITESY14dQ1M=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=qVSjaZj0d84QpoP6cQpfykwUcO9gAPhRr++5g2/4GkThei3a9JKGwIhxJAbqZtVrNBmIXTit/adoj3Tw5N+dBxB7Si1DB5uyfNhZi+4U1yB4hEil2tXQkCG6Vy0i4g/a490pmYUUjDL0xX40gZ9al4qLNPe5yXwTTbe43MBOSu0= 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=XvPyhaow; arc=none smtp.client-ip=209.85.215.201 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="XvPyhaow" Received: by mail-pg1-f201.google.com with SMTP id 41be03b00d2f7-b4c746c020cso459779a12.1 for ; Thu, 28 Aug 2025 14:34:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1756416895; x=1757021695; 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=P9gMVp6DPCDPNoXotxC8KMTvooZSthv5NZJDNr83Yc0=; b=XvPyhaowVwlz7MkNQdXje+MVLV/C+WJjAkZnzn8bEgj6j+tQlaWhLadyFd9s+sqLax EWQFIO2rFVqBi33ekBrOXqswYXzHmu/Fsy3xvHzNvY5pUbQaMBRANZLC+pHJSTFObkfG RDcbnB7gTKlKcGSq/qD1FN6JCnYfAkbQg+q0iXlYanaEiOIKJvjZ940UrUs+tJXvsX8w Zd1JteVHriAwVlPbtnPNXUu0+m73ch530SWi1xfcttd/aqmtJ2/6Ts9WwYSv10XQtPUW 7o6AhiwS99pyGzrItSrmxuRCPyMpIwmGLKHNNadMGlP+C2EMmXGUqYiS+mydCvVaGDWQ b33w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756416895; x=1757021695; 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=P9gMVp6DPCDPNoXotxC8KMTvooZSthv5NZJDNr83Yc0=; b=Aapq8MBDmlkq2CQEmN6Vdi1OMcXRqGIAt1TV+cE0F/z9S3l+bjDTSbfyTUX+kNaQyO /a16Y3BfkqFsTvR15sopqBVLFAkgEUdD9CTAQwnGl7ScJ68MHCkRWVAvz01WM5SvRJO5 wRLMjMeNUVH1QKrweZPPMh42c3PKGpb4lywEoU+dKzUfFQ6TUwscEwK6TsicNbU75nTB LRJTcvJwgVxJdn0FRw19tidIp7toMeR6Rg8+Nb+MA/pvaN/OvwGjRv0LD7ESceroio3e fGoZc8HlFkCU2amvIS9i0sCRqSbowHoV4J3clBxbx6qaHg4HRCwMg1HMuGJTO57SYWn6 e/Bg== X-Forwarded-Encrypted: i=1; AJvYcCUZmJ39RKsRy3HVyAe17bVZOaREZNlok7THzSBvXzY8MBO3tfmzNLhzFl7HH3jcQ1CCheXnwMG+9Y82KlM=@vger.kernel.org X-Gm-Message-State: AOJu0YzDMVv5cL+V205bugvqJiBpeXrxo1Mkmk4YwtXX97JEwts9zZkQ 7izgsC6k6ztxb1SPvyFCcmPO4X2+LDuyctuYYvSnDUlH9uYV2HbqY+1vUy4ZfHMeL/+QO6bnZVp FpAHD7Q== X-Google-Smtp-Source: AGHT+IGi/GigvS1zrkttB799Bmjqo/nzAhrvA2gbkeJEt4vN4uB4gSmQQSwgtkWPD3wNpyUjBFNAB0mCIJQ= X-Received: from pgbs63.prod.google.com ([2002:a63:5e42:0:b0:b4c:33f8:8904]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a20:3c8f:b0:243:78a:82bd with SMTP id adf61e73a8af0-24340da245fmr37806679637.55.1756416894639; Thu, 28 Aug 2025 14:34:54 -0700 (PDT) Date: Thu, 28 Aug 2025 14:34:53 -0700 In-Reply-To: <48743e1790220072c72d45af8d3582cdd25f4083.camel@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20250827000522.4022426-1-seanjc@google.com> <20250827000522.4022426-7-seanjc@google.com> <11edfb8db22a48d2fe1c7a871f50fc07b77494d8.camel@intel.com> <9e55a0e767317d20fc45575c4ed6dafa863e1ca0.camel@intel.com> <48743e1790220072c72d45af8d3582cdd25f4083.camel@intel.com> Message-ID: Subject: Re: [RFC PATCH 06/12] KVM: TDX: Return -EIO, not -EINVAL, on a KVM_BUG_ON() condition From: Sean Christopherson To: Rick P Edgecombe Cc: "kvm@vger.kernel.org" , "pbonzini@redhat.com" , Vishal Annapurve , "linux-kernel@vger.kernel.org" , Yan Y Zhao , "michael.roth@amd.com" , Ira Weiny Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On Thu, Aug 28, 2025, Rick P Edgecombe wrote: > On Thu, 2025-08-28 at 14:00 -0700, Sean Christopherson wrote: > > But that's not actually what the code does.=C2=A0 The lockdep assert wo= n't trip because > > KVM never removes S-EPT entries under read-lock: >=20 > Right >=20 > >=20 > > if (is_mirror_sp(sp)) { > > KVM_BUG_ON(shared, kvm); > > remove_external_spte(kvm, gfn, old_spte, level); > > } > >=20 > > Not because KVM actually guarantees -EBUSY is avoided.=C2=A0 So the cur= rent code is > > flawed, it just doesn't cause problems. >=20 > Flawed, as in the lockdep should assert regardless of EBUSY? Yep, exactly. > Seems good to me. > Probably if we wanted to try to call tdx_sept_remove_private_spte() under= read > lock with special plans to avoid EBUSY we should think twice anyway. Heh, add a few zeros to "twice" :-D