From patchwork Fri Mar 5 11:12:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Roberts X-Patchwork-Id: 12118337 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=-11.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 94D44C433E0 for ; Fri, 5 Mar 2021 11:13:10 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F250164FF0 for ; Fri, 5 Mar 2021 11:13:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F250164FF0 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=igalia.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 39D6C6E1C0; Fri, 5 Mar 2021 11:13:09 +0000 (UTC) Received: from fanzine.igalia.com (fanzine.igalia.com [178.60.130.6]) by gabe.freedesktop.org (Postfix) with ESMTPS id F39296E1A2; Fri, 5 Mar 2021 11:13:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject:Cc:To:From; bh=JPPM5asBdLyCvpdHn1RVoZYoZUV2eOtjUgBsNTnt0Z0=; b=qe3kgIkxqtPdVo72Gu5fXnq828ubAtMRCky+8q1toSqTyIK/z0kwCXVg8rydSRr6Fd83ZhGIdTvyVNVZoeksQUGAj3RbDZFmuHqXqOkgxHAptnuvY1BVjz6uRat/BONeDncIni9Zx22TK9fEts4yeaGa9zyaeLXgLD/NFkRIr3ICaWJWP8muV8HRWTWlPMP12SIcgvrGGMg5XKjPgqXKSCOpmCycWXMWALPkZfq0MbOweHY9ERf6VD+KOsYrmIwanAGu/BjpUXCtYO68I/n1/4piVVHMdN0HjUzTg+X43SL1jf6UXle3MR4cYONY+UMVdciBtet93MOoHXN6U/A/mw==; Received: from lneuilly-657-1-8-171.w81-250.abo.wanadoo.fr ([81.250.147.171] helo=masxo.routerf36dc8.com) by fanzine.igalia.com with esmtpsa (Cipher TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim) id 1lI8OI-0008UE-4h; Fri, 05 Mar 2021 12:13:06 +0100 From: Neil Roberts To: igt-dev@lists.freedesktop.org Subject: [PATCH i-g-t 0/2] panfrost: Test accessing a purged buffer via mmap Date: Fri, 5 Mar 2021 12:12:44 +0100 Message-Id: <20210305111246.1381965-1-nroberts@igalia.com> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This adds a test for Panfrost to make sure that accessing a buffer that has been madvised and then purged causes a bus fault. It is intended to test the fix provided by this series: https://patchwork.freedesktop.org/series/87324/ The series has now been merged into drm-misc-fixes (thanks!) In order to trigger the purge, the test just tries to allocate a bunch of buffers until one of them causes the original buffer to be purged. During the review of the kernel patch series, Daniel Vetter suggested it would be better to use debugfs or vm_drop_caches file from proc. However, I noticed that there are other tests that use the same method as in this series (eg, igt_vc4_trigger_purge). Seeing as there is already a precedent for IGT tests to do this, I wonder if we could leave that as a later change for someone who is more active in Panfrost development. Neil Roberts (2): lib/panfrost: Add a utility to madvise a buffer tests/panfrost: Add a test for accessing a purged buffer lib/igt_panfrost.c | 12 ++++ lib/igt_panfrost.h | 1 + tests/meson.build | 1 + tests/panfrost_purgemap.c | 146 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 160 insertions(+) create mode 100644 tests/panfrost_purgemap.c