From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 2BA8728D066 for ; Tue, 4 Mar 2025 16:43:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741106596; cv=none; b=NNWxsR8JIcG9+Qzcp0mTNZ3kBjLQ6j2o4RHVQgwcvxw6EwTtZIzeX5AylsI+v124k3i/vVxYM3GSQCC3/nFFqs3NucubtTf/4BNvZaQ3MKYG4tSBS1CbXnjnaPpQtb0PK3Rdi8RPUcZ8FwTdjVaA9dO+W1srNiaI6SR8CaAghhE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741106596; c=relaxed/simple; bh=G1tFmNbMm5lrIP3DHa1cDuvA+a3VJrGfeszUKa51cuM=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=WY2ys2PzadGmVOyorSmFhYOC+idsIM8iF0Csp0cAcNep6k+YzO9AKNwk3fkSrwUpggOyDl/UPew+bQPWG4l3zEj8nUE52NzXEiLK9yarYLEkh7JPXWNQnaL/z6pQpcJOmDmTbKwaUmpZtzYiuI+TfKfBLRYSVAreE7pjXWt+fjc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=lzZfG2Bb; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="lzZfG2Bb" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A672BC4CEE5; Tue, 4 Mar 2025 16:43:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1741106596; bh=G1tFmNbMm5lrIP3DHa1cDuvA+a3VJrGfeszUKa51cuM=; h=Subject:To:Cc:From:Date:From; b=lzZfG2BbK400W8wlCWs/CGUZuRxWKaNxwTNl4bE1Lb8csueqx6eOceG/lmJuta1HX Qy00TUi9NKfUnOlW2sCtf8CBoeYQIVa6R2NEAHd7haocXuQ2DofhrL0AKbKhl1/UCu K+5j/VocqLPQjzojuo4+tnH1ZOnzEur6ikpCzadE= Subject: FAILED: patch "[PATCH] riscv/atomic: Do proper sign extension also for unsigned in" failed to apply to 6.6-stable tree To: schwab@suse.de,ajones@ventanamicro.com,alexghiti@rivosinc.com,palmer@rivosinc.com,xry111@xry111.site Cc: From: Date: Tue, 04 Mar 2025 17:43:08 +0100 Message-ID: <2025030408-python-steerable-a903@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 6.6-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.6.y git checkout FETCH_HEAD git cherry-pick -x 1898300abf3508bca152e65b36cce5bf93d7e63e # git commit -s git send-email --to '' --in-reply-to '2025030408-python-steerable-a903@gregkh' --subject-prefix 'PATCH 6.6.y' HEAD^.. Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 1898300abf3508bca152e65b36cce5bf93d7e63e Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Thu, 30 Jan 2025 10:25:38 +0100 Subject: [PATCH] riscv/atomic: Do proper sign extension also for unsigned in arch_cmpxchg Sign extend also an unsigned compare value to match what lr.w is doing. Otherwise try_cmpxchg may spuriously return true when used on a u32 value that has the sign bit set, as it happens often in inode_set_ctime_current. Do this in three conversion steps. The first conversion to long is needed to avoid a -Wpointer-to-int-cast warning when arch_cmpxchg is used with a pointer type. Then convert to int and back to long to always sign extend the 32-bit value to 64-bit. Fixes: 6c58f25e6938 ("riscv/atomic: Fix sign extension for RV64I") Signed-off-by: Andreas Schwab Reviewed-by: Alexandre Ghiti Reviewed-by: Andrew Jones Tested-by: Xi Ruoyao Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/mvmed0k4prh.fsf@suse.de Signed-off-by: Palmer Dabbelt diff --git a/arch/riscv/include/asm/cmpxchg.h b/arch/riscv/include/asm/cmpxchg.h index 4cadc56220fe..427c41dde643 100644 --- a/arch/riscv/include/asm/cmpxchg.h +++ b/arch/riscv/include/asm/cmpxchg.h @@ -231,7 +231,7 @@ __arch_cmpxchg(".w", ".w" sc_sfx, ".w" cas_sfx, \ sc_prepend, sc_append, \ cas_prepend, cas_append, \ - __ret, __ptr, (long), __old, __new); \ + __ret, __ptr, (long)(int)(long), __old, __new); \ break; \ case 8: \ __arch_cmpxchg(".d", ".d" sc_sfx, ".d" cas_sfx, \