Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp374746ybh; Wed, 22 Jul 2020 02:55:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQwKSuRtmkjejsJaDh93KO3VUzE+TmPp5PVxF1oDs5P/T3IBFHBFKkc+S1o9EceMVgRoVH X-Received: by 2002:a17:906:d8db:: with SMTP id re27mr29041034ejb.554.1595411730983; Wed, 22 Jul 2020 02:55:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595411730; cv=none; d=google.com; s=arc-20160816; b=JhXF3MBbxdualrujFcUwVv6CWinIemIgejMf6/sxV2fzvpQkk1doezM1TtarQXek35 h4+Bj+JWldPAgZJgucYZV/EQZJ298r9UYwdfoQnCSuC5UwI32Ey3a9KfkFYgOAYP6ILF +VBFWrJHRfood+DXDP9GSX79kWg5opBnoN2T/JykOmTaC8yTIiJc9PhghsFC9m4BkIEm adq9TNDHGX3HcOdtJGxgTc31laeVI1CFXeIpxnuetDmr8ynEU8ocdgzhxCTuQJLe4PGH /pCMPV3/5PNNHGlAfG1I4gF+ine6hcRdobVBUv2hI6BMrInPTifr2HJkS5bobvnhkDh1 yArA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=NnGp80NPQTu2mI4cBw7kWXjSdKbhAuK7vytIEfdLi3A=; b=zL4FLQoUwI9cJSCpmLu3jabvdaX8Z4w/vlvvy/+5O+SVAPfmQqztyA6NBAltGHZbUA B+sTmt++DbI7+71d3PCTaYMTp2m/cOV9RCHhuZsUqv3oEbi78bxp9XWBdsxkRx4JbPKV qJhn7fBNz1IePHR/vksh0UL55IC8TaQmHqvVkwvVRvzUducUPfSu7ABJdUwhE957mLIY fU4Tqyxnd3DcrNtnB6+s8I4fxA+q+PH+7muh75lKUhC/cjoKD+NrXwNh0op9A3CIw5Nk yv2pBfLLi+DblKCy5/L9ZT2pL2NJx2Zl4134bccJmMiGPCrZx8/nQzK9n1CWnkgf3Qrq qhrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UXmQdCif; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r29si13982658edi.165.2020.07.22.02.55.06; Wed, 22 Jul 2020 02:55:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UXmQdCif; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729217AbgGVJwd (ORCPT + 99 others); Wed, 22 Jul 2020 05:52:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726147AbgGVJwd (ORCPT ); Wed, 22 Jul 2020 05:52:33 -0400 Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFE38C0619DC for ; Wed, 22 Jul 2020 02:52:32 -0700 (PDT) Received: by mail-wr1-x441.google.com with SMTP id o11so1255632wrv.9 for ; Wed, 22 Jul 2020 02:52:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=NnGp80NPQTu2mI4cBw7kWXjSdKbhAuK7vytIEfdLi3A=; b=UXmQdCifEmIxRngWqAYgwe3Ayp+g5td9CPnaXP/KMtwZIILHi8wltE9Mllv+KXVK7B 4aiPUr64nFFsvBz95wEeMSFjs5A7C6jm2l98aUF210EVYC73QoxDu4xQjDyy97nCSOua +UnMtEtmY68L7uYzQ7e3XMEqzO8aLJYp5kHNKk/60vkFUAYuDkfoQZgE7t9OpJVojQ0g mnshC0eQLuSqSpTZAqEJki37fIhQCOG1p64Uhl6GEmRw8pk6Fkamn+tYe6W4ZOTTo2ae 2BtpH59cR3VJg0Fm8Q4cmyF0se8mhRmBiQ8I9u3TjqDgyhnikyiIGUku3bsOb8U5NBm3 KLsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=NnGp80NPQTu2mI4cBw7kWXjSdKbhAuK7vytIEfdLi3A=; b=Hhtfdco9M+CTjpjcKm/lMtT/UKgMsfnTOu8ZsURbtvgqlwGemLF17KUc7xjdzfLYuO n3JRKLx+5IhTpIdP2NagWdAxNoq04AvWWV6f9kbwN9n51W/+jQT1lPq9zMJzMOYWlKtN eZ3SB8KJxBGoc42YZkMA1YZDLfUyWoEBUNMy0u12s+Hp028MF5llldMP3cSGNDufJo9F 8epo1Uuw+2m7UTP/a6FmkWnQ70KPo5UStj+WvaXt6ZETF5CcxKO7wxKs3V6Y5ALAGWuo BVuTo5SMMlpIEqlrwCretxEcvbvlB5HDX6rpWg4Ql0iWzRRezLhBo8gNKNXiB0d6YUsm LFpw== X-Gm-Message-State: AOAM531jLSUw38vPo919m8KzKG+lLwctRTMoNhVdtW64pjSA+bCj8Jhg A1PUOepiZGvn1eCgfriSC9bDCQ== X-Received: by 2002:adf:82e1:: with SMTP id 88mr28998520wrc.376.1595411551356; Wed, 22 Jul 2020 02:52:31 -0700 (PDT) Received: from dell ([2.27.167.94]) by smtp.gmail.com with ESMTPSA id j14sm40752327wrs.75.2020.07.22.02.52.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jul 2020 02:52:30 -0700 (PDT) Date: Wed, 22 Jul 2020 10:52:28 +0100 From: Lee Jones To: Andreas Kemnade Cc: linux-kernel@vger.kernel.org, j.neuschaefer@gmx.net, m.felsch@pengutronix.de Subject: Re: [PATCH v2] mfd: rn5t618: Make restart handler atomic safe Message-ID: <20200722095228.GJ621928@dell> References: <20200721073402.22925-1-andreas@kemnade.info> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200721073402.22925-1-andreas@kemnade.info> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 21 Jul 2020, Andreas Kemnade wrote: > The restart handler is executed during the shutdown phase which is > atomic/irq-less. The i2c framework supports atomic transfers since > commit 63b96983a5dd ("i2c: core: introduce callbacks for atomic > transfers") to address this use case. Using i2c regmap in that > situation is not allowed: > > [ 165.177465] [ BUG: Invalid wait context ] > [ 165.181479] 5.8.0-rc3-00003-g0e9088558027-dirty #11 Not tainted > [ 165.187400] ----------------------------- > [ 165.191410] systemd-shutdow/1 is trying to lock: > [ 165.196030] d85b4438 (rn5t618:170:(&rn5t618_regmap_config)->lock){+.+.}-{3:3}, at: regmap_update_bits_base+0x30/0x70 > [ 165.206573] other info that might help us debug this: > [ 165.211625] context-{4:4} > [ 165.214248] 2 locks held by systemd-shutdow/1: > [ 165.218691] #0: c131c47c (system_transition_mutex){+.+.}-{3:3}, at: __do_sys_reboot+0x90/0x204 > [ 165.227405] #1: c131efb4 (rcu_read_lock){....}-{1:2}, at: __atomic_notifier_call_chain+0x0/0x118 > [ 165.236288] stack backtrace: > [ 165.239174] CPU: 0 PID: 1 Comm: systemd-shutdow Not tainted 5.8.0-rc3-00003-g0e9088558027-dirty #11 > [ 165.248220] Hardware name: Freescale i.MX6 SoloLite (Device Tree) > [ 165.254330] [] (unwind_backtrace) from [] (show_stack+0x10/0x14) > [ 165.262084] [] (show_stack) from [] (dump_stack+0xe8/0x120) > [ 165.269407] [] (dump_stack) from [] (__lock_acquire+0x81c/0x2ca0) > [ 165.277246] [] (__lock_acquire) from [] (lock_acquire+0xe4/0x490) > [ 165.285090] [] (lock_acquire) from [] (__mutex_lock+0x74/0x954) > [ 165.292756] [] (__mutex_lock) from [] (mutex_lock_nested+0x1c/0x24) > [ 165.300769] [] (mutex_lock_nested) from [] (regmap_update_bits_base+0x30/0x70) > [ 165.309741] [] (regmap_update_bits_base) from [] (rn5t618_trigger_poweroff_sequence+0x34/0x64) > [ 165.320097] [] (rn5t618_trigger_poweroff_sequence) from [] (rn5t618_restart+0xc/0x2c) > [ 165.329669] [] (rn5t618_restart) from [] (notifier_call_chain+0x48/0x80) > [ 165.338113] [] (notifier_call_chain) from [] (__atomic_notifier_call_chain+0x70/0x118) > [ 165.347770] [] (__atomic_notifier_call_chain) from [] (atomic_notifier_call_chain+0x18/0x20) > [ 165.357949] [] (atomic_notifier_call_chain) from [] (machine_restart+0x68/0x80) > [ 165.367001] [] (machine_restart) from [] (__do_sys_reboot+0x11c/0x204) > [ 165.375272] [] (__do_sys_reboot) from [] (ret_fast_syscall+0x0/0x28) > [ 165.383364] Exception stack(0xd80a5fa8 to 0xd80a5ff0) > [ 165.388420] 5fa0: 00406948 00000000 fee1dead 28121969 01234567 73299b00 > [ 165.396602] 5fc0: 00406948 00000000 00000000 00000058 be91abc8 00000000 be91ab60 004056f8 > [ 165.404781] 5fe0: 00000058 be91aabc b6ed4d45 b6e56746 > > Signed-off-by: Andreas Kemnade > --- > Changes in v2: > - keep comments > > drivers/mfd/rn5t618.c | 43 +++++++++++++++++++++++++++++++++---------- > 1 file changed, 33 insertions(+), 10 deletions(-) Applied, thanks. -- Lee Jones [李琼斯] Senior Technical Lead - Developer Services Linaro.org │ Open source software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog