From patchwork Mon Mar 20 09:40:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 9633575 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CEAFF6020B for ; Mon, 20 Mar 2017 09:45:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C79E427F9F for ; Mon, 20 Mar 2017 09:45:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BC39A27FAE; Mon, 20 Mar 2017 09:45:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7FBFC27F9F for ; Mon, 20 Mar 2017 09:45:46 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4B08E6E51D; Mon, 20 Mar 2017 09:45:45 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.134]) by gabe.freedesktop.org (Postfix) with ESMTPS id B3D5B6E512; Mon, 20 Mar 2017 09:45:43 +0000 (UTC) Received: from wuerfel.lan ([78.42.17.5]) by mrelayeu.kundenserver.de (mreue005 [212.227.15.129]) with ESMTPA (Nemesis) id 0M3OHE-1bz2D83Z9U-00r1B4; Mon, 20 Mar 2017 10:45:34 +0100 From: Arnd Bergmann To: Daniel Vetter , Jani Nikula , David Airlie Date: Mon, 20 Mar 2017 10:40:28 +0100 Message-Id: <20170320094335.1266306-2-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170320094335.1266306-1-arnd@arndb.de> References: <20170320094335.1266306-1-arnd@arndb.de> X-Provags-ID: V03:K0:wsoikxTm87AF/C8rVdtvESX5vSn/8xiE1+M8UQMCT1p78fE7GGA 5mkqbeA13eFlD3wA47gBnnsxBUhqI8GTtrW2SxR00jMyRE2hsH/EQNuD62L8DDu4umFQqUm nHX8oLPEw1GLHr5KanTAYY/Dsz7T3vGIkVp7TyegWqI3oxKxDt93PPh134TzUc4zrNlb3+K 8bcRFC5LLVu2S65RIB4eQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:dcCinznIWnA=:SYoQiVnCH/iZ9ErJZxmBMW CwJhvs54NkG1V1NhI8YKDoRM+4b3KHxOABeo/dk7cygICdvQBvPTtpYgKlh9c5dNuJBLnALcy SFmxTGgtspX4pQrtTv7DZbLfS/Unf9qMf/rSfZ63KDOOmRbyrOeBFCET0V9EmGg457PhfAnDV eiRwD2mdugLVTH/kUH8E2AtwDrHT9bu1DRSo6JM6PjWSFtXfZ/OUgAP+BpTdDxKWFzMBbKr1i 8sSuXrwV7utN6FTSiJxDq0+tfkL1wkxfVSwIr6OugslfRwZqtlVeCtKPpOy9osw1kIpEDErSS mWlTkbqr9t2TYJrBlvnJYJ0TbH5v61Au8bfUbYDRDGF4bug4bLM6H20JnOPL/4QWqGLNj3qtL /KAZ/gjRzGvDpQe7C0U4S4z0H/Mdf/X2+B3EanVCMH6KjdLOKF7PLs8V4+8Rack1QZi7kQb8h QqPovjCziAqaI+gYzZEeT9aaGYK5c7TEib6YAjlNw5pnm6E0c2AKs/1Hmmht6QbrHC/qckE6u SoNIilSA809iNummwKzP4hxRRy8wjL9q41PCfdr7PP3FBmj6g03q4FvZz+wOHlgU/o9Ood3Li ARHLFOImgVVQd4Iw7YF5bXgXa/w2Ksz3Mc0q7Rbrj/PkrYz6IJO5JnD/DhfuI5laVGDlEnAz5 Fpc7BgA3jBssuYv4HInAGiO3xoD057ZtpRqzZdJW3f6YyvFCZ/xqJ8zqkDpSIvAY5/DQ= Cc: Arnd Bergmann , intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: [Intel-gfx] [PATCH 2/3] drm/i915: split out check for noncontiguous pfn range X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP We get a warning with gcc-7 about a pointless comparison when using a linear memmap: drivers/gpu/drm/i915/selftests/scatterlist.c: In function 'alloc_table': drivers/gpu/drm/i915/selftests/scatterlist.c:219:66: error: self-comparison always evaluates to false [-Werror=tautological-compare] Splitting out the comparison into a separate function avoids the warning and makes it slightly more obvious what happens. Fixes: 935a2f776aa5 ("drm/i915: Add some selftests for sg_table manipulation") Signed-off-by: Arnd Bergmann Reviewed-by: Chris Wilson --- drivers/gpu/drm/i915/selftests/scatterlist.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/selftests/scatterlist.c b/drivers/gpu/drm/i915/selftests/scatterlist.c index eb2cda8e2b9f..c072b0f9180b 100644 --- a/drivers/gpu/drm/i915/selftests/scatterlist.c +++ b/drivers/gpu/drm/i915/selftests/scatterlist.c @@ -189,6 +189,11 @@ static unsigned int random(unsigned long n, return 1 + (prandom_u32_state(rnd) % 1024); } +static inline bool page_contiguous(struct page *first, struct page *last, unsigned long npages) +{ + return first + npages == last; +} + static int alloc_table(struct pfn_table *pt, unsigned long count, unsigned long max, npages_fn_t npages_fn, @@ -216,7 +221,8 @@ static int alloc_table(struct pfn_table *pt, unsigned long npages = npages_fn(n, count, rnd); /* Nobody expects the Sparse Memmap! */ - if (pfn_to_page(pfn + npages) != pfn_to_page(pfn) + npages) { + if (!page_contiguous(pfn_to_page(pfn), + pfn_to_page(pfn + npages), npages)) { sg_free_table(&pt->st); return -ENOSPC; }