Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp159906lqa; Fri, 26 Apr 2024 19:05:39 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWEahytlqaD5nWp63ggkUlXIMhlaJcFDJpxaK5ezZ07NfHn3jSC6fCZ5voJsk64B9MNwyOoHIKEYLLjU7L7Ip/6Inzf3pvQA7CQfVua5A== X-Google-Smtp-Source: AGHT+IEKK8QxA69UJ+L5BPTZh46hexp9J39RLjDsIPi1ZK63/6aK1eTbvt6P4PtwFffaoCL1G/Np X-Received: by 2002:a17:902:e809:b0:1e1:6850:f823 with SMTP id u9-20020a170902e80900b001e16850f823mr5401810plg.13.1714183539073; Fri, 26 Apr 2024 19:05:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714183539; cv=pass; d=google.com; s=arc-20160816; b=rGIqHYxYyybE4xbJ/svDT5dvhQonS6PTWSggBrXd0+pf0jgQ17PsUK1bs/mpxwAFem O3cGxMuNVIDJCJLK335Uy+2Ee32LAfIHH+yZKyqGj59h15YTBORQXUS/JcH1X41lIq7y dkw7ikLj9ussbPGYfeQiPG9kF88bU0ztHW9p7rviyeAJXSwcOr6hQr99mAT/AnZ+NlQp jw1zhrehz7beWbWIvtqWVMgEDBRmyU3+m1JguBJSkk+mMT3xh1kOAwg6RV6J/PNODIkt B3QPsGOB+w5iNPpvYedd1hEGaF9/6fbuODqhXT5gnIYyC4XrI8nYOuomjI/RGrYD6Jdm Tj9Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=bWxST7R5ZxzrDscEPj1WVcSCVkPOXWKQJTTlykb8isE=; fh=QgSKUzZYsUlmjQpGJxs2OLtRJrG9We865DgFNh1PXZo=; b=iFrZ1QlNJrELgxk1pJY1IhFjIWC5xVrUfq2M2FdB6D2tuCpH7DcZm4vquTQ1WiD7sw eZD2eaikB4IE8t5I4EqU5ICSoVB9HJs0jG00QaJJ3FQrmfibNtphgmdaTaFGWSIPszSn rjz11aIEFWKTPIzeqX/NWqM3l+xdYrg1nOVBTOGFfqJakZ2X4RpJ9mOawPhZ7Hcm6D/q NJjWBHm4dXGkQ1Mga257rRMWR5s4wvmxSi1F6w2BM1xufQnzIYqfTrjXBbVABJuYBv8K clc4GbGc5Vg2FLVePlJ9Z5KcR5Gpw41Idlh4W1xSYfIN2SUAssC0nzS9Gq8sqs1Fmr4c rJCw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=g0LbVI2n; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-160866-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-160866-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id u1-20020a17090282c100b001e4e4f5a487si15586164plz.132.2024.04.26.19.05.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 19:05:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-160866-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=g0LbVI2n; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-160866-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-160866-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 2B13BB227A1 for ; Sat, 27 Apr 2024 02:05:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 200AE38DEC; Sat, 27 Apr 2024 02:05:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="g0LbVI2n" Received: from mail-yw1-f176.google.com (mail-yw1-f176.google.com [209.85.128.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 86990383B1 for ; Sat, 27 Apr 2024 02:05:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714183528; cv=none; b=FhKyVNbJS9fINCUbMd5QOSPJi+JUa9eFbsOBZWzUeQruavxH6pspIPcvUjjCL0FcV22njlfxxllMrnN3Er/fMz9rPDBXBFePmVuDiqtNpGbQQkzO5ADWbAm+tVwv8pjP17FYa+fBYQ1ce7eqbnVmu9E1RledWLaDSlMeGcD5EiI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714183528; c=relaxed/simple; bh=mZZ4c0mnRqBfsEIMbKcc3YoUl1QsqahrEbnyLoOeDVU=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=fwvEMxDyTAYi35Ha3f3HBgc/9yqdF8Vlg8ke+kaLNEoOxB3b3PlCemvvPP8vbgChOMsbPXEyb93imuZ8oEKgZ6uiRCzOKhCwsrdwi9cwdepF21+QG4KaOgs+Uub0ewcCbp45oeJ4HN/TVSbFtD9CkVVLlLhD8+LYD3//tIasBN8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=g0LbVI2n; arc=none smtp.client-ip=209.85.128.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-yw1-f176.google.com with SMTP id 00721157ae682-617f8a59a24so25758607b3.1 for ; Fri, 26 Apr 2024 19:05:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714183525; x=1714788325; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=bWxST7R5ZxzrDscEPj1WVcSCVkPOXWKQJTTlykb8isE=; b=g0LbVI2nd2GJIR3ZKt3hqMJvbblXtO5t1MblKcVlf2RHEkqAF/6vRPrGzyurb/TyZ8 UA9km9MffWbipRNsYD03noy01O9m5WOKq5bVRUAaOEjuw6KI3cclFQxf+ClNw1lQ3VBd Vt7mzLs3tkq4sD/DIaN37Vsgkh5v8f6emNIuSpb2liJvuETFpAx9gCxsNW8zs5/IKAkm ACwq9mOSjpVJhlbH994+itg7VTT0nwGIIT4tpFneYTQiM7DpCbGvwenKsHaUu7lAeiHm DYcWIYtL0Gg4AValZKgDBGqWzTdRFFb8nr+ZsU0b07NgMBxmVGoN+Q4V2Rd5O6/2Ensa DLsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714183525; x=1714788325; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=bWxST7R5ZxzrDscEPj1WVcSCVkPOXWKQJTTlykb8isE=; b=UIxs6AsN+pqizcMoazZceY5k0fw09xKbq9rqa758zvmgHZ9PbFnwYufwI80GryAAAy H3Mxq2hOIPAe7EsltANpEQpd4DuULGu3HFSHNeDQBGp9XJvHte75vfUqsKLw26O+I6N6 bhUdZvPwok3ANv746wV+WAd8FBmIl9VDf8srVaWE4nLyocclJDKNfrKAxYzGbTsUGqnQ 0oUWUZl03CF6DAfKMuqFfm/PdHEdlQ0tVE393Qsb/+pu9l2x6O9N3ZFZownxVcFSxrbf 47MgxmCKPhCV1Y44PYRudlHTkawCS0XRpBmdGffKY6wE9PQUJtSykTRfJcQndHo/wKwg If0Q== X-Forwarded-Encrypted: i=1; AJvYcCXxyPyV5mtiCB7AvYktKBkx4429qA1JTWhqRGLcdYziVPDe4en20a8OFWMdmBEkbvSLZImHEnRlR1ZTn0COFghwKUDJJKD7r6q6oeNF X-Gm-Message-State: AOJu0YygwLzyyEilQ89MGJXxHja/doiQ2kXi+Df2YckI0QPU4HXMwAc1 59NUVhjfKUhczC9BrR1SkOB9h+sgRbYoz5qELw+kjD+wU9ymBoePtn6S1/ENItNOwx+WC1diehW eo7C9f7O6LZcwIB+HzcFS8Lcvsn6bkcTKBS2zSQ== X-Received: by 2002:a05:690c:4483:b0:615:6d2c:2cf6 with SMTP id gr3-20020a05690c448300b006156d2c2cf6mr4974839ywb.47.1714183525401; Fri, 26 Apr 2024 19:05:25 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240426235857.3870424-1-dianders@chromium.org> <20240426165839.v2.3.Id15fae80582bc74a0d4f1338987fa375738f45b9@changeid> In-Reply-To: <20240426165839.v2.3.Id15fae80582bc74a0d4f1338987fa375738f45b9@changeid> From: Dmitry Baryshkov Date: Sat, 27 Apr 2024 05:05:14 +0300 Message-ID: Subject: Re: [PATCH v2 3/8] drm/mipi-dsi: Reduce driver bloat of mipi_dsi_*_write_seq() To: Douglas Anderson Cc: dri-devel@lists.freedesktop.org, Linus Walleij , lvzhaoxiong@huaqin.corp-partner.google.com, Jani Nikula , Hsin-Yi Wang , Javier Martinez Canillas , Neil Armstrong , Joel Selvaraj , Cong Yang , Sam Ravnborg , Daniel Vetter , David Airlie , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" On Sat, 27 Apr 2024 at 02:59, Douglas Anderson wrote: > > Through a cooperative effort between Hsin-Yi Wang and Dmitry > Baryshkov, we have realized the dev_err_ratelimited() in the > mipi_dsi_*_write_seq() macros was causing quite a bit of bloat to the > kernel. Let's hoist this call into drm_mipi_dsi.c by adding a "chatty" > version of the functions that includes the print. While doing this, > add a bit more comments to these macros making it clear that they > print errors and also that they return out of _the caller's_ function. > > Without any changes to clients this gives a dramatic savings. Building > with my build system shows one example: > > $ scripts/bloat-o-meter \ > .../before/panel-novatek-nt36672e.ko \ > .../after/panel-novatek-nt36672e.ko > > add/remove: 0/1 grow/shrink: 0/1 up/down: 0/-21496 (-21496) > Function old new delta > nt36672e_1080x2408_60hz_init._rs 10320 - -10320 > nt36672e_1080x2408_60hz_init 17412 6236 -11176 > Total: Before=32147, After=10651, chg -66.87% > > Note that given the change in location of the print it's harder to > include the "cmd" in the printout for mipi_dsi_dcs_write_seq() since, > theoretically, someone could call the new chatty function with a > zero-size array and it would be illegal to dereference data[0]. > There's a printk format to print the whole buffer and this is probably > more useful for debugging anyway. Given that we're doing this for > mipi_dsi_dcs_write_seq(), let's also print the buffer for > mipi_dsi_generic_write_seq() in the error case. > > It should be noted that the current consensus of DRM folks is that the > mipi_dsi_*_write_seq() should be deprecated due to the non-intuitive > return behavior. A future patch will formally mark them as deprecated > and provide an alternative. > > Signed-off-by: Douglas Anderson > --- > > Changes in v2: > - Add some comments to the macros about printing and returning. > - Modify commit message now that this is part of a series. > - Change the way err value is handled in prep for next patch. > - Rebased upon patches to avoid theoretical int overflow. > Reviewed-by: Dmitry Baryshkov -- With best wishes Dmitry