From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 16BB53DFC84 for ; Mon, 4 May 2026 14:58:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.92.199 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777906695; cv=none; b=r7nwEfUvwyOsyDc+0fJJu0e1dm9YQIbd0UBlUdxrTT0YA30XlctvtabNdEHjwO5lDFFNaLngIYHnHXFCJRsibDsZNMkaT5+32a+eGutI4o1Sue0ShmZPBDNGCVYcKynDQozsDSXYe3h/oXB0+MklKUCMMdtNSNRVJ/UWPjNK3XI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777906695; c=relaxed/simple; bh=/w7yuIAPm8twP7VtQhmxf3eOjjWIyE6VOWLZVPr/u2c=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=c7tPQcmbu4EpcijFvquFghPhascAQnWuYUNf3yUBGVEAt87CKmq3eQO/Nuqo77k+vub9FqLJytrHonQzzUJUEOyUS0pdTiZqMZJsbQo609gKP/DvlmeQ8ixquLcUIEcEbrfBoufRoA31i92pXTRKWPy/Honn37/M50ZDwCpfVqE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=Z+R7+Lss; arc=none smtp.client-ip=90.155.92.199 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="Z+R7+Lss" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=6gpjaZNni0ybNq5qrKCkdiI8eodmlg30/zkdlZcruFA=; b=Z+R7+Lss/ccTDUwiBdXgQoG2vW aocIqkHG61kgkn/IHGRoICFo4jn/rGnUJQpZ5iMQaPuTcVTaVWF0hZJMPbpI+hNsd0PhAmfjyw61c x2DMM3ew4vcRiK43dH9hoZsa2e1Ze2L7qk7tIefw2psjFvSocXGXl34gzK3e+W3MXlZMUOFrF8Nl7 yP0GNpbzfS5CCpQyzbAAjhJfSMp0uVoWrECdYtOpCj59s4kMA+YEFn3UHDj2V7Il0D64ZzSIcBvz6 9SDjaNSFzj3GVjUNskM7pqQEGHdNpL9faLCr7BKY2iy7EBT2BAYS+MVnd6OicVuImZ0DgGZyXdP1e m/pMqDWQ==; Received: from 2001-1c00-8d85-4b00-266e-96ff-fe07-7dcc.cable.dynamic.v6.ziggo.nl ([2001:1c00:8d85:4b00:266e:96ff:fe07:7dcc] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.98.2 #2 (Red Hat Linux)) id 1wJuk9-0000000Bji5-2v4r; Mon, 04 May 2026 14:57:57 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 6567B300969; Mon, 04 May 2026 16:57:56 +0200 (CEST) Date: Mon, 4 May 2026 16:57:56 +0200 From: Peter Zijlstra To: Heiko Carstens Cc: K Prateek Nayak , Zhan Xusheng , Ingo Molnar , Vincent Guittot , Juri Lelli , linux-kernel@vger.kernel.org, Zhan Xusheng , Dietmar Eggemann , Valentin Schneider , Ben Segall , Steven Rostedt , Mel Gorman , gor@linux.ibm.com, agordeev@linux.ibm.com, borntraeger@linux.ibm.com, svens@linux.ibm.com, maddy@linux.ibm.com, mpe@ellerman.id.au, chleroy@kernel.org, Stefan Schulze Frielinghaus , Juergen Christ Subject: Re: [PATCH RESEND] sched/fair: Fix overflow in vruntime_eligible() Message-ID: <20260504145756.GL1026330@noisy.programming.kicks-ass.net> References: <20260415145742.10359-1-zhanxusheng@xiaomi.com> <20260428144951.121765-1-zhanxusheng@xiaomi.com> <57e94d7e-b8fb-49bc-a914-8a7401e43af3@amd.com> <20260428173521.GK3126523@noisy.programming.kicks-ass.net> <4870ea19-78d4-44b2-9f18-14c3f8782726@amd.com> <20260501104006.GA3102624@noisy.programming.kicks-ass.net> <20260504112239.GA1174357@noisy.programming.kicks-ass.net> <20260504131609.132896A0b-hca@linux.ibm.com> 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: <20260504131609.132896A0b-hca@linux.ibm.com> On Mon, May 04, 2026 at 03:16:09PM +0200, Heiko Carstens wrote: > On Mon, May 04, 2026 at 01:22:39PM +0200, Peter Zijlstra wrote: > > On Fri, May 01, 2026 at 12:40:06PM +0200, Peter Zijlstra wrote: > > > > > Anyway, I had a poke around with godbolt, and the below seems to > > > generate the best code for things like x86_64 and arm64. > > > > > > Specifically, the __builtin_mul_overflow() already has to compute the > > > 128 bit product anyway for most architectures, so using that directly > > > then leads to saner asm and easier to understand code. > > > > > > AFAICT HPPA64 is the only 64bit architecture that doesn't implement > > > __int128 and will thus be demoted to doing what we do on 32bit. > > > > I forgot we had ARCH_SUPPORTS_INT128, and I suppose this had better > > check that. Now, s390 is a bit weird and excludes GCC even though that > > definitely supports __int128. Supposedly there was a issue, but perhaps > > modern GCC has this fixed? > > The reason was not a bug (in terms of incorrect code), but gcc generated a > larger than 6kb stack frame for one of the crypto functions - see commit > fbac266f095d ("s390: select ARCH_SUPPORTS_INT128"). That's just too large to > be acceptable. > > If I remember correctly gcc generated code which did not reuse known to be > unused stack slots, but created for every variable a new stack slot, for > whatever reason. Which then resulted in such a huge stack frame. With clang > the stack frame size was only 1,5kb. > > I just checked: with gcc 15.2.0 we are down to 4.5kb. Still too large :) > > Adding s390 compiler folks; but I seem to remember I discussed that back then > with them. Right, I had indeed found that commit, but since it was from 2023, I had some hope that gcc-1[56] might have it resolved already. Oh well.