Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1946060ybv; Fri, 14 Feb 2020 08:40:26 -0800 (PST) X-Google-Smtp-Source: APXvYqzWbIQ5rq8igHQYgeMRpMlfFWYerh7Pa6tfpkWzef1wRyLHI3R6u2nlfdpImTm5nQ4W2Ukb X-Received: by 2002:a54:4182:: with SMTP id 2mr2415544oiy.14.1581698426537; Fri, 14 Feb 2020 08:40:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581698426; cv=none; d=google.com; s=arc-20160816; b=kawchlrf1xULB0yE59JccAspqJQWMaYPKcry52xSDGhDAho/eNHlotYvvNCxsO38h0 ugnRQRqQ67gRs9CVIi4DhgOp8A8JZ3561rJnGrZFEGBMdGAan8Xni5M01Z4uSnGXILvm QbsQys8kaO0k9DkhJqXsvwfx4ispeQvJArZd7czrHPL/sn0s0OjPv8bgPo8AUjepUdxx PM8b5Qw+CygQvUJ/6iuiVi4ly9aCYLejPm731vX8WsA6AR0iPZfgfZ8bnwZiXMSckFTP hrN3brN3wQdhwCuw7G1OK3lJlqUnscynBgyuCljj4qQG/Kze2ZsA/OEtEUQw4PaLXqpd 5lyQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=jWEwoM0VxjPHwR8haYUsFlkj4fotYkmgE0SbU/Ul3b0=; b=EBLb+eZf2qFAZ1NcoHO2caQuKP6LKkd/aVPcMrUlL4NBeE8lDGyvB6dPaW7BZHGZx2 WB3NDMaWKSj1KkC7i4C6UH3AURUVU0AIbzheGSrfGJW+N/sC7x1rTm2LJKqKrDM1iXuw xTI5dLHVFa78Na3WRaHyQFuwpYbk49/rgSgL+Gry4VFbXyOPmlrvsCiUYOlN9aUd7NdK kK5s1VB+7O0MvPKWf9OuIC+2P7br+n571NPwNh/ofeYEIclLkCt1zG806SFNv4v0e6gB uIAi1+rbRu9fSPcobiG58VdPDJCKISv01ylGd9xLHnET93Q+fHWt/o7iWwOTAH5tG8/F BRJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kTToPTJX; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h21si3092880otr.235.2020.02.14.08.40.14; Fri, 14 Feb 2020 08:40:26 -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 header.i=@kernel.org header.s=default header.b=kTToPTJX; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393868AbgBNQij (ORCPT + 99 others); Fri, 14 Feb 2020 11:38:39 -0500 Received: from mail.kernel.org ([198.145.29.99]:59680 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405642AbgBNQXZ (ORCPT ); Fri, 14 Feb 2020 11:23:25 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8E69B2476E; Fri, 14 Feb 2020 16:23:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581697404; bh=IanB/lM2ZpQpeoxyeB6ocDTSzPJwvsxqB0XyUjcUZus=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kTToPTJXEV7AzZByaxaQTUZcHBkYbPSWsFjQj5A8NrhkjFWvBRZBMJ2fNl1h4KD3m m/p2maxety59MkWWEn/Fmj115J5RYiisorhh5WGTwtPVwIE3wJy+qN2itAByyuGG0j aG0CiafpkilaIkBUKI4JwEMZa9KcBqDmNgxySDnk= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Arnd Bergmann , Greg Kroah-Hartman , Sasha Levin , devel@driverdev.osuosl.org Subject: [PATCH AUTOSEL 4.9 097/141] vme: bridges: reduce stack usage Date: Fri, 14 Feb 2020 11:20:37 -0500 Message-Id: <20200214162122.19794-97-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200214162122.19794-1-sashal@kernel.org> References: <20200214162122.19794-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnd Bergmann [ Upstream commit 7483e7a939c074d887450ef1c4d9ccc5909405f8 ] With CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3, the stack usage in vme_fake grows above the warning limit: drivers/vme/bridges/vme_fake.c: In function 'fake_master_read': drivers/vme/bridges/vme_fake.c:610:1: error: the frame size of 1160 bytes is larger than 1024 bytes [-Werror=frame-larger-than=] drivers/vme/bridges/vme_fake.c: In function 'fake_master_write': drivers/vme/bridges/vme_fake.c:797:1: error: the frame size of 1160 bytes is larger than 1024 bytes [-Werror=frame-larger-than=] The problem is that in some configurations, each call to fake_vmereadX() puts another variable on the stack. Reduce the amount of inlining to get back to the previous state, with no function using more than 200 bytes each. Signed-off-by: Arnd Bergmann Link: https://lore.kernel.org/r/20200107200610.3482901-1-arnd@arndb.de Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/vme/bridges/vme_fake.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/drivers/vme/bridges/vme_fake.c b/drivers/vme/bridges/vme_fake.c index 30b3acc938330..e81ec763b5555 100644 --- a/drivers/vme/bridges/vme_fake.c +++ b/drivers/vme/bridges/vme_fake.c @@ -418,8 +418,9 @@ static void fake_lm_check(struct fake_driver *bridge, unsigned long long addr, } } -static u8 fake_vmeread8(struct fake_driver *bridge, unsigned long long addr, - u32 aspace, u32 cycle) +static noinline_for_stack u8 fake_vmeread8(struct fake_driver *bridge, + unsigned long long addr, + u32 aspace, u32 cycle) { u8 retval = 0xff; int i; @@ -450,8 +451,9 @@ static u8 fake_vmeread8(struct fake_driver *bridge, unsigned long long addr, return retval; } -static u16 fake_vmeread16(struct fake_driver *bridge, unsigned long long addr, - u32 aspace, u32 cycle) +static noinline_for_stack u16 fake_vmeread16(struct fake_driver *bridge, + unsigned long long addr, + u32 aspace, u32 cycle) { u16 retval = 0xffff; int i; @@ -482,8 +484,9 @@ static u16 fake_vmeread16(struct fake_driver *bridge, unsigned long long addr, return retval; } -static u32 fake_vmeread32(struct fake_driver *bridge, unsigned long long addr, - u32 aspace, u32 cycle) +static noinline_for_stack u32 fake_vmeread32(struct fake_driver *bridge, + unsigned long long addr, + u32 aspace, u32 cycle) { u32 retval = 0xffffffff; int i; @@ -613,8 +616,9 @@ static ssize_t fake_master_read(struct vme_master_resource *image, void *buf, return retval; } -static void fake_vmewrite8(struct fake_driver *bridge, u8 *buf, - unsigned long long addr, u32 aspace, u32 cycle) +static noinline_for_stack void fake_vmewrite8(struct fake_driver *bridge, + u8 *buf, unsigned long long addr, + u32 aspace, u32 cycle) { int i; unsigned long long start, end, offset; @@ -643,8 +647,9 @@ static void fake_vmewrite8(struct fake_driver *bridge, u8 *buf, } -static void fake_vmewrite16(struct fake_driver *bridge, u16 *buf, - unsigned long long addr, u32 aspace, u32 cycle) +static noinline_for_stack void fake_vmewrite16(struct fake_driver *bridge, + u16 *buf, unsigned long long addr, + u32 aspace, u32 cycle) { int i; unsigned long long start, end, offset; @@ -673,8 +678,9 @@ static void fake_vmewrite16(struct fake_driver *bridge, u16 *buf, } -static void fake_vmewrite32(struct fake_driver *bridge, u32 *buf, - unsigned long long addr, u32 aspace, u32 cycle) +static noinline_for_stack void fake_vmewrite32(struct fake_driver *bridge, + u32 *buf, unsigned long long addr, + u32 aspace, u32 cycle) { int i; unsigned long long start, end, offset; -- 2.20.1