From mboxrd@z Thu Jan 1 00:00:00 1970 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=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no 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 B2409C433DB for ; Wed, 24 Mar 2021 08:48:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 817A1619F3 for ; Wed, 24 Mar 2021 08:48:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234448AbhCXIrf (ORCPT ); Wed, 24 Mar 2021 04:47:35 -0400 Received: from mail-ua1-f46.google.com ([209.85.222.46]:39693 "EHLO mail-ua1-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234385AbhCXIr2 (ORCPT ); Wed, 24 Mar 2021 04:47:28 -0400 Received: by mail-ua1-f46.google.com with SMTP id x8so7598808ual.6 for ; Wed, 24 Mar 2021 01:47:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=FX4YhcRrTtOWfNjjlu3aaCWI7W5SveqcMlD13s6eqt4=; b=BKzrPJdw6upniCqgfW7/15IR8WjOx2q3GHhWaNb78TgI8uSEkXrUK4hhCXqfjJJHL4 UJiVmF0RW5TWRty2BUTLHMyLQZPzwZTd93ztmwFLVANuufbngPMnlcIDXl8pyK86cAtD 4zJKBu5539qoPQyGIk0xHRs7wmFsRa60TC9FD9IMoy1rsXRGc1ysjuJUACvImxylDfEi xrLw4mmBY7BjalAF3uVr5tqoBn5/I3eJINR5bGZpQZ+oL1VyrMytq4+bIEldecUW9CDO iqC4rGndxblLYGzLRFSc9c53V7A3luUkh5JBkcuedF8e59KeGeyfubV9SzT2QaI7QvsV Ec9w== X-Gm-Message-State: AOAM532l/UVWzszq5bv4v+BZW+TJclibtZ+qb7wyyTvCK/2NqRlyOx2T fdJPnlfN2tl1+qOjGl3oUJefvpyydgjqaM1jo0c= X-Google-Smtp-Source: ABdhPJzP29xmBlDCp4PFhnPQFJUSoC4K4pGWei3p2zPlq3uAtPKdMIyVbFffA1UwuYpP1Imr6vLGx3hKMvY6yrJqsTQ= X-Received: by 2002:ab0:6954:: with SMTP id c20mr895926uas.106.1616575636198; Wed, 24 Mar 2021 01:47:16 -0700 (PDT) MIME-Version: 1.0 References: <20210322030128.2283-1-laurent.pinchart+renesas@ideasonboard.com> <20210322030128.2283-5-laurent.pinchart+renesas@ideasonboard.com> In-Reply-To: From: Geert Uytterhoeven Date: Wed, 24 Mar 2021 09:47:05 +0100 Message-ID: Subject: Re: [RFC PATCH 04/11] drm/bridge: ti-sn65dsi86: Use bitmask to store valid rates To: Doug Anderson Cc: Laurent Pinchart , dri-devel , Linux-Renesas , Andrzej Hajda , Neil Armstrong , Jonas Karlman , Jernej Skrabec , Stephen Boyd Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org Hi Doug, On Tue, Mar 23, 2021 at 10:10 PM Doug Anderson wrote: > On Sun, Mar 21, 2021 at 8:02 PM Laurent Pinchart > wrote: > > > > The valid rates are stored in an array of 8 booleans. Replace it with a > > bitmask to save space. > > I'm curious: do you have evidence that this does anything useful? I > guess you're expecting it to save .text space, right? Stack usage and > execution time differences should be irrelevant--it's not in a > critical section and the difference should be tiny anyway. As far as > .text segment goes, it's not obvious to me that the compiler will use > fewer instructions to manipulate bits compared to booleans. > > Doing a super simple "ls -ah" on vmlinux (unstripped): > > Before: 224820232 bytes > After: 224820376 bytes > > ...so your change made it _bigger_. OK, so running "strip > --strip-debug" on those: > > Before: 26599464 bytes > After: 26599464 bytes I've been surprised by the counter-intuitive impact of similar changes before, too. The result may also differ a lot between arm32 or arm64. > ...so exactly the same. I tried finding some evidence using "readelf -ah": > > Before: > [ 2] .text PROGBITS ffffffc010010000 00020000 > 0000000000b03508 0000000000000000 WAX 0 0 65536 > [ 3] .rodata PROGBITS ffffffc010b20000 00b30000 > 00000000002e84b3 0000000000000000 WAMS 0 0 4096 > > After: > [ 2] .text PROGBITS ffffffc010010000 00020000 > 0000000000b03508 0000000000000000 WAX 0 0 65536 > [ 3] .rodata PROGBITS ffffffc010b20000 00b30000 > 00000000002e84b3 0000000000000000 WAMS 0 0 4096 > > Maybe you have some evidence showing an improvement? Ah, OK. I > disassembled ti_sn_bridge_enable() and your patch saves 12 bytes, but > I guess maybe alignment washes it out in reality... Yes, arm64 is bad w.r.t. this. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds From mboxrd@z Thu Jan 1 00:00:00 1970 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=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no 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 B8EA6C433DB for ; Wed, 24 Mar 2021 08:47:19 +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 256E2619D3 for ; Wed, 24 Mar 2021 08:47:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 256E2619D3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org 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 8F493897EE; Wed, 24 Mar 2021 08:47:18 +0000 (UTC) Received: from mail-ua1-f41.google.com (mail-ua1-f41.google.com [209.85.222.41]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3B2DB897EE for ; Wed, 24 Mar 2021 08:47:17 +0000 (UTC) Received: by mail-ua1-f41.google.com with SMTP id e1so223207uaa.4 for ; Wed, 24 Mar 2021 01:47:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=FX4YhcRrTtOWfNjjlu3aaCWI7W5SveqcMlD13s6eqt4=; b=Ntt4SMPQymZfscZTvD2i7ScS0x9fnWiodtrpdnh32ZiuREFghZ2XnNIkr76yyMJQdY XraqiJzETa0hLNLerINEKvy+aljAQ0oTDjrggMqv3oSVzX2V+XTq8UfPKgMrDu+nbC1/ AUBewkzWMROlhuY00oalR4TgDr2ikf3vx6hNtX+JvmUyYdp5QUfpRRbl0Sz62XJHouOJ pCA9Mw6yXE0EO+/9uPw8I3o0HXEsCV7rumipdeDktlT3/O+f2qzv4WmduzNUgt/jOdL0 J0z1c2BSIbUtSVWoHz3M/Uj4LNaJDTCv9kRLC2WzD9Puc9FgxViOXvghdQFXYM44i2Ge OMyg== X-Gm-Message-State: AOAM5302C0115FdvgugXcU7l/48R5HxxyOaHzms+1azfo1xcA1ImvHAb 3PdYobj+06xSUCHwXsOfgm66SwuFz95w3A66Nqo= X-Google-Smtp-Source: ABdhPJzP29xmBlDCp4PFhnPQFJUSoC4K4pGWei3p2zPlq3uAtPKdMIyVbFffA1UwuYpP1Imr6vLGx3hKMvY6yrJqsTQ= X-Received: by 2002:ab0:6954:: with SMTP id c20mr895926uas.106.1616575636198; Wed, 24 Mar 2021 01:47:16 -0700 (PDT) MIME-Version: 1.0 References: <20210322030128.2283-1-laurent.pinchart+renesas@ideasonboard.com> <20210322030128.2283-5-laurent.pinchart+renesas@ideasonboard.com> In-Reply-To: From: Geert Uytterhoeven Date: Wed, 24 Mar 2021 09:47:05 +0100 Message-ID: Subject: Re: [RFC PATCH 04/11] drm/bridge: ti-sn65dsi86: Use bitmask to store valid rates To: Doug Anderson 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: Jernej Skrabec , Laurent Pinchart , Jonas Karlman , Neil Armstrong , dri-devel , Stephen Boyd , Linux-Renesas , Andrzej Hajda Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Hi Doug, On Tue, Mar 23, 2021 at 10:10 PM Doug Anderson wrote: > On Sun, Mar 21, 2021 at 8:02 PM Laurent Pinchart > wrote: > > > > The valid rates are stored in an array of 8 booleans. Replace it with a > > bitmask to save space. > > I'm curious: do you have evidence that this does anything useful? I > guess you're expecting it to save .text space, right? Stack usage and > execution time differences should be irrelevant--it's not in a > critical section and the difference should be tiny anyway. As far as > .text segment goes, it's not obvious to me that the compiler will use > fewer instructions to manipulate bits compared to booleans. > > Doing a super simple "ls -ah" on vmlinux (unstripped): > > Before: 224820232 bytes > After: 224820376 bytes > > ...so your change made it _bigger_. OK, so running "strip > --strip-debug" on those: > > Before: 26599464 bytes > After: 26599464 bytes I've been surprised by the counter-intuitive impact of similar changes before, too. The result may also differ a lot between arm32 or arm64. > ...so exactly the same. I tried finding some evidence using "readelf -ah": > > Before: > [ 2] .text PROGBITS ffffffc010010000 00020000 > 0000000000b03508 0000000000000000 WAX 0 0 65536 > [ 3] .rodata PROGBITS ffffffc010b20000 00b30000 > 00000000002e84b3 0000000000000000 WAMS 0 0 4096 > > After: > [ 2] .text PROGBITS ffffffc010010000 00020000 > 0000000000b03508 0000000000000000 WAX 0 0 65536 > [ 3] .rodata PROGBITS ffffffc010b20000 00b30000 > 00000000002e84b3 0000000000000000 WAMS 0 0 4096 > > Maybe you have some evidence showing an improvement? Ah, OK. I > disassembled ti_sn_bridge_enable() and your patch saves 12 bytes, but > I guess maybe alignment washes it out in reality... Yes, arm64 is bad w.r.t. this. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel