Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp64542ybl; Tue, 7 Jan 2020 14:14:04 -0800 (PST) X-Google-Smtp-Source: APXvYqwVC2zvULQM7Xd53bAQT/WiRjb3Nx0i5m+kmd2jIJWrgM+NkQzCan0aoB3PFefbU1TTQQvF X-Received: by 2002:a05:6808:3c2:: with SMTP id o2mr531541oie.145.1578435244597; Tue, 07 Jan 2020 14:14:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578435244; cv=none; d=google.com; s=arc-20160816; b=XFeM2lr6n1ZkvX/g+W++NtP4OhFOdvHgTN5IeWhv+5sZlVVI7DnPUtcDVTJjz0qi3j Cipo0T2ds61UhDlXMHnzMmnF7c5wx0f2zENmJ/xPQW9KnVrXKBtneewfu2IHmvCEgpCd SwOp8wUy3qdyIcTv89HeLGNiOKn5yI9RNvYCP3RpPPmeN1d5E902wE6ith3seNRFImzH JST9Rmd/upkLy0UDbE7zbsTEtC+V4FmRPM+kpHSwlXCKmpeDBVkOGzkhU6kxxdro1dc7 /L6wjLHopV/CtSeJoU+F3S81mF9XLcZUWZiqXLboRkEgxOC4hkT4A4y0VEmpiVLPTtq+ uVHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=o8oMYGpU6OGuUvjMSpCf3zh/jwPfeex3PKxtM8A6oeI=; b=wO6UM/E90avVwsqF/hvF0QqY5cqdie9zIUbudwW0jjo2dD4hXuxDrSn2oxkP6K7PoR 8hX3uQXozoks8SaBCszmO5POqSCCphbaSg93vdcm98C7k7im0qv14GFOarlLfU1oNQCI 4tqEsVkVGKp+BrewW/YSrKNs5x9wpMkuW9OQvNcQtlD0fRhZM55AeGxp5QYnhtO7XMlq kjzdjRYwVgH7MEURMNtrs9bguvdqyyGAjueSC2SiCyaZVfxqlM2lj91Y+IOgGg5yJEQc jW7AjzokpQ0ly7vcUSUd+lN153r9NXQDuPM/NRKtREEgtTHe5eSkPMIiVWFZtKHBfGel +oSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=EbjTiyiw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l26si674960otn.48.2020.01.07.14.13.43; Tue, 07 Jan 2020 14:14:04 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=EbjTiyiw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727207AbgAGWMf (ORCPT + 99 others); Tue, 7 Jan 2020 17:12:35 -0500 Received: from perceval.ideasonboard.com ([213.167.242.64]:50538 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726142AbgAGWMf (ORCPT ); Tue, 7 Jan 2020 17:12:35 -0500 Received: from pendragon.ideasonboard.com (81-175-216-236.bb.dnainternet.fi [81.175.216.236]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 7664E52F; Tue, 7 Jan 2020 23:12:33 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1578435154; bh=AXbJzKOK2zmPPbII3OVLxs1ZXTCLfVVQ/T0Ks5djkL4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=EbjTiyiwbEq4A00sbxnPH+eeETrat7SOpeH0qx6VK1CsFFEd4qdaU0hk1jX8nEnkx drN4MrG3GtbTbwAtyqKJ8c3bA0URpgTwjMQyApIY/LKwYjCaRnj4SrOx8G2GIk1qvt PE/HZ51FKJDWKjepuZUz5ZPTREwI60iPwYue3z6E= Date: Wed, 8 Jan 2020 00:12:22 +0200 From: Laurent Pinchart To: Arnd Bergmann Cc: Thierry Reding , David Airlie , Daniel Vetter , Oleksandr Natalenko , Sam Ravnborg , Linus Walleij , Boris Brezillon , Tomi Valkeinen , dri-devel , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] drm: panel: fix excessive stack usage in td028ttec1_prepare Message-ID: <20200107221222.GE7869@pendragon.ideasonboard.com> References: <20200107212747.4182515-1-arnd@arndb.de> <20200107220019.GC7869@pendragon.ideasonboard.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Arnd, On Tue, Jan 07, 2020 at 11:09:13PM +0100, Arnd Bergmann wrote: > On Tue, Jan 7, 2020 at 11:00 PM Laurent Pinchart wrote: > > On Tue, Jan 07, 2020 at 10:27:33PM +0100, Arnd Bergmann wrote: > > > With gcc -O3, the compiler can inline very aggressively, > > > leading to rather large stack usage: > > > > > > drivers/gpu/drm/panel/panel-tpo-td028ttec1.c: In function 'td028ttec1_prepare': > > > drivers/gpu/drm/panel/panel-tpo-td028ttec1.c:233:1: error: the frame size of 2768 bytes is larger than 2048 bytes [-Werror=frame-larger-than=] > > > } > > > > > > Marking jbt_reg_write_1() as noinline avoids the case where > > > multiple instances of this function get inlined into the same > > > stack frame and each one adds a copy of 'tx_buf'. > > > > > > Fixes: mmtom ("init/Kconfig: enable -O3 for all arches") > > > Signed-off-by: Arnd Bergmann > > > > Isn't this something that should be fixed at the compiler level ? > > I suspect but have not verified that structleak gcc plugin is partly at > fault here as well, it has caused similar problems elsewhere. > > If you like I can try to dig deeper before that patch gets merged, > and explain more in the changelog or open a gcc bug if necessary. I think we'll need to merge this in the meantime, but if gcc is able to detect too large frame sizes, I think it should have the ability to take a frame size limit into account when optimizing. I haven't checked if this is already possible and just not honoured here (possibly due to a bug) or if the feature is entirely missing. In any case we'll likely have to live with this compiler issue for quite some time. -- Regards, Laurent Pinchart