Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp905355rwd; Thu, 18 May 2023 05:40:47 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4BTpq1We2cGbkZdFMlaAlGQUGlqltvwVYu2B8o2QaOq/EpwoRzGMIxJdMqOxIol3H0bD/7 X-Received: by 2002:a05:6a00:ac9:b0:63b:1708:10aa with SMTP id c9-20020a056a000ac900b0063b170810aamr4570085pfl.34.1684413647551; Thu, 18 May 2023 05:40:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684413647; cv=none; d=google.com; s=arc-20160816; b=nSRAcyAW+apFyK1e45L4BuUun8dpmCYN6IHnKJOpXcvDJ5fzI4MAfomiOUToiYO2Xi XUcNjyDJ28/nqdw2jxEp51Xj0uGdpQDdhXE/Rgt0R5Amrd9pAzbomni+Hi89rk8awEmy sB81hIdf1mTQ9NC1FfrpP9U5daBIffGm0vZdEadKw65aNE7nLYBpiQDg0ki7s/qiyEm8 45yXCTDio3vBTPSiLPjhuuoEvJxqoF78uqufRvpuogJTJi/z6shbywSHyMNYcYUEGcGu aJiH5qT7OHE56xJriQt64XX4GLDCLMaMKzdsc4XmERpKxIwavYOueoL9lRAiypdeKKs2 UU7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=vlSicM60M4dOjJmxLJdTJyVXpqMpmrkkdEYFA1QkhPE=; b=xu5C9E1DEtQkdGaFUWw8EqkxRZ5MRTiC90Jl9dpKK1yOhy8RKyZGHEQHPoSVfDzSN1 tOCTKH8YGKk4TsRecpPtj55apgHKGRDVjPGKuHaRXsVHAFXuPo5kAuTmO59TxPoGbL7Y kZjnNHLj5qXG7u/8DfuFCO0yFzitlEZBqxlrJwx7U0/w6d9PRhJ+qa16N0d8Bl0jKp/E p6WTU5b38UqJZT9ZQj/ePOTSBRwqMyAQw18gal9l0IDEHjpnTBIuPKIX3ngymxVQ93Nc StT8bUKZpGfTidzuGWP/xRc+xswsYv+9Vs9W++S/7oCzNM8MCCass1GA04bPeSn3rTha C/NA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=jXhbGwJY; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a29-20020aa7971d000000b0063b8935bcbasi1507897pfg.310.2023.05.18.05.40.35; Thu, 18 May 2023 05:40:47 -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=@ziepe.ca header.s=google header.b=jXhbGwJY; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230507AbjERMIV (ORCPT + 99 others); Thu, 18 May 2023 08:08:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229726AbjERMIU (ORCPT ); Thu, 18 May 2023 08:08:20 -0400 Received: from mail-qv1-xf35.google.com (mail-qv1-xf35.google.com [IPv6:2607:f8b0:4864:20::f35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D49B10A for ; Thu, 18 May 2023 05:08:19 -0700 (PDT) Received: by mail-qv1-xf35.google.com with SMTP id 6a1803df08f44-61b58779b93so17565956d6.0 for ; Thu, 18 May 2023 05:08:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1684411698; x=1687003698; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=vlSicM60M4dOjJmxLJdTJyVXpqMpmrkkdEYFA1QkhPE=; b=jXhbGwJYk+ucvKbOBXk9WSgeJcL3XBMB2oa3nevNUqtzUVeZ8g0iTX2cviMuUPVK95 BQihpwuuJEweV2yyrM4IL8PBMZvQBL0c3xq2CZieXROU8/pAIGkzt7Du9V84OKSqWVa2 Fmaup6LyQllNdQhTLl6BDsdSt4uKUWNmqAZYSGgsy0Ig9WrRRVwSYBI2WdO+rbDcX6dP ZHDkZsrwBLEfGkdL77B/DNN8d0hrQ0AB06V2qRbzdl6gVkrx1QZ9lhG4j5FVzlai9Vdo CwWrJuIH+r4avhI/j4oqn22bBWtZGlopVE5yl+AqPepXDxbBFyz4orMZqXgaamG+erIA Wopg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684411698; x=1687003698; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=vlSicM60M4dOjJmxLJdTJyVXpqMpmrkkdEYFA1QkhPE=; b=QGpMXW6YIBgncn0LnY1YsB3LNLvGAcSwy40O06CcNwtWKmvO3NdWJ0aqhn8XzI2VOZ c9C4+/70iwzARBEXCm04Vs02jznDr/jI4A2mT7/Dtsife+uxyAjjKIqP5kJld0KkevfQ nyALpmtoSihCP10BiqF0AGjZk+2LymYl12sWefOaMgQiK12eucd6DwwREjXvNhVBiMsR 5+hOjQZVneC0BrsVrKWK7L+6pjkBImvjezcYwYjAsH2BFRF5onWiJN7nszATprF4v2yp CFCVLE21rryVsisPg7EpPv+UReThlMK4IWKQr9twV3cAndMscbcNYMmvVciZIRmHiKOW AR/g== X-Gm-Message-State: AC+VfDxFwQBp+fcLmV1LVCaF2MsPsIFqqVrtgHJ5MDEJBd0YA6dXq1P9 0hwBbFAMaP5OZ8dVS9t778XHHw== X-Received: by 2002:a05:6214:5296:b0:5c1:fa35:fe6 with SMTP id kj22-20020a056214529600b005c1fa350fe6mr5510734qvb.24.1684411698376; Thu, 18 May 2023 05:08:18 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-142-68-25-194.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.68.25.194]) by smtp.gmail.com with ESMTPSA id jy17-20020a0562142b5100b0061b2a2f949bsm469563qvb.61.2023.05.18.05.08.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 May 2023 05:08:17 -0700 (PDT) Received: from jgg by wakko with local (Exim 4.95) (envelope-from ) id 1pzcQa-0055S6-P5; Thu, 18 May 2023 09:08:16 -0300 Date: Thu, 18 May 2023 09:08:16 -0300 From: Jason Gunthorpe To: Ryan Roberts Cc: Andrew Morton , SeongJae Park , Christoph Hellwig , "Matthew Wilcox (Oracle)" , "Kirill A. Shutemov" , Lorenzo Stoakes , Uladzislau Rezki , Zi Yan , linux-kernel@vger.kernel.org, linux-mm@kvack.org, damon@lists.linux.dev, kernel test robot Subject: Re: [PATCH v2 5/5] mm: ptep_deref() conversion Message-ID: References: <20230518110727.2106156-1-ryan.roberts@arm.com> <20230518110727.2106156-6-ryan.roberts@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230518110727.2106156-6-ryan.roberts@arm.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 Thu, May 18, 2023 at 12:07:27PM +0100, Ryan Roberts wrote: > diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c > index 3d4dd9420c30..5680542f744f 100644 > --- a/drivers/vfio/vfio_iommu_type1.c > +++ b/drivers/vfio/vfio_iommu_type1.c > @@ -514,6 +514,7 @@ static int follow_fault_pfn(struct vm_area_struct *vma, struct mm_struct *mm, > bool write_fault) > { > pte_t *ptep; > + pte_t pte; > spinlock_t *ptl; > int ret; > > @@ -536,10 +537,12 @@ static int follow_fault_pfn(struct vm_area_struct *vma, struct mm_struct *mm, > return ret; > } > > - if (write_fault && !pte_write(*ptep)) > + pte = ptep_deref(ptep); > + > + if (write_fault && !pte_write(pte)) > ret = -EFAULT; > else > - *pfn = pte_pfn(*ptep); > + *pfn = pte_pfn(pte); > > pte_unmap_unlock(ptep, ptl); > return ret; This hunk looks Ok Reviewed-by: Jason Gunthorpe Jason