From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by gnuweeb.org (Postfix) with ESMTPS id CE65F7E2A9 for ; Tue, 1 Mar 2022 08:26:55 +0000 (UTC) Authentication-Results: gnuweeb.org; dkim=pass (1024-bit key; unprotected) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=w7cJw0GL; dkim-atps=neutral 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 ams.source.kernel.org (Postfix) with ESMTPS id CBEE7B817C1; Tue, 1 Mar 2022 08:26:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F136C340EE; Tue, 1 Mar 2022 08:26:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646123212; bh=TwhJPmV9y9c3eqT3zE3wD0HQcup9gYh9eXtwtOtu4EQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=w7cJw0GLrgvMVletWXAGP6NYKkLVc9SJg4Anj/PRy87gWz9cM9TPHo2vyESw4fNin WAUrVotZQVMP0A/c4VFlWPbg10DELaJEYtCFptAvCdTTi0FzoKnV9aqag/LwB+daVd Ag/8qLqQqiBEjuXASy363BhMQb7wiyxSd3Gb/kRI= Date: Tue, 1 Mar 2022 09:26:49 +0100 From: Greg KH To: Ammar Faizi Cc: Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Ingo Molnar , Thomas Gleixner , Tony Luck , linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org, gwml@vger.gnuweeb.org, x86@kernel.org, stable@vger.kernel.org Subject: Re: [PATCH v2 1/2] x86/delay: Fix the wrong asm constraint in `delay_loop()` Message-ID: References: <20220301073223.98236-1-ammarfaizi2@gnuweeb.org> <20220301073223.98236-2-ammarfaizi2@gnuweeb.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220301073223.98236-2-ammarfaizi2@gnuweeb.org> List-Id: On Tue, Mar 01, 2022 at 02:32:22PM +0700, Ammar Faizi wrote: > The asm constraint does not reflect that the asm statement can modify > the value of @loops. But the asm statement in delay_loop() does change > the @loops. > > If by any chance the compiler inlines this function, it may clobber > random stuff (e.g. local variable, important temporary value in reg, > etc.). > > Fortunately, delay_loop() is only called indirectly (so it can't > inline), and then the register it clobbers is %rax (which is by the > nature of the calling convention, it's a caller saved register), so it > didn't yield any bug. > > ^ That shouldn't be an excuse for using the wrong constraint anyway. > > This changes "a" (as an input) to "+a" (as an input and output). > > Cc: Thomas Gleixner > Cc: Ingo Molnar > Cc: Borislav Petkov > Cc: Dave Hansen > Cc: "H. Peter Anvin" > Fixes: e01b70ef3eb3080fecc35e15f68cd274c0a48163 ("x86: fix bug in arch/i386/lib/delay.c file, delay_loop function") You only need 12 characters here :) > Signed-off-by: Ammar Faizi > --- Why is this one not tagged for stable?