Message ID | 20230417205654.1982368-1-arnd@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2413817vqo; Mon, 17 Apr 2023 14:31:55 -0700 (PDT) X-Google-Smtp-Source: AKy350YBXLsdqKrY0jvbEWwWOd2geG8kRFlHJ9ZootCIBy3vRS/tEeFkoKUHYDgmU0gGXmzSPwT2 X-Received: by 2002:a17:90b:1e02:b0:246:aebf:21f5 with SMTP id pg2-20020a17090b1e0200b00246aebf21f5mr16364669pjb.41.1681767115711; Mon, 17 Apr 2023 14:31:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681767115; cv=none; d=google.com; s=arc-20160816; b=SnzJGjZUa54Kge3hVvULa5yXh8JsunZT/H6WaTQboISG59Gua4+BQ/yl6lnSPOc5CB zaVYDGnUdfTY1umQVqnLKaZ4eX87P0S+QpNlOFy2TOAUIp4BlL77Zzu8imLCAC46a2JF Y7Iiu2fDckwlvmFp/FhBgoyPnT2sa7ptEICD5R+xL57LGAV9ZE5Jxn2DFqL5J8dcW6Aw FzwcodwS9S9rKkEVj8kQAwM7QuN4KPGWxirXZ2KBUiIUugvbOKtiPMzJGOubxahcBJb+ /eSkB6m8m8u+CM8LLt/YdwECJIfMqG4NAxOF4UYXJHBIsmViqf2GKuf+RG4McUkAEyry biEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=/o5sXuixAmdz+jGBFEMGeAMMabULWA0GOS/6ODcuyk4=; b=RBnbtKox+ZkGffHUQPw9liSXS4EgTsA+a5xfBKZkCH7WIqwdVzPvwm6DPSeHBFR5r1 /SttwOzdOs54wfAsZC6MUycYV0Rfu0go0F8tSBgIioGPnm2KpAMXUWMwePWdGbQ4mfhp MNPiWLUIgz/cwop/6rf1JfZBlSFU32FSGDy3aS85h+miQYGCG+2/1tz5hcj19GL2RaqP kDM6300a6tBs3AgBvMMbPQbnfGRc/nzN1luMUonXdHgufVjzRqAzPBWTvqdl8bHrjl5B MbLmptkjLZAqSx/iXUsqaK7ZORV5Eaq7wRd3eRgVqt5I9eGZma45Q9tpt8ILwGw+XKrm kwdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nNatzqFH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kb1-20020a17090ae7c100b00240a968ea63si777149pjb.68.2023.04.17.14.31.29; Mon, 17 Apr 2023 14:31:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nNatzqFH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231168AbjDQVAm (ORCPT <rfc822;leviz.kernel.dev@gmail.com> + 99 others); Mon, 17 Apr 2023 17:00:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231395AbjDQU7h (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 17 Apr 2023 16:59:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47854D319 for <linux-kernel@vger.kernel.org>; Mon, 17 Apr 2023 13:57:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D682762A71 for <linux-kernel@vger.kernel.org>; Mon, 17 Apr 2023 20:56:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9A0F9C4339B; Mon, 17 Apr 2023 20:56:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681765019; bh=GsJ+PxyTSnYDGmLARig0264/+VJ67ApwAzYJ119+iSo=; h=From:To:Cc:Subject:Date:From; b=nNatzqFHmOQ057sTK5UQ0wFqiCQjllH8w0mjnxyxRPlfJsHBhuPXHefHqjInEH4AF nulbc2rGyqnAWGzjW6V0YKevxeCLXOL8eAXvgSNhRb+ukhcMvfqKY1urg0P2VRvXWg 3hxjk0TJmgcsKe++pVJcahc2qD9SjKYg2jhlP5UGERc8J3BodkS2nHWW9YKCAMKsdU nj6Z486FHooltVb23ucWjyx4fcaOFIl0c6m6X0u7FI4sP5lYW+cIbC/uFhbhkM1k1N lyN4WUD9hNmoI/z2V2LQnnlAuMuMII3zGoxtafcFjdpbESky0FBzIz/httvFFSFlaX 2U9g4u1Uci3Cg== From: Arnd Bergmann <arnd@kernel.org> To: Miquel Raynal <miquel.raynal@bootlin.com>, Richard Weinberger <richard@nod.at>, Vignesh Raghavendra <vigneshr@ti.com>, =?utf-8?b?TWljaGHFgiBLxJlwaWXFhA==?= <kernel@kempniu.pl> Cc: Arnd Bergmann <arnd@arndb.de>, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] mtdchar: mark bits of ioctl handler noinline Date: Mon, 17 Apr 2023 22:56:50 +0200 Message-Id: <20230417205654.1982368-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763460635028156748?= X-GMAIL-MSGID: =?utf-8?q?1763460635028156748?= |
Series |
mtdchar: mark bits of ioctl handler noinline
|
|
Commit Message
Arnd Bergmann
April 17, 2023, 8:56 p.m. UTC
From: Arnd Bergmann <arnd@arndb.de> The addition of the mtdchar_read_ioctl() function caused the stack usage of mtdchar_ioctl() to grow beyond the warning limit on 32-bit architectures with gcc-13: drivers/mtd/mtdchar.c: In function 'mtdchar_ioctl': drivers/mtd/mtdchar.c:1229:1: error: the frame size of 1488 bytes is larger than 1024 bytes [-Werror=frame-larger-than=] Mark both the read and write portions as noinline_for_stack to ensure they don't get inlined and use separate stack slots to reduce the maximum usage, both in the mtdchar_ioctl() and combined with any of its callees. Fixes: 095bb6e44eb1 ("mtdchar: add MEMREAD ioctl") Signed-off-by: Arnd Bergmann <arnd@arndb.de> --- drivers/mtd/mtdchar.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
Comments
----- Ursprüngliche Mail ----- > Von: "Arnd Bergmann" <arnd@kernel.org> > The addition of the mtdchar_read_ioctl() function caused the stack usage > of mtdchar_ioctl() to grow beyond the warning limit on 32-bit architectures > with gcc-13: > > drivers/mtd/mtdchar.c: In function 'mtdchar_ioctl': > drivers/mtd/mtdchar.c:1229:1: error: the frame size of 1488 bytes is larger than > 1024 bytes [-Werror=frame-larger-than=] > > Mark both the read and write portions as noinline_for_stack to ensure > they don't get inlined and use separate stack slots to reduce the > maximum usage, both in the mtdchar_ioctl() and combined with any > of its callees. > > Fixes: 095bb6e44eb1 ("mtdchar: add MEMREAD ioctl") > Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Richard Weinberger <richard@nod.at> Thanks, //richard
Hi Arnd, arnd@kernel.org wrote on Mon, 17 Apr 2023 22:56:50 +0200: > From: Arnd Bergmann <arnd@arndb.de> > > The addition of the mtdchar_read_ioctl() function caused the stack usage > of mtdchar_ioctl() to grow beyond the warning limit on 32-bit architectures > with gcc-13: > > drivers/mtd/mtdchar.c: In function 'mtdchar_ioctl': > drivers/mtd/mtdchar.c:1229:1: error: the frame size of 1488 bytes is larger than 1024 bytes [-Werror=frame-larger-than=] > > Mark both the read and write portions as noinline_for_stack to ensure > they don't get inlined and use separate stack slots to reduce the > maximum usage, both in the mtdchar_ioctl() and combined with any > of its callees. > > Fixes: 095bb6e44eb1 ("mtdchar: add MEMREAD ioctl") > Signed-off-by: Arnd Bergmann <arnd@arndb.de> I am about to take this as part of my next fixes PR, should we Cc: stable? What is the current policy wrt gcc version issues? > --- > drivers/mtd/mtdchar.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c > index 01f1c6792df9..8dc4f5c493fc 100644 > --- a/drivers/mtd/mtdchar.c > +++ b/drivers/mtd/mtdchar.c > @@ -590,8 +590,8 @@ static void adjust_oob_length(struct mtd_info *mtd, uint64_t start, > (end_page - start_page + 1) * oob_per_page); > } > > -static int mtdchar_write_ioctl(struct mtd_info *mtd, > - struct mtd_write_req __user *argp) > +static noinline_for_stack int > +mtdchar_write_ioctl(struct mtd_info *mtd, struct mtd_write_req __user *argp) > { > struct mtd_info *master = mtd_get_master(mtd); > struct mtd_write_req req; > @@ -688,8 +688,8 @@ static int mtdchar_write_ioctl(struct mtd_info *mtd, > return ret; > } > > -static int mtdchar_read_ioctl(struct mtd_info *mtd, > - struct mtd_read_req __user *argp) > +static noinline_for_stack int > +mtdchar_read_ioctl(struct mtd_info *mtd, struct mtd_read_req __user *argp) > { > struct mtd_info *master = mtd_get_master(mtd); > struct mtd_read_req req; Thanks, Miquèl
On Mon, May 22, 2023, at 17:46, Miquel Raynal wrote: > > I am about to take this as part of my next fixes PR, should we Cc: > stable? What is the current policy wrt gcc version issues? I think in general we do want stable kernels to work with the latest gcc, so please add the Cc:stable annotation. Arnd
On Mon, 2023-04-17 at 20:56:50 UTC, Arnd Bergmann wrote: > From: Arnd Bergmann <arnd@arndb.de> > > The addition of the mtdchar_read_ioctl() function caused the stack usage > of mtdchar_ioctl() to grow beyond the warning limit on 32-bit architectures > with gcc-13: > > drivers/mtd/mtdchar.c: In function 'mtdchar_ioctl': > drivers/mtd/mtdchar.c:1229:1: error: the frame size of 1488 bytes is larger than 1024 bytes [-Werror=frame-larger-than=] > > Mark both the read and write portions as noinline_for_stack to ensure > they don't get inlined and use separate stack slots to reduce the > maximum usage, both in the mtdchar_ioctl() and combined with any > of its callees. > > Fixes: 095bb6e44eb1 ("mtdchar: add MEMREAD ioctl") > Signed-off-by: Arnd Bergmann <arnd@arndb.de> > Reviewed-by: Richard Weinberger <richard@nod.at> Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/fixes, thanks. Miquel
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c index 01f1c6792df9..8dc4f5c493fc 100644 --- a/drivers/mtd/mtdchar.c +++ b/drivers/mtd/mtdchar.c @@ -590,8 +590,8 @@ static void adjust_oob_length(struct mtd_info *mtd, uint64_t start, (end_page - start_page + 1) * oob_per_page); } -static int mtdchar_write_ioctl(struct mtd_info *mtd, - struct mtd_write_req __user *argp) +static noinline_for_stack int +mtdchar_write_ioctl(struct mtd_info *mtd, struct mtd_write_req __user *argp) { struct mtd_info *master = mtd_get_master(mtd); struct mtd_write_req req; @@ -688,8 +688,8 @@ static int mtdchar_write_ioctl(struct mtd_info *mtd, return ret; } -static int mtdchar_read_ioctl(struct mtd_info *mtd, - struct mtd_read_req __user *argp) +static noinline_for_stack int +mtdchar_read_ioctl(struct mtd_info *mtd, struct mtd_read_req __user *argp) { struct mtd_info *master = mtd_get_master(mtd); struct mtd_read_req req;