Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp8424468rwp; Wed, 19 Jul 2023 09:33:49 -0700 (PDT) X-Google-Smtp-Source: APBJJlFA5bjXVlzhayp2P2O4NO0NoZEVMhT0JRUhGlCH9zERBSOZcAP1guk6u2NKrPervUGAumew X-Received: by 2002:a05:6a20:7486:b0:132:f926:5891 with SMTP id p6-20020a056a20748600b00132f9265891mr3277944pzd.4.1689784429128; Wed, 19 Jul 2023 09:33:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689784429; cv=none; d=google.com; s=arc-20160816; b=Izj/vFIIiee1UadHbhW7W6Gj/kpndnU971CCxKa7V7e0GsQQaJU8tfLxBrueBYVGpv eK6huwdcMy8n0U6+VZBnucRNGWnGWWFcSsT+NQ9pC0fk7zSyZ29c4XT1yHVfj+4VG/xc 48UhKPxzeOVmN5AGvzAzZl3iI4hLnc/MIPONWe3mXlINdV6wsyQjOv+0g+NaYCsZGo3p dL3u1psXd13ncYIZOFQkUyHojKX3rh5Cv0wSjegiuGAz3XKGKKGvf9imonHQF6xKsIQQ qb26r3GW6u1srNHB/c9H6DJTPupNM7IU8PEnH959wX8AaX4KvKn63kxuN9jNGs8ZqlBY 8UWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=3uTGEOgXGgjS1mpy4uY8Zn88ggwsAyaWY3/MU5WFUXU=; fh=WvmZEGyPoM0nTGmU/Yy8UGy99rvp+8GBqhiaivVZpR8=; b=VBQb5F9ySBoLWKOGdLF7BFeAFHz663XVxcNz+qltV0rS2HRsT7RCjLDNhfLrVru6gK psduWBZSv2IrtcAfu/cnjxt12T0PPohJt6nI20tAsLGR7XVZWWX77FguF7Srvvt1BIyQ 5Ur3B4X2Oet2sgIb2GHGfZXAQxaiV04N3GC6zv5RgyXMnktcO7kJ8MH1HdUugH4CUWnW Bq1/tAUUYm+lEzPsY1psK6ldXNs7hK2cTn/5WUNGbj1UxHf/g/mJweLG3ZZi/gySb79v LYJlIzbIazz447GgGZQ5ax6usf7bsvy128GDqOjCisPJXuNYAekypnTENg5p3O74pY7Z 2JKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=zuZWZV29; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cu7-20020a056a00448700b00674689bacf2si3513013pfb.405.2023.07.19.09.33.32; Wed, 19 Jul 2023 09:33:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=zuZWZV29; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231896AbjGSPjZ (ORCPT + 99 others); Wed, 19 Jul 2023 11:39:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230268AbjGSPjX (ORCPT ); Wed, 19 Jul 2023 11:39:23 -0400 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9AC672106 for ; Wed, 19 Jul 2023 08:39:11 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-ceabb7e8afdso1694942276.3 for ; Wed, 19 Jul 2023 08:39:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1689781150; x=1692373150; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=3uTGEOgXGgjS1mpy4uY8Zn88ggwsAyaWY3/MU5WFUXU=; b=zuZWZV29hv7HoMETiCkSKGIHZcpHTMG8TKF9qduMPPS/E1c0SfFLVA6kGEOoP5U9qq U77CuEsLMMxKIxLMFnjtp2hpB+IIMkYXVFGsPC5bapP3nIk/nGTrjqlCGcZf5+xPpr8T q16/aDqhEkgnoKMdGaA5rz+Gt+5uK6D6P1fr5Zm7R4i7YF7l973NWOrr+c3kq7IzyS9M gLZmugAwtecTQMKF7z0UBcPf86RbNReN6ZSKfaBS2Zp8N7kJnMwhsDMUzBHIndlxccW1 lnFRHUcOrryTZsXwruMmKL2jJUIvic1/Jzr/kaZBJYZOlvirf0tEwgFNXnc0yrJBGF6s gFpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689781150; x=1692373150; 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=3uTGEOgXGgjS1mpy4uY8Zn88ggwsAyaWY3/MU5WFUXU=; b=S2TKeHAGZoCpYhP9ue1AcZskiT46QmDWEe3jRDMT0KOnlS6ANvSVXDsvE6GbuWLMUp OjJ7FMqilMAtCIhQPAHOG/bSLp7Zu4Tu18T0PlVgzUN4b5z7VBZhEU3djnFkR135ZXwI QRVx9X1T0tjFTHNL5UjJRWzL/8sEZj6mUXAJnbolw1OEYCNWL47AWnpgBlyuLSg9RoL3 jb3cbVhdgkCQ8IsJTaBza2t8ac1F4ui8U5iRIMA5PYPjrCNNPV6F7CpMpidheNiDGH6i ZEJaE3rMD25+y1iFLXYSlVM1x6TmincM8Fts2QdY0hyPrqRDl6AWBbHTgtj4JtHCj+Ea uiOw== X-Gm-Message-State: ABy/qLYeLtIdkiWN9ofp8vfGyZoCcquUws4YK/q8dF2+UaRaploMNuEF 5+6PziJCmTrC9HEVxbWvxophZ12csqU= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a25:868b:0:b0:c4d:9831:9712 with SMTP id z11-20020a25868b000000b00c4d98319712mr26898ybk.0.1689781150625; Wed, 19 Jul 2023 08:39:10 -0700 (PDT) Date: Wed, 19 Jul 2023 08:39:09 -0700 In-Reply-To: Mime-Version: 1.0 References: <20230718234512.1690985-1-seanjc@google.com> <20230718234512.1690985-2-seanjc@google.com> Message-ID: Subject: Re: [RFC PATCH v11 01/29] KVM: Wrap kvm_gfn_range.pte in a per-action union From: Sean Christopherson To: Jarkko Sakkinen Cc: Paolo Bonzini , Marc Zyngier , Oliver Upton , Huacai Chen , Michael Ellerman , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , "Matthew Wilcox (Oracle)" , Andrew Morton , Paul Moore , James Morris , "Serge E. Hallyn" , kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, Chao Peng , Fuad Tabba , Yu Zhang , Vishal Annapurve , Ackerley Tng , Maciej Szmigiero , Vlastimil Babka , David Hildenbrand , Quentin Perret , Michael Roth , Wang , Liam Merwick , Isaku Yamahata , "Kirill A . Shutemov" Content-Type: text/plain; charset="us-ascii" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 19, 2023, Jarkko Sakkinen wrote: > On Wed Jul 19, 2023 at 2:44 AM EEST, Sean Christopherson wrote: > > /* Huge pages aren't expected to be modified without first being zapped. */ > > - WARN_ON(pte_huge(range->pte) || range->start + 1 != range->end); > > + WARN_ON(pte_huge(range->arg.pte) || range->start + 1 != range->end); > > Not familiar with this code. Just checking whether whether instead > pr_{warn,err}() The "full" WARN is desirable, this is effecitvely an assert on the contract between the primary MMU, generic KVM code, and x86's TDP MMU. The .change_pte() mmu_notifier callback doesn't allow for hugepages, i.e. it's a (likely fatal) kernel bug if a hugepage is encountered at this point. Ditto for the "start + 1 == end" check, if that fails then generic KVM likely has a fatal bug. > combined with return false would be a more graceful option? The return value communicates whether or not a TLB flush is needed, not whether or not the operation was successful, i.e. there is no way to cancel the unexpected PTE change.