From patchwork Tue May 1 09:07:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 10373353 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 3522560327 for ; Tue, 1 May 2018 09:07:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2558D28C15 for ; Tue, 1 May 2018 09:07:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1984C28C2B; Tue, 1 May 2018 09:07:30 +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=-5.2 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham 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 78CA828C15 for ; Tue, 1 May 2018 09:07:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 234E66E2C0; Tue, 1 May 2018 09:07:28 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from fireflyinternet.com (mail.fireflyinternet.com [109.228.58.192]) by gabe.freedesktop.org (Postfix) with ESMTPS id 503E16E061; Tue, 1 May 2018 09:07:25 +0000 (UTC) X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.65.138; Received: from haswell.alporthouse.com (unverified [78.156.65.138]) by fireflyinternet.com (Firefly Internet (M1)) with ESMTP id 11553034-1500050 for multiple; Tue, 01 May 2018 10:07:19 +0100 Received: by haswell.alporthouse.com (sSMTP sendmail emulation); Tue, 01 May 2018 10:07:13 +0100 From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Tue, 1 May 2018 10:07:12 +0100 Message-Id: <20180501090712.31892-1-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.17.0 X-Originating-IP: 78.156.65.138 X-Country: code=GB country="United Kingdom" ip=78.156.65.138 Subject: [Intel-gfx] [PATCH i-g-t] igt/drv_missed_irq: Sleep in the child waiting for the parent X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: igt-dev@lists.freedesktop.org MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Our parent is RT, we are not. In theory, we should wait until our parent has gone to sleep before we are allowed to proceed (we should both be bound to the same cpu). Double down on this by sleeping in the child until our parent has written a byte along a pipe(). Signed-off-by: Chris Wilson Cc: Tvrtko Ursulin Reviewed-by: Tvrtko Ursulin --- tests/drv_missed_irq.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/drv_missed_irq.c b/tests/drv_missed_irq.c index 9326a5a62..791ee51fb 100644 --- a/tests/drv_missed_irq.c +++ b/tests/drv_missed_irq.c @@ -34,20 +34,29 @@ IGT_TEST_DESCRIPTION("Inject missed interrupts and make sure they are caught"); static void trigger_missed_interrupt(int fd, unsigned ring) { igt_spin_t *spin = __igt_spin_batch_new(fd, 0, ring, 0); + uint32_t go; + int link[2]; + + igt_assert(pipe(link) == 0); igt_fork(child, 1) { - /* We are now a low priority child on the *same* CPU as the + /* + * We are now a low priority child on the *same* CPU as the * parent. We will have to wait for our parent to sleep * (gem_sync -> i915_wait_request) before we run. */ + read(link[0], &go, sizeof(go)); igt_assert(gem_bo_busy(fd, spin->handle)); igt_spin_batch_end(spin); } + write(link[1], &go, sizeof(go)); gem_sync(fd, spin->handle); igt_waitchildren(); igt_spin_batch_free(fd, spin); + close(link[1]); + close(link[0]); } static void bind_to_cpu(int cpu)