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 55D924779A4 for ; Thu, 30 Apr 2026 18:35:35 +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=1777574136; cv=none; b=dHShB3Tc/kAjp7DXswDpWOksXVv1e+Q0bS8pidfBdaCIOiXwNiUZOb/I7vpcTBeREgSKpDElPZitcD72IwpXNo/9iSTPr8s+yDEJfRz+R9qA4TWF256ZnOFGVhHWMGxK8vDXF1gDiVWpcCO6s4tOvslG3VsgLzAXL5GoLad/cvE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777574136; c=relaxed/simple; bh=Y4KkG8qoKDnLhDQotmibI9+qqH27W+yFT92Z7qXiYu8=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=ek0NooCuhFdTCY5cRBtV76tY4zwpsYQIdzWos643w0S6WEP8fzGRyH4NcUgj7FGJzLEYg9LaOOsyxdf1UpUnSJOj+DVI+UViFqAoMHLkTQZ16KzbU4brS5OWPQULv2+mv13+moMLuPBL62Mn1jsGd9jlsLhNy/WjbDGIT/RyBRo= 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=LUR1JbLO; 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="LUR1JbLO" Received: by mail-pj1-f73.google.com with SMTP id 98e67ed59e1d1-35e56ed5d5bso2408994a91.0 for ; Thu, 30 Apr 2026 11:35:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1777574135; x=1778178935; 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=W6bC288Bn/GClBvvz+4xeWuMAamNmEszwFvQibk9bYA=; b=LUR1JbLOeG8tvGJp612a+2yQRY4m+wu82yK+6bJCCxjPrR3DriA22YNeXu6ZFPqp3V SjhEznYtC10XVACEtDCtXaW7MpIaa04ImbL9xPjsgVLqjVKYugXQtZOqXwTY4u0siher zybFvIecDbqfJCMlNfM54HMdsNHYpfrC3zycVaw2aVEyQPDK6PTARVUBx/iEa4M7cUcO e1Ojzjev/0/ZI7SUsVtmWkxcRJtjYqI3C4hiclZma9phm2BpJ1M3XBdKcqC4WccLBwU5 mKRC4pfwPr4KXCpwXXtMeeCjguAbl50W0vB6RCCsKd4ewJs+CAxTaPDIvVxMVqU2+P58 80Tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777574135; x=1778178935; 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=W6bC288Bn/GClBvvz+4xeWuMAamNmEszwFvQibk9bYA=; b=OgRXDaf+9tzXk4MrDyshNJ7Nzjl+OSIr8ZdfvmMbwTve8jmp6oQrh8nDIV3NdYLSFF 5HEaYWIP5RJ2Qt4RCYRAi230SWFVDQOOThN1i9He1vHRTc8Xv2xc32FxRwBEX/sZ9xOP kbAEO6BaoMs6MfnUZ4+A/lVc+PYGdGKDcS+5e4ibyEhd+KqCBqkz1AaJv3dBIdfQann4 djNCV5EVB2zlZU4im2RrRnxm2o9/57Z9Q7pdi99rel865zmPQb8pWA38UbkO5xVr6Lf2 yGE1yI7Qj1ksMcdrhBsmZCV4RDklwlnsXlRifhWYoazsQrKycMkRFD8jyAGKGMd7mw+5 vQJg== X-Gm-Message-State: AOJu0YwNcS8qsiKQcKuEMs/Meim33eFsZOwFsZFx7Jz6VdFEdhlpM9Fd HArcNJ4j7Ygi2RIDpApA8Z+Od8hK1y+QWK9+TTY/CBmFM1IvgORmJf0tAAWSvWYvLR87IQJLO7v RzVTe0g== X-Received: from pgcy19.prod.google.com ([2002:a63:7d13:0:b0:c79:7778:c050]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a21:3396:b0:3a2:e8f1:b862 with SMTP id adf61e73a8af0-3a3d20ade27mr3957789637.23.1777574134522; Thu, 30 Apr 2026 11:35:34 -0700 (PDT) Date: Thu, 30 Apr 2026 11:35:32 -0700 In-Reply-To: <20260430150747.76749-9-pbonzini@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260430150747.76749-1-pbonzini@redhat.com> <20260430150747.76749-9-pbonzini@redhat.com> Message-ID: Subject: Re: [PATCH 08/28] KVM: x86/mmu: separate more EPT/non-EPT permission_fault() From: Sean Christopherson To: Paolo Bonzini Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, d.riley@proxmox.com, jon@nutanix.com Content-Type: text/plain; charset="us-ascii" On Thu, Apr 30, 2026, Paolo Bonzini wrote: > - if (!ept) { > + if (ept) { > + rf = (pfec & PFERR_USER_MASK) ? (u8)~u : 0; > + ff = (pfec & PFERR_FETCH_MASK) ? (u16)~x : 0; > + } else { > /* Faults from kernel mode accesses to user pages */ > u8 kf = (pfec & PFERR_USER_MASK) ? 0 : u; > > - /* Not really needed: !nx will cause pte.nx to fault */ > - if (!efer_nx) > - ff = 0; > + uf = (pfec & PFERR_USER_MASK) ? (u8)~u : 0; > + > + if (efer_nx) > + ff = (pfec & PFERR_FETCH_MASK) ? (u16)~x : 0; Uber nit, probably makes sense to do: ff |= (pfec & PFERR_FETCH_MASK) ? (u16)~x : 0; so that the ordering between efer_nx and cr4_smep doesn't matter. If you end up doing fixup, this patch really should use (u8) instead (u16), and then convert everything in "KVM: x86/mmu: introduce ACC_READ_MASK". Doesn't impact functionality, but it looks odd. > /* Allow supervisor writes if !cr0.wp */ > if (!cr0_wp)