From patchwork Thu Nov 2 14:15:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mika Kuoppala X-Patchwork-Id: 10038785 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 214C760291 for ; Thu, 2 Nov 2017 14:16:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A399C2861C for ; Thu, 2 Nov 2017 14:16:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 98D1A29067; Thu, 2 Nov 2017 14:16:19 +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=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 34F642861C for ; Thu, 2 Nov 2017 14:16:18 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6FAE289CD7; Thu, 2 Nov 2017 14:16:18 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6CC0A89CD7 for ; Thu, 2 Nov 2017 14:16:17 +0000 (UTC) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Nov 2017 07:16:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,334,1505804400"; d="scan'208";a="916721085" Received: from gaia.fi.intel.com ([10.237.72.169]) by FMSMGA003.fm.intel.com with ESMTP; 02 Nov 2017 07:16:12 -0700 Received: by gaia.fi.intel.com (Postfix, from userid 1000) id 699FD5C0506; Thu, 2 Nov 2017 16:15:20 +0200 (EET) From: Mika Kuoppala To: Chris Wilson , intel-gfx@lists.freedesktop.org In-Reply-To: <87k1z8epjk.fsf@gaia.fi.intel.com> References: <20171031152734.11016-1-mika.kuoppala@linux.intel.com> <150946451203.15081.4171110727087971223@mail.alporthouse.com> <87tvyddkyh.fsf@gaia.fi.intel.com> <150962023535.6111.16107320198630602470@mail.alporthouse.com> <87k1z8epjk.fsf@gaia.fi.intel.com> Date: Thu, 02 Nov 2017 16:15:20 +0200 Message-ID: <87h8ucephj.fsf@gaia.fi.intel.com> MIME-Version: 1.0 Subject: Re: [Intel-gfx] [PATCH 1/2] drm/i915: Introduce execlist_port_* accessors 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: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Mika Kuoppala writes: > Chris Wilson writes: > >> Quoting Mika Kuoppala (2017-11-02 10:38:30) >>> Chris Wilson writes: >>> >>> > Quoting Mika Kuoppala (2017-10-31 15:27:33) >>> >> +static inline struct execlist_port * >>> >> +execlists_port_next(struct intel_engine_execlists * const execlists, >>> >> + const struct execlist_port * const port) >>> >> +{ >>> >> + const unsigned int n = __port_add(port_index(port, execlists), >>> >> + 1, >>> >> + execlists->port_mask); >>> > >>> > How does this compare to >>> > >>> > if (port++ == execlists->port + execlists->port_mask) >>> > port = execlists->port; >>> > >>> > return port; >>> > ? >>> >>> add/remove: 0/0 grow/shrink: 1/1 up/down: 29/-29 (0) >>> function old new delta >>> i915_guc_irq_handler 2584 2613 +29 >>> intel_lrc_irq_handler 2963 2934 -29 >>> Total: Before=1123627, After=1123627, chg +0.00% >> >> Hmm, your functions saw little difference and are twice as big as >> mine... Weird. >> >> I used gcc version 6.3.0 20170516 (Debian 6.3.0-18) with defconfig. >> Yourself? > > I had debugs on, sigh... > > Now with the defconfig and gcc (Ubuntu 6.3.0-12ubuntu2) 6.3.0 20170406: > > add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-139 (-139) > function old new delta > i915_guc_irq_handler 1620 1617 -3 > intel_lrc_irq_handler 1926 1790 -136 > > So we have a clear winner. > And to be precise on what diff lead to above: > -Mika diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h index 387667fe50d3..9131d66fb628 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.h +++ b/drivers/gpu/drm/i915/intel_ringbuffer.h @@ -599,12 +599,12 @@ execlists_port_tail(struct intel_engine_execlists * const execlists) static inline struct execlist_port * execlists_port_next(struct intel_engine_execlists * const execlists, - const struct execlist_port * const port) + struct execlist_port *port) { - const unsigned int n = __port_add(port_index(port, execlists), - 1, - execlists->port_mask); - return &execlists->port[n]; + if (port++ == execlists->port + execlists->port_mask) + port = execlists->port; + + return port; }