Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1074574rdb; Mon, 19 Feb 2024 03:35:16 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUXoYIldvMcxuQbe6yYUXYjwb6QTufFNOrAsTZ36Q2XQTwxk6pLc8kKK9Z8Lm35B2FFGH5ATLwknqpms3UXHxOhs5GKyEJi+m2dk2+Ylw== X-Google-Smtp-Source: AGHT+IH1HBiRGhUumK0CA6uOjGSSUojO5d/aSniGYPk1zj+GWHgfvFyWyStpyfCXTzbw5TdZefjs X-Received: by 2002:a05:6e02:c73:b0:365:f79:baa8 with SMTP id f19-20020a056e020c7300b003650f79baa8mr8700788ilj.23.1708342516147; Mon, 19 Feb 2024 03:35:16 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708342516; cv=pass; d=google.com; s=arc-20160816; b=mALr1EWOP9mKTBf/JT8Q6xM/t8HqZIuhcI50ZwC1YtuBISu9rzJ+Mqp0V5GBtBDFfY bEnXiqWl+mKYlu2ANKLi6Plq/FJ/dr6TGsE+6DVBbFMzRgLHHAsddmVhGDYJ0cBgrJZN YaV3jha0RmScGbpUPg6fyLQwYrjCfan8cOpKIE9HAQ8CZQg6JWi3Dh5wilVwKRCHt4Sl GcmIAj89QnfUOSMGtShCx53ucbm5cgWzjTmMaLbmcLUHIn8PpFt5cz1USdMA7JYkTHed qWwU+624EhP86XfLnDYJtrw8n/GdWwuYOQleL+f07ZI1u167KIDPYlKDcRK/MNsLoz00 9nog== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature:dkim-signature:dkim-signature :dkim-signature; bh=Sxr37yjvsBDH8ImiBOjxjncGbh787kSDIXFry4Onmac=; fh=DpTJSJjZ8c1vbtUEaSoxVL5MKf+lGy/wZSlwEeAE9EU=; b=NxJUkw1mui96f6+xIzZCOjqJJumUyeBNqJqGU62dgdDIYtMg7bmeJQe+9v84Usn9to S3lYX/uoY1djN1DLWWCFDsDHdN3OKwfznbsRXXHFtUnoe+owx4i06q4c3PZpK4oCte5o eeKSgcQfGlHDGphunqx4WCekX+q8ZNbsvoWC+N95Mny5x+MSAc3qXO0lv+zROHGVqIT7 ulr+x++hs6jzpRhl4wMnDEPQ4i9swGIWFZ5LCN2U+9LJBg3PzAcqf7EbNz8oV34FTFu9 7RrpprYo7nZ2b1rN0q3k/FGAnOoc/mX+bkdUdTSya/4ZDCHqKL7ruXyAfOLcduUlM2zk 4s6g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b="dk+P21/i"; dkim=neutral (no key) header.i=@suse.cz; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b="wQMfl/kC"; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.cz dkim=pass dkdomain=suse.cz dkim=pass dkdomain=suse.cz); spf=pass (google.com: domain of linux-kernel+bounces-71213-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71213-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id f28-20020a63381c000000b005dccf9bcaa5si4173882pga.597.2024.02.19.03.35.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 03:35:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-71213-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b="dk+P21/i"; dkim=neutral (no key) header.i=@suse.cz; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b="wQMfl/kC"; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.cz dkim=pass dkdomain=suse.cz dkim=pass dkdomain=suse.cz); spf=pass (google.com: domain of linux-kernel+bounces-71213-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71213-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id DF724282731 for ; Mon, 19 Feb 2024 11:34:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7306B2C690; Mon, 19 Feb 2024 11:34:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="dk+P21/i"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="ty+8KCsT"; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="wQMfl/kC"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="h/46827Y" Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 166592C1A4; Mon, 19 Feb 2024 11:34:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708342488; cv=none; b=T6SSid9D5HlHTzbI8eG367FOUKXkweLHigvIFIDd4Pzg3YBtUJkkQ17Obhv0J7FJs04mHtI0fg2QHIirt/bRRHMldnRafWN9+rH1Z2AsVRU5Nuun8sreNV2TyM/yis6CQOLY2mvVKB5tegvXspsnZ3FVB4QsbByeXdrASck+ZZo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708342488; c=relaxed/simple; bh=04zZQvErufDHrsOkOYmWa71v/CV/vTUEjZZ/qUxq2hs=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=odUoMM+vI7G/7lxFKXZ/k9zLmfEp1tpgymbELxn2PvH8AS14svm/CfYw2Ra8haWtnlwyJv3ryfVqWsPiMsvENJW6x9aEfmOYU7W74tlkwcbD3oYGoZphgvkqVj0q0a/ziGsd0IZKn4yiCciPjIgo6tadPLG+p1nhyinh3//YFiw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz; spf=pass smtp.mailfrom=suse.cz; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=dk+P21/i; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=ty+8KCsT; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=wQMfl/kC; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=h/46827Y; arc=none smtp.client-ip=195.135.223.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.cz Received: from imap2.dmz-prg2.suse.org (imap2.dmz-prg2.suse.org [10.150.64.98]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 6116E1FD0F; Mon, 19 Feb 2024 11:34:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1708342484; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Sxr37yjvsBDH8ImiBOjxjncGbh787kSDIXFry4Onmac=; b=dk+P21/iZjdfWn1OMr58LZnfRoDNJTOmLtmGN1+2VeomfGvmKRppzti0v5qXd/Q03Xf2Fg C8QltB8mRQHRiatUwi3RZaV24EFAxUtYACmEgiFn5zdcL4/qs739dHXoY2N9bh/ESHI5BZ ypDkhVpmtYeHkZRyga1261rfb79laqw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1708342484; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Sxr37yjvsBDH8ImiBOjxjncGbh787kSDIXFry4Onmac=; b=ty+8KCsTwu+4P1tXchJB/zd9m+HPb2ztbLnMkiSsh1ee4/ZsRMQCmclrtLUXEtAr968ISP 0pHv51k6REhAUaDg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1708342482; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Sxr37yjvsBDH8ImiBOjxjncGbh787kSDIXFry4Onmac=; b=wQMfl/kC8LYtLbRSxqJXIbM12ekeEdeqIBXvBHVD6Y5Cs1QO/pjnemurukXSO1QOfKE6b0 5KKfQA2D1UOVd3y3yz1nOSipqEvqXrN/ySHoGG4gbfT6tUEn8nEmuI0GT7LrXbCU6qRsfL rwPmYN5BMSdtna1mCLUCTbVozWCdJLY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1708342482; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Sxr37yjvsBDH8ImiBOjxjncGbh787kSDIXFry4Onmac=; b=h/46827Ys+ElhiiA4KhHcwVXMyzywj/2kcYR6KPT5sTOm8njw/mFhKE2zEtrWF036CEem3 ruaVIjSZ+O2HKDBw== Received: from imap2.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap2.dmz-prg2.suse.org (Postfix) with ESMTPS id 5196A13585; Mon, 19 Feb 2024 11:34:42 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap2.dmz-prg2.suse.org with ESMTPSA id /56mE9I802VDawAAn2gu4w (envelope-from ); Mon, 19 Feb 2024 11:34:42 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id E5B27A0806; Mon, 19 Feb 2024 12:34:37 +0100 (CET) Date: Mon, 19 Feb 2024 12:34:37 +0100 From: Jan Kara To: Arnd Bergmann Cc: Alexander Viro , Christian Brauner , Arnd Bergmann , Jan Kara , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Kees Cook , Andrew Morton , Andi Kleen , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: Re: [PATCH] fs/select: rework stack allocation hack for clang Message-ID: <20240219113437.y7vxeyhvjnxo7rlh@quack3> References: <20240216202352.2492798-1-arnd@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240216202352.2492798-1-arnd@kernel.org> Authentication-Results: smtp-out2.suse.de; none X-Spam-Level: X-Spam-Score: -0.80 X-Spamd-Result: default: False [-0.80 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCVD_COUNT_THREE(0.00)[3]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-0.998]; RCPT_COUNT_TWELVE(0.00)[15]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; MID_RHS_NOT_FQDN(0.50)[]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-0.00)[43.66%] X-Spam-Flag: NO On Fri 16-02-24 21:23:34, Arnd Bergmann wrote: > From: Arnd Bergmann > > A while ago, we changed the way that select() and poll() preallocate > a temporary buffer just under the size of the static warning limit of > 1024 bytes, as clang was frequently going slightly above that limit. > > The warnings have recently returned and I took another look. As it turns > out, clang is not actually inherently worse at reserving stack space, > it just happens to inline do_select() into core_sys_select(), while gcc > never inlines it. > > Annotate do_select() to never be inlined and in turn remove the special > case for the allocation size. This should give the same behavior for > both clang and gcc all the time and once more avoids those warnings. > > Fixes: ad312f95d41c ("fs/select: avoid clang stack usage warning") > Signed-off-by: Arnd Bergmann Looks good (if this indeed works with clang ;). Feel free to add: Reviewed-by: Jan Kara Honza > --- > fs/select.c | 2 +- > include/linux/poll.h | 4 ---- > 2 files changed, 1 insertion(+), 5 deletions(-) > > diff --git a/fs/select.c b/fs/select.c > index 11a3b1312abe..9515c3fa1a03 100644 > --- a/fs/select.c > +++ b/fs/select.c > @@ -476,7 +476,7 @@ static inline void wait_key_set(poll_table *wait, unsigned long in, > wait->_key |= POLLOUT_SET; > } > > -static int do_select(int n, fd_set_bits *fds, struct timespec64 *end_time) > +static noinline_for_stack int do_select(int n, fd_set_bits *fds, struct timespec64 *end_time) > { > ktime_t expire, *to = NULL; > struct poll_wqueues table; > diff --git a/include/linux/poll.h b/include/linux/poll.h > index a9e0e1c2d1f2..d1ea4f3714a8 100644 > --- a/include/linux/poll.h > +++ b/include/linux/poll.h > @@ -14,11 +14,7 @@ > > /* ~832 bytes of stack space used max in sys_select/sys_poll before allocating > additional memory. */ > -#ifdef __clang__ > -#define MAX_STACK_ALLOC 768 > -#else > #define MAX_STACK_ALLOC 832 > -#endif > #define FRONTEND_STACK_ALLOC 256 > #define SELECT_STACK_ALLOC FRONTEND_STACK_ALLOC > #define POLL_STACK_ALLOC FRONTEND_STACK_ALLOC > -- > 2.39.2 > -- Jan Kara SUSE Labs, CR