From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) (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 9BFF2362143 for ; Wed, 20 May 2026 16:44:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779295490; cv=none; b=AFrvip/BxnoGX5rboHlXgdO8ufv7ipPOQ3dz5iZZ/7dhpMBEls5XSX+96zIeHAlnbzwMQaPtmzBwIBA6AQXLlRp9ko5rz6N1Mt8sHKov503aEOfSdESh5rC+rc95PgGDLys7xCLUVIpd4RVn/Nc0vSLMBVl8n/CTNiYuLB3/nBc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779295490; c=relaxed/simple; bh=5bD+8kQCvsBJwvio8J+ONYs68ydymK7KFx9Ur+b2V04=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=opv8og8ySE+89Zw+9lbug6WAFcl1R8MoDcQG6sjgC0J7FWIhvCmpvQZrpN1cydm1H9V5HQCpwvm+SHsk37ebax/5GW3WPssckzlHNBgFWs89gn2eyuz6qbg949GyTgK4Uwn8iGHB0FmO0AuoF0XDAmien8ujyY3YGLMzJyPCox4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=nsOtRvXL; arc=none smtp.client-ip=209.85.221.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nsOtRvXL" Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-44a044cb827so3721945f8f.0 for ; Wed, 20 May 2026 09:44:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779295487; x=1779900287; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=R0simBUITpJ94FD8/rlgEoQYzs3fEqZ4WjqfFO1n/CM=; b=nsOtRvXLNTxhe8BXFAxzqNHrnXARmpZdxHa6x1S8RJ9bsmiXP32XigrwomA7eRGdeR jLOHR1g3lKgGft+Qnwac7hL8pRR9u9h11SfXtFfOrEkxDb61lhBNn90KvrdpkDh/gQ7/ AL+wYm9EkNc2qMuVFFTIKa8TJn/dVB5YJDqRBU8FT9tc/e6IA3ePnPzqLXaSPDtOI4YZ HyZKhbf5AlgIR6Nf9GjaWDqMHMhZn1vN2Hzb9uXYf60JJq65jpkRdIB3lrqZQI8d6DlT 7Eo+8D6/qp3w4PisYBMCLl8cJg+OEjVte6h0Jba8yF5PYjPOrQLmVXzaWIULEIecb6mD 6sEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779295487; x=1779900287; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=R0simBUITpJ94FD8/rlgEoQYzs3fEqZ4WjqfFO1n/CM=; b=ort8S6FeWMM6nXL6MuQkKZhsNlMJgnpz4iQa6sN+h8Qsa0/GKaOcmFYxaaQABITp83 flFqHiseHdsCNb9fCm6+PzAwzJWUeBi2u62TnwKyQjkzi7HQ4oKV9O2Fyu5EaStboKc4 Jlb4GYaaW3zoWrZ9IIR6Y+g7GnoOK40NJKzbKvUd+rNoSoJ7NtIQL1xe2FxX/u1nTfoC /hlW6vY5HwVjLzhSa/ZGIpZsOBbeV5YMN1CipAnSZGOrIV2qIuy+Ea+ReDTKNmBvwRHM klHKj+D5E2KN3XxSX4Cy+9GBIE6SXNzJYLcnSodY8Edsj5mOV/odgxSP0R4iC8hjzWg8 yoww== X-Forwarded-Encrypted: i=1; AFNElJ/z4JbPeFdoAy2rCts50GxinVTkzLXTH+kxCkNyVcFAvTtLapSNL/JYDNTI+uH52pJfHrqm9Eb7tve/S1o=@vger.kernel.org X-Gm-Message-State: AOJu0Yx4Ri+3qip8MmVK8Xg58zk+7kGYMO4LqQ4FNq7Yxnn4WOOdLfa9 oHWjbS8yUZfx5VINAg86x6v9qnQ33S7+xSDNj8wKenJ/R7qOBbLBthDoNJsqlg== X-Gm-Gg: Acq92OFMN64iV2ztCLReOsFMbt79bFjlUhhtQMveR17ZBCNzBNkfm8EGUyk2U80ODS/ PviCTF0ewoQ4vAK4sHEuIPT7+hZdrcVzm7VHJoR9xT3gqqm0NCv+JJ9OlLLM7+hz/Mw+E608S9S H95jiovAy8D7Hd+YBYafbWvRjYWSlyZitxsoau8aLGaJfVsK3BydA8TwXOfu61U0vMlGGccaVwf V2/y6tRWibTu9151AjR510WiEyV7c4+K79/T8KYYZUG8XTI90tZtKDJltiHifdcDXOcZC/yFzMn 45HGcb+0Nje+WLXCzUiTOKRp7MimW/21CL0Xso/IKBP4cCAM6mUq+phBqrlaSeaTYVL01xfXcKv JuHl49CACroEw5M4gZdhY0mY9KwFATpOB1tHQlD1oqGUvuuIk8/jDXCqhHfcv2QSpre6fRq5vaQ JlS4CCjqiHn67o7Gp2qH/HgeuB2NpWhHRhNqmw+zAOIDapD4j2is9MPW5tRkzORJAc X-Received: by 2002:a05:6000:2383:b0:449:9aee:4575 with SMTP id ffacd0b85a97d-45e5c5ccbf6mr41532748f8f.30.1779295487009; Wed, 20 May 2026 09:44:47 -0700 (PDT) Received: from [192.168.2.178] (109-252-156-195.dynamic.spd-mgts.ru. [109.252.156.195]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-45d9ec3b18fsm50797773f8f.11.2026.05.20.09.44.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 20 May 2026 09:44:46 -0700 (PDT) Message-ID: <286ebc23-944a-4374-8128-3511c68cd1bf@gmail.com> Date: Wed, 20 May 2026 19:44:44 +0300 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] mfd: max77620: Avoid regmap mutex deadlock in power-off handler To: Mark Brown , Lee Jones Cc: Diogo Ivo , linux-kernel@vger.kernel.org, stable@vger.kernel.org References: <20260520-max77620_poweroff-v1-1-9186a3bcbe9e@tecnico.ulisboa.pt> <38f5201a-6b52-4f18-bbbe-775171a3f147@tecnico.ulisboa.pt> <20260520161900.GM2767592@google.com> <3b2b25f9-3ab5-4811-9945-f317b8788484@sirena.org.uk> Content-Language: en-US From: Dmitry Osipenko In-Reply-To: <3b2b25f9-3ab5-4811-9945-f317b8788484@sirena.org.uk> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 20.05.2026 19:23, Mark Brown пишет: > On Wed, May 20, 2026 at 05:19:00PM +0100, Lee Jones wrote: >> On Wed, 20 May 2026, Diogo Ivo wrote: > >>> This patch was motivated by the Sashiko review I got in [1]. Its point >>> here is that there is a possibility for a deadlock scenario in which >>> a secondary CPU obtains the mutex for the regmap and then smp_send_stop() >>> is called before this secondary CPU gets a chance to release the mutex, >>> making it so that when the primary CPU tries to acquire it to issue the >>> write it hangs. Is there something that I am misunderstanding here? >>> > >> It's my understanding that using the Regmap wrappers _prevents_ locking >> issues, rather than causes them. > > In the case where the CPU is being powered off during a regmap write > there is a potential issue - as Diogo says if we're in the middle of > holding the lock and we power off the CPU that owns the lock then it > will never be able to release the lock. I would expect the same issue > to apply to a bus like I2C or SPI though, they'll hold a lock while > they're in the middle of doing bus I/O unless you use some special API. Sounds bad Diogo, check if shutdown works with added nosmp to kernel's cmdline. BTW, you can use i2c_smbus_read_byte_data+i2c_smbus_write_byte_data to keep the old regmap_update_bits behaviour.