From patchwork Mon Apr 12 08:00:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Zijlstra X-Patchwork-Id: 12197103 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 070A6C433B4 for ; Mon, 12 Apr 2021 08:09:19 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A061B61220 for ; Mon, 12 Apr 2021 08:09:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A061B61220 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 4C0A76B0071; Mon, 12 Apr 2021 04:09:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4466D6B007B; Mon, 12 Apr 2021 04:09:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 074486B0075; Mon, 12 Apr 2021 04:09:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0228.hostedemail.com [216.40.44.228]) by kanga.kvack.org (Postfix) with ESMTP id C96AB6B0072 for ; Mon, 12 Apr 2021 04:09:03 -0400 (EDT) Received: from smtpin31.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 9EEB7180ACC34 for ; Mon, 12 Apr 2021 08:09:03 +0000 (UTC) X-FDA: 78022989366.31.9B00C3B Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf15.hostedemail.com (Postfix) with ESMTP id DDCA9A0003A5 for ; Mon, 12 Apr 2021 08:09:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Type:MIME-Version:References: Subject:Cc:To:From:Date:Message-ID:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:In-Reply-To; bh=a6+zHHfrmNSjnuKpDcqXJsViLAaAf+vjd+fWHfxBxIo=; b=iwOjMpKKyzAFrBidkEKF+HSfqn BEsev2o8dOMHA2L1zmtC0v0cDfJ9HOjS5jFS4yuc956dZDcciHG8tfQQIdUNVgs7p31HLXh2UhGNb B3pps3OSkNrQ0HcW5nYzgeNDld2ah1kqbkiuJ1h0vNhDTI5TWwqoLKZ2RqEASFl4cPUljMZmb3GsD g1TBPdomVhvxlaQ6egk0eFTeeLhj14kQf1qdm6o2RwJeQVQIaTYV9PKUEaCadfElKLH2icgOF5WJP z7DRDA90J2bbDAAvPJxdlj96pnVRijnEVnxDLiHHVH9OY+cb7Rv+EUFDV6mS/XDbyT8+lMqgPpz5c HKg0/Oog==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1lVrcl-003yd9-Fg; Mon, 12 Apr 2021 08:08:49 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id E3D6830026E; Mon, 12 Apr 2021 10:08:45 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 0) id 4B56525F21533; Mon, 12 Apr 2021 10:08:44 +0200 (CEST) Message-ID: <20210412080611.902470568@infradead.org> User-Agent: quilt/0.66 Date: Mon, 12 Apr 2021 10:00:18 +0200 From: Peter Zijlstra To: akpm@linux-foundation.org Cc: linux-kernel@vger.kernel.org, peterz@infradead.org, boris.ostrovsky@oracle.com, jgross@suse.com, sstabellini@kernel.org, x86@kernel.org, jani.nikula@linux.intel.com, joonas.lahtinen@linux.intel.com, rodrigo.vivi@intel.com, chris@chris-wilson.co.uk, intel-gfx@lists.freedesktop.org, linux-mm@kvack.org, keescook@chromium.org, hch@lst.de Subject: [PATCH 6/7] i915: Convert to verify_page_range() References: <20210412080012.357146277@infradead.org> MIME-Version: 1.0 X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: DDCA9A0003A5 X-Stat-Signature: 7hswy66hxdow37i6f1z9utys8pjwpnub Received-SPF: none (infradead.org>: No applicable sender policy available) receiver=imf15; identity=mailfrom; envelope-from=""; helo=casper.infradead.org; client-ip=90.155.50.34 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1618214941-930056 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: check_{present,absent}() only need R/O access, use verify_page_range() instead to remove modular use of apply_to_page_range(). Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Christoph Hellwig --- drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) --- a/drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c +++ b/drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c @@ -1225,9 +1225,9 @@ static int igt_mmap_gpu(void *arg) return 0; } -static int check_present_pte(pte_t *pte, unsigned long addr, void *data) +static int check_present_pte(pte_t pte, unsigned long addr, void *data) { - if (!pte_present(*pte) || pte_none(*pte)) { + if (!pte_present(pte) || pte_none(pte)) { pr_err("missing PTE:%lx\n", (addr - (unsigned long)data) >> PAGE_SHIFT); return -EINVAL; @@ -1236,9 +1236,9 @@ static int check_present_pte(pte_t *pte, return 0; } -static int check_absent_pte(pte_t *pte, unsigned long addr, void *data) +static int check_absent_pte(pte_t pte, unsigned long addr, void *data) { - if (pte_present(*pte) && !pte_none(*pte)) { + if (pte_present(pte) && !pte_none(pte)) { pr_err("present PTE:%lx; expected to be revoked\n", (addr - (unsigned long)data) >> PAGE_SHIFT); return -EINVAL; @@ -1249,14 +1249,14 @@ static int check_absent_pte(pte_t *pte, static int check_present(unsigned long addr, unsigned long len) { - return apply_to_page_range(current->mm, addr, len, - check_present_pte, (void *)addr); + return verify_page_range(current->mm, addr, len, + check_present_pte, (void *)addr); } static int check_absent(unsigned long addr, unsigned long len) { - return apply_to_page_range(current->mm, addr, len, - check_absent_pte, (void *)addr); + return verify_page_range(current->mm, addr, len, + check_absent_pte, (void *)addr); } static int prefault_range(u64 start, u64 len)