From patchwork Tue Oct 19 19:18:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 515977 Delivered-To: patch@linaro.org Received: by 2002:ac0:cd8c:0:0:0:0:0 with SMTP id d12csp984045imp; Tue, 19 Oct 2021 12:18:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx7SYFAjVa4V5RbtwxAOp//qrkQvdHbZWZDREtOGvh/VEBvoPywk2S/KETglUr6n4/9vrUz X-Received: by 2002:a05:6a00:1346:b0:44d:242a:8151 with SMTP id k6-20020a056a00134600b0044d242a8151mr1694929pfu.62.1634671103958; Tue, 19 Oct 2021 12:18:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634671103; cv=none; d=google.com; s=arc-20160816; b=OrJOgemx91Ltpj02tJ697NUwOzGgsCcojMQ5gDvFYEIPkcZLTJhzTq+At5M6NKAJT0 HE8WKMpF/aKfGmnXwfN9NjvV+wyM07ryVasQlJf017jAKahiN9aslJ7JlO6zvWcLk7/p YWe8MlJIhvN5nwuCXPpkJnl6R850VvLDBKmxFVwhR8AvSp1rPgRc5rJZpsXv4yd+j1I9 vfi/5GqKq5dtf0cb9UG7NCOwuf/kGbqGSasLdnQyp+ckd1DVU7IHC/q2EcrLJC35WrPh v3/IDtjt7wJw+mDd1mhFDZzXGV1L0j322LkquFnL5z6ZVpHyQ6kZ0uKyo2cSHXL3twuy 0+kQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :delivered-to; bh=o6QKrcbqOFu7MKo3lvZl1ttCGVsi0oCRkh87RLRbJ7A=; b=KR3DNHz83+CsrCmj7BQaqfF76gyIW+7HG9WiWhSHBnMJsyI6DsCZKl3qZtBdiN5IeP 5uKSGq6h/ECdG3XpY90S4DcV2tJFez2O3I8gmI2DwwfSbesjl6MZr/6ON6OOPSTlgQGo JMHfAbJkHKhNzi1wG8pvAILZjTyLHP1Oy4SzBc1RXQbngbUPPwXgDa9DUCDB3jjcz8Wj xREnp3SePhydBgOijgMt81v51QHP619vQx9mSo+2bo1PBxknUHBiQCPwoQQGUVh7y2Jk V+a6OdyYoca5JG72mDhOiL7BGP/a+h2KD4g4YnjvCQlAbBV0bqBYuxQ1Yewpz4zf3vVh 67mQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=YWX3iEMh; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id w186si27670pfw.135.2021.10.19.12.18.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Oct 2021 12:18:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=YWX3iEMh; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2923F6E869; Tue, 19 Oct 2021 19:18:22 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by gabe.freedesktop.org (Postfix) with ESMTPS id AC5C26E869 for ; Tue, 19 Oct 2021 19:18:20 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id BD43A60EE2; Tue, 19 Oct 2021 19:18:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1634671100; bh=gQ8mFwkO2LHy0BaSGZp8wy9fYbOMNeZ+u2d3mSVXVjc=; h=From:To:Cc:Subject:Date:From; b=YWX3iEMh3xVmNbS9D1V3gsCoaa9IpyGzVbxWcU7EVHqorf7b24KMocLmkT4Z9R/Qd YVCGGboYxN6f0gksXEAQfzaaLhwb+K6WmHpWqfhuGvRTtXcFU+t3WsKC1Qvz/gHwQl 3KmarBccafeAP/R9LAGYymZpJQs3w6IuY0s8cwHXgGMkCSGtjeh0ApmWJUjboJA37V hWno2+j8UKNCggoOpcuX6L6/YGG8b9w16pgQY+aXB/bIYlVaAF4SuTytjp/8XoAbX+ zczigJtCvQZIaB4DO7cHmEqivd+/glA34CP50uvUvycp3Te57VIvxQl0hhPLsGjleI UNiEAc5bG0S+w== From: Arnd Bergmann To: David Airlie , Daniel Vetter , =?utf-8?q?Christian_K=C3=B6nig?= , Nirmoy Das , Chris Wilson Cc: Arnd Bergmann , Lee Jones , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH] [SUBMITTED 20200529] drm/selftests/mm: reduce per-function stack usage Date: Tue, 19 Oct 2021 21:18:06 +0200 Message-Id: <20211019191815.3159266-1-arnd@kernel.org> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Arnd Bergmann The check_reserve_boundaries() function has a large array on the stack, over 500 bytes. It gets inlined into __igt_reserve, which has multiple other large structures as well but stayed just under the stack size warning limit of 1024 bytes until one more member got added to struct drm_mm_node, causing a warning: drivers/gpu/drm/selftests/test-drm_mm.c:371:12: error: stack frame size of 1032 bytes in function '__igt_reserve' [-Werror,-Wframe-larger-than=] As far as I can tell, this is not nice but will not be called from a context that is already low for the kernel stack, so just annotate the inner function as noinline_for_stack to ensure that each function by itself stays under the warning limit. Fixes: 0cdea4455acd ("drm/mm: optimize rb_hole_addr rbtree search") Reviewed-by: Chris Wilson Link: https://lore.kernel.org/all/20200529201534.474853-1-arnd@arndb.de/ Signed-off-by: Arnd Bergmann --- This happens rather rarely, I just ran into it again and found my old patch. --- drivers/gpu/drm/selftests/test-drm_mm.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) -- 2.29.2 diff --git a/drivers/gpu/drm/selftests/test-drm_mm.c b/drivers/gpu/drm/selftests/test-drm_mm.c index b768b53c4aee..76973c72855e 100644 --- a/drivers/gpu/drm/selftests/test-drm_mm.c +++ b/drivers/gpu/drm/selftests/test-drm_mm.c @@ -324,9 +324,8 @@ static bool expect_reserve_fail(struct drm_mm *mm, struct drm_mm_node *node) return false; } -static bool check_reserve_boundaries(struct drm_mm *mm, - unsigned int count, - u64 size) +static noinline_for_stack bool +check_reserve_boundaries(struct drm_mm *mm, unsigned int count, u64 size) { const struct boundary { u64 start, size;