From patchwork Thu Oct 3 15:50:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 175179 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp613607ill; Thu, 3 Oct 2019 10:15:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqxVCHqs9Ow7JPBQl2V/WOott99cXanl4zvkcxaCkx2k128Xkytx/gNx4MpuhTIO0pzRCDk7 X-Received: by 2002:a17:907:41db:: with SMTP id og19mr8701815ejb.307.1570122916044; Thu, 03 Oct 2019 10:15:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570122916; cv=none; d=google.com; s=arc-20160816; b=irsZOWW3/svBFBy5v/BGQGZo02ahVBM0bdBTlx7MwtBsgjAsSG1aEylWa2rkXlv8u8 +ct4B3H/T2n9QhG/SxWhvnMR3mmaTioaX+KXz/pBg+EdBY7d7+8P/W2MRzcLm63/5OIs 3T1WBmQ/Ncyr/SzWKdVEd00ps2WK/Aq1uncp1Txf7ozVKgWiQ3pWKR2fe6R/3APeuC8z QASE0NVDmw1gB4FLTtU2ZQbOUABTVZtLOxjh97Y15wTzJctmC3dyckOVfSpmCNBphHbg r7Rl3nCYDrN9MX3Y87drJdQvvyRLhXM/RX7L8urNLJoCVRBwDGXaovybUkNfvXb3IBNI zWoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=js+vsS4Cb+XSnJ107Cy/hrWEqzHWBMe9EchO7f0a5I0=; b=stxEG5pRz4zjrqhtseDFwZRu7mcq2O3kmzE62muGwFehjFQKbfxcEE3DLqODPleodw AufyPJNmyaHA2MR+ZedGFW0aViBUecmyIzFIvfNSnAVHLWpJ8xKJeqqqyem4H6q/rI/U IUvqE+Ahby2KTdSorqTS1YlFo/AJWBiRFeGWIouP2M5mwRztTNaIFYHiU/WIN3v1yMcx 4FQTGax/5KctYLc1tM7UEOHRtcOFt2EkZYyNc4Xk/O3MlzSAVOIH+WV/RxX4LSBHkacW W0T0KEz5SscHXN5ynjkQ/V9O5fglvZqki3yq21ORNMRUmxik4NOXTAy4vBL0XoYr9IUl 9f+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=R4Far0rO; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-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 s17si1552303ejz.148.2019.10.03.10.15.15; Thu, 03 Oct 2019 10:15:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-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 header.i=@kernel.org header.s=default header.b=R4Far0rO; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389802AbfJCRPO (ORCPT + 14 others); Thu, 3 Oct 2019 13:15:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:57106 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391032AbfJCQ0M (ORCPT ); Thu, 3 Oct 2019 12:26:12 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5EA4720700; Thu, 3 Oct 2019 16:26:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570119971; bh=1gu4rf+5VEszUoONBv6+5oClhIK+BZ/7dqRQHE6quhM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R4Far0rOJNQMqMpHlfXGOjMAaepn0sYBDtvth+vrg//rvIKt9MGNeJsFmHxpVY3dj DVbI1fE/lhCZdv/jSX0yBAtCbs9zQtRRAlfeR53PiYKhGIsPOdjquEBzVGeSkOKLsd 3xB6gO5Ja1mCMZ+gwMxfCYlxkVJcgYDlQy31ctc0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann , Nick Desaulniers , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.2 050/313] media: vivid: work around high stack usage with clang Date: Thu, 3 Oct 2019 17:50:28 +0200 Message-Id: <20191003154538.033733798@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191003154533.590915454@linuxfoundation.org> References: <20191003154533.590915454@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Arnd Bergmann [ Upstream commit 1a03f91c2c2419c3709c4554952c66695575e91c ] Building a KASAN-enabled kernel with clang ends up in a case where too much is inlined into vivid_thread_vid_cap() and the stack usage grows a lot, possibly when the register allocation fails to produce efficient code and spills a lot of temporaries to the stack. This uses more than twice the amount of stack than the sum of the individual functions when they are not inlined: drivers/media/platform/vivid/vivid-kthread-cap.c:766:12: error: stack frame size of 2208 bytes in function 'vivid_thread_vid_cap' [-Werror,-Wframe-larger-than=] Marking two of the key functions in here as 'noinline_for_stack' avoids the pathological case in clang without any apparent downside for gcc. Signed-off-by: Arnd Bergmann Acked-by: Nick Desaulniers Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/vivid/vivid-kthread-cap.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) -- 2.20.1 diff --git a/drivers/media/platform/vivid/vivid-kthread-cap.c b/drivers/media/platform/vivid/vivid-kthread-cap.c index cf6dfecf879f7..96d85cd8839f3 100644 --- a/drivers/media/platform/vivid/vivid-kthread-cap.c +++ b/drivers/media/platform/vivid/vivid-kthread-cap.c @@ -232,8 +232,8 @@ static void *plane_vaddr(struct tpg_data *tpg, struct vivid_buffer *buf, return vbuf; } -static int vivid_copy_buffer(struct vivid_dev *dev, unsigned p, u8 *vcapbuf, - struct vivid_buffer *vid_cap_buf) +static noinline_for_stack int vivid_copy_buffer(struct vivid_dev *dev, unsigned p, + u8 *vcapbuf, struct vivid_buffer *vid_cap_buf) { bool blank = dev->must_blank[vid_cap_buf->vb.vb2_buf.index]; struct tpg_data *tpg = &dev->tpg; @@ -672,7 +672,8 @@ static void vivid_cap_update_frame_period(struct vivid_dev *dev) dev->cap_frame_period = f_period; } -static void vivid_thread_vid_cap_tick(struct vivid_dev *dev, int dropped_bufs) +static noinline_for_stack void vivid_thread_vid_cap_tick(struct vivid_dev *dev, + int dropped_bufs) { struct vivid_buffer *vid_cap_buf = NULL; struct vivid_buffer *vbi_cap_buf = NULL;