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 AC9FB3AE19A for ; Tue, 17 Mar 2026 11:49:54 +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=1773748194; cv=none; b=fFfm4n8Dq0E4pY52W7BK0rVB7/DETx1O5hs5XUs9ykCcsciO+dDxzFAFuq0YBhDzwECXzEenDCy/FW/LS1D1VJaD4u+8ddpELAGkSUuE15HLSPMmnb3zr9Vvf4b8CZT5nDWx6EcokiPaWjqEC7pr9iTmLLmS4cOaIpzgUtNvX44= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773748194; c=relaxed/simple; bh=eNV6TAX2CutyZq2rmhnK5T2FDvt09H1M4KfDdMHMSM4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KcwwMpoHrHFqzjI31IEyfIDfK4h7nYzXk+YL5s9qN6QVzouMdWsHmODI49KoUGQcoPskaK6xqrwgZAqg1Ii2bHczbGQ/0QrmJRxip2+/Z13agHz/oV0uJ8QXWdHLM1Vl2OYkRH90cYBnrtoBOQ0iyaiy4WMTZJYujibidOWFo14= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=HdVtgwZE; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="HdVtgwZE" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B5BCFC2BCAF; Tue, 17 Mar 2026 11:49:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773748194; bh=eNV6TAX2CutyZq2rmhnK5T2FDvt09H1M4KfDdMHMSM4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HdVtgwZEOdyc9swoVjfMWdAtJo5Pwkd062MmpMTeDfTeqLo6JaNNYrr320G5Jns4r flA9kwNT7i4rhlu5SLCI8pzl/G0Pl6di1v/80m+Cy3zIN25O/9aOJzoEoP2WipKquK fIzNx0xvnqVQRVY85ookN2zFshDuQb80arBx0/t9tAhEnN8OtR5Qxxuy4A5mKPh6C+ zVBT1VprDcqPIkOSCoWfHQn7hW1cdHFU4+nZA+RoUOmn8eo2HfH0mMCrVaB4nw1p9z /PNUhETGJ/PXb3ayuSkcWy3bxt0KcukdUv7lGdM5h+Ualz5LOpxKavGdDhwz24z+/y qDSjIilYg0n7Q== From: Sasha Levin To: stable@vger.kernel.org Cc: Penghe Geng , Adrian Hunter , Ulf Hansson , Sasha Levin Subject: [PATCH 5.10.y 4/4] mmc: core: Avoid bitfield RMW for claim/retune flags Date: Tue, 17 Mar 2026 07:49:49 -0400 Message-ID: <20260317114949.126875-4-sashal@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260317114949.126875-1-sashal@kernel.org> References: <2026031713-defeat-mobster-d0a8@gregkh> <20260317114949.126875-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Penghe Geng [ Upstream commit 901084c51a0a8fb42a3f37d2e9c62083c495f824 ] Move claimed and retune control flags out of the bitfield word to avoid unrelated RMW side effects in asynchronous contexts. The host->claimed bit shared a word with retune flags. Writes to claimed in __mmc_claim_host() or retune_now in mmc_mq_queue_rq() can overwrite other bits when concurrent updates happen in other contexts, triggering spurious WARN_ON(!host->claimed). Convert claimed, can_retune, retune_now and retune_paused to bool to remove shared-word coupling. Fixes: 6c0cedd1ef952 ("mmc: core: Introduce host claiming by context") Fixes: 1e8e55b67030c ("mmc: block: Add CQE support") Cc: stable@vger.kernel.org Suggested-by: Adrian Hunter Signed-off-by: Penghe Geng Acked-by: Adrian Hunter Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin --- include/linux/mmc/host.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 400556db06cb0..daed43b39b611 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -400,14 +400,12 @@ struct mmc_host { struct mmc_ios ios; /* current io bus settings */ + bool claimed; /* host exclusively claimed */ + /* group bitfields together to minimize padding */ unsigned int use_spi_crc:1; - unsigned int claimed:1; /* host exclusively claimed */ unsigned int doing_init_tune:1; /* initial tuning in progress */ - unsigned int can_retune:1; /* re-tuning can be used */ unsigned int doing_retune:1; /* re-tuning in progress */ - unsigned int retune_now:1; /* do re-tuning at next req */ - unsigned int retune_paused:1; /* re-tuning is temporarily disabled */ unsigned int retune_crc_disable:1; /* don't trigger retune upon crc */ unsigned int can_dma_map_merge:1; /* merging can be used */ unsigned int vqmmc_enabled:1; /* vqmmc regulator is enabled */ @@ -415,6 +413,9 @@ struct mmc_host { int rescan_disable; /* disable card detection */ int rescan_entered; /* used with nonremovable devices */ + bool can_retune; /* re-tuning can be used */ + bool retune_now; /* do re-tuning at next req */ + bool retune_paused; /* re-tuning is temporarily disabled */ int need_retune; /* re-tuning is needed */ int hold_retune; /* hold off re-tuning */ unsigned int retune_period; /* re-tuning period in secs */ -- 2.51.0