Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp101299rdb; Wed, 7 Feb 2024 23:31:47 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX0PFiAWoniTFififtep2HHJri+NrgveqBRyYW0ALltli/aQlfUHjwocgVqYib+DvL7V3Q6y3uM+Nf3B7dO/8ciUjt9gQLui9XLXU94/w== X-Google-Smtp-Source: AGHT+IH28I6B611BYKoUMTQGhgqlLEgjeJ/VOFWe+E7s6WlI3rE+nnUZg8YD4sW33s34z0xcMZ0N X-Received: by 2002:a05:6e02:1143:b0:363:ab28:7d14 with SMTP id o3-20020a056e02114300b00363ab287d14mr7630964ill.31.1707377506916; Wed, 07 Feb 2024 23:31:46 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707377506; cv=pass; d=google.com; s=arc-20160816; b=tfE3A8tnLCUskKLH7B3EOTTCNLN4SP0jk+DgpW+bebOUl89x6fvTbOyKN36pQirMI4 iHaPv/buvlcsumL9+DwanyC+O1tDcnPNePqohtO7uWjMovOIc1WRevwPnHg6srdv+a2k atsq9t6IX6iHQGm7LLfli8ajwzed0Kcsz4cOviv/Ok1jIWLXEPxdBw64n9e7V1EEq9VB VCVhyR/uRuXRiMPd8bMQjHLb20RJp8BcG/n35bMnyIW7L1SXPv8XpzS+V5V5Uu9xkL71 nVoe0L+XY32aaj2seqvZyYaBgGeFF3XELCDTnIWp5owsQZVgEKoitgp5vreN/UaOpVKM +Fdw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=lzbz1GNhahpMkNP7h5Kr7JjPzEoxKQtweREGWC1/SkI=; fh=PTWCsDrkuyzr5MsdMrBK6TkBPyvHqwSZsRc6uOa7rnA=; b=EBa8WD3bmt14ORZZEot5GeifoUD5iUnnB9Oda8FXunFsBBN4WqaILPlHb1rCrdJWaR +yDyxpQOHt/jufe7S4P1AW9TnkldsCKghFXd0gpIZEWeeoWyLsk0S8Mh7v81nAeyC7EU ouPPw8fTKwg2gk7lzVJwBSjH0A9SdFk5+StEhP7wN5wjWxsBLjRR+gZg8nnE/gCNP87E jPaB2lihOnLthOcaLEHwJ0rUg8LUv7qOagmuVNS/BmwXqSyJc731Y+Sjb3jYrcs1hT3j QHjSNTGlWxghbr+6oUiRVGTpFAUwYEVnrKd9OWS52FFsKcf4/S3U6bTwHtZeTBkqg53M i6Jw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b="dRLt9hr/"; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-57558-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-57558-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com X-Forwarded-Encrypted: i=2; AJvYcCXp6FesHtdmZuD8Xj1BqeyiDvgfW3nMU76l405qe8UmsGewAowwCEi7JqLnOE2ya8S/EkF66fMGsIQPcfdwKNe3QbZWmqiiVL3wx7RG4A== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id y66-20020a636445000000b005cf268638edsi3398190pgb.177.2024.02.07.23.31.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Feb 2024 23:31:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-57558-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b="dRLt9hr/"; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-57558-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-57558-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 846F52873A7 for ; Thu, 8 Feb 2024 07:31:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9E4C3692F1; Thu, 8 Feb 2024 07:31:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="dRLt9hr/" Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (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 8D25C67A0F; Thu, 8 Feb 2024 07:31:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707377493; cv=none; b=NGADtznBzbzVOfq/6KswFBPF+CsN103LSl1tJfy0BIr7lRsp5Qb9iLHAqkRm0op7KaUdYmdu/xcLWfQQkPuL7KA/2Cbc17qsoIBlDEdjJqsWKTeao79PgZY2lgd56QArsoEBQIDqwkXg5OK+KkykEeqSX45oPlsA/PaC8WTECsc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707377493; c=relaxed/simple; bh=SNhkKnZ7sr8GDFAjdsVQk/H/wcAOE3G/rN1aQC5b0dc=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=VQTM8wjQMcxj9DLjtV40+ONtU5ZQwjcULfU7mVqz9kChvgvsmcEWVeIXu1yRxq9UDspLKoDuwd3IuaEuFXZCMD23YtYIupDsJ+9Rm/Y8c6lgOkvtkGyGAYCk2t15s5DJSfMwCs/tIo+ZGhOICZTIDY8J+yRdKudu2gNShAVGK+A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=dRLt9hr/; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41860Bac027492; Thu, 8 Feb 2024 07:31:26 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= message-id:date:mime-version:subject:to:cc:references:from :in-reply-to:content-type:content-transfer-encoding; s= qcppdkim1; bh=lzbz1GNhahpMkNP7h5Kr7JjPzEoxKQtweREGWC1/SkI=; b=dR Lt9hr/Y7IGmbQO8ifGuJr+PGXoa56JHkFBG1CZwuR7I0RD3fCZOYEQP6MWhdfUgf EqAEZKJs6ShghWTBYT3uk9vAt6b3OyHsqvjFKgHpwDeZnwQ9cNcz0SYu4HIy5cgX VkcHQtm3k3+DTJ8bEgh8jraWoBIPv/TE8XdzctqPDHEdg3EAirvV6ttCvvEJQVOi 90s9f/q2pt2EpK0acS70y7eahmFLj1N7LLTP+/zDYQGKX7u0rvlxhy6tI1J7LK4O FzMOMIOG4ZTtEmJFzan9XWp88Ix5ooCvhNdAWDG70td4Fp55FX2kMqJTyaBqUXqy MlhPKlKfxPbrmYZ2Sp2Q== Received: from nasanppmta04.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3w4frwse51-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 08 Feb 2024 07:31:26 +0000 (GMT) Received: from nasanex01a.na.qualcomm.com (nasanex01a.na.qualcomm.com [10.52.223.231]) by NASANPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 4187VPXE017903 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 8 Feb 2024 07:31:25 GMT Received: from [10.239.132.150] (10.80.80.8) by nasanex01a.na.qualcomm.com (10.52.223.231) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Wed, 7 Feb 2024 23:31:20 -0800 Message-ID: <84de6e73-31a1-4ae2-afe1-71e9947a22c0@quicinc.com> Date: Thu, 8 Feb 2024 15:31:18 +0800 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 v4] pinctrl: Add lock to ensure the state atomization Content-Language: en-US To: Linus Walleij CC: , , , , References: <20240202105854.26446-1-quic_aiquny@quicinc.com> From: "Aiqun Yu (Maria)" In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nasanex01a.na.qualcomm.com (10.52.223.231) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: 0OuElrODJEJaWKo016xQk7bkhnlT5F_3 X-Proofpoint-GUID: 0OuElrODJEJaWKo016xQk7bkhnlT5F_3 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-08_01,2024-02-07_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 malwarescore=0 spamscore=0 suspectscore=0 bulkscore=0 phishscore=0 clxscore=1015 lowpriorityscore=0 mlxlogscore=826 adultscore=0 priorityscore=1501 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2401310000 definitions=main-2402080038 On 2/7/2024 6:51 PM, Linus Walleij wrote: > On Fri, Feb 2, 2024 at 11:59 AM Maria Yu wrote: > >> Currently pinctrl_select_state is an export symbol and don't have >> effective re-entrance protect design. During async probing of devices >> it's possible to end up in pinctrl_select_state() from multiple >> contexts simultaneously, so make it thread safe. >> More over, when the real racy happened, the system frequently have >> printk message like: >> "not freeing pin xx (xxx) as part of deactivating group xxx - it is >> already used for some other setting". >> Finally the system crashed after the flood log. >> Add per pinctrl lock to ensure the old state and new state transition >> atomization. >> Also move dev error print message outside the region with interrupts >> disabled. >> Use scoped guard to simplify the lock protection needed code. >> >> Fixes: 4198a9b57106 ("pinctrl: avoid reload of p state in list iteration") >> Signed-off-by: Maria Yu > > Thank you for rebasing! > > Patch applied now, so we get some shakeout in linux-next and can > make sure it works for everyone. Feel free to add me into any thread related. Also I will try to pay attention from the email list. :) > > Yours, > Linus Walleij -- Thx and BRs, Aiqun(Maria) Yu