Received: by 10.223.185.116 with SMTP id b49csp1297399wrg; Fri, 23 Feb 2018 15:46:50 -0800 (PST) X-Google-Smtp-Source: AH8x226i1LaoOFe4WFp3q2sqbR+X8ieROhEgfOdcrfnESh2PCbR7G1x23HcQSTVIcIPCaj8IYUhj X-Received: by 10.99.122.74 with SMTP id j10mr2595080pgn.84.1519429610473; Fri, 23 Feb 2018 15:46:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519429610; cv=none; d=google.com; s=arc-20160816; b=jUSA6H5yv3eVCzJfyRfdB8aKjb6/rcJDjziX43IncnkezisIbwNQopDu0OoZLk/wo2 JLmOVqyhgP5mskM/kCVuDiFAhXV6UoMjr5fD8GG1xdOj3yRZLUVJiHlfvWLRx1fh3CfY mJRTIl2ZAf6IVafU2EVtB1O6emH9Qqy2nPCbjfsvGamlNUsbo/jjYexFH0Vpy2UDsN9a ZeFqXWyBQA39fCC1vJiPmi7hLanOHxQqUvm/pCD86OYLQQVME42aylHpgoL1LtvYw+nx SJfl5HkRGU7uNE7WV9EREB9pWruXb9SKR+ZtS34pq2fVa5x62JecUkXqbB1GQ7WEJgpU 9N8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dmarc-filter:arc-authentication-results; bh=o1fCnCG5bQcV+MOO5h2fRBZtx75aSK4Wg4pRWdf5Pds=; b=ksuKLclijCrBs86i+pJUqimQqPunlgzceHN8Jd2peFtLrHAlDNKCNhwugWsr09y4dW ImkcjVhHB1xyOIeAfOD8ou/pmZSHjql1EtjcVxA/tWDS6qMS8+xJzBLexv9XnWluXKH4 QavHBmMVamzpB3K2xhqoIPyuyKH0QF6+rXAn9tVi0vAJhNhMNeEWwbd9h5EK60D1zrSM YyiC2LucZBvWUwjUUvcgs4LPSCldzLaPb2+07qEuKqxyv9G7UfHJkcKP1+pyJ/lCMBYh U436JHSV/JtWrq4xo6bob/gYhXQKWizQAKolnHan4+GgQczcsk2Kt42PXnxZCNpIWegE 3fCw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z16-v6si1516973plo.171.2018.02.23.15.46.35; Fri, 23 Feb 2018 15:46:50 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752586AbeBWXp3 (ORCPT + 99 others); Fri, 23 Feb 2018 18:45:29 -0500 Received: from mail.kernel.org ([198.145.29.99]:45806 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752157AbeBWXp1 (ORCPT ); Fri, 23 Feb 2018 18:45:27 -0500 Received: from localhost (unknown [150.199.191.185]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3F2E621784; Fri, 23 Feb 2018 23:45:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3F2E621784 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=helgaas@kernel.org Date: Fri, 23 Feb 2018 17:45:25 -0600 From: Bjorn Helgaas To: Oza Pawandeep Cc: Bjorn Helgaas , Philippe Ombredanne , Thomas Gleixner , Greg Kroah-Hartman , Kate Stewart , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Dongdong Liu , Keith Busch , Wei Zhang , Sinan Kaya , Timur Tabi Subject: Re: [PATCH v11 3/7] PCI/ERR: add mutex to synchronize recovery Message-ID: <20180223234525.GQ14632@bhelgaas-glaptop.roam.corp.google.com> References: <1519374244-20539-1-git-send-email-poza@codeaurora.org> <1519374244-20539-4-git-send-email-poza@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1519374244-20539-4-git-send-email-poza@codeaurora.org> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 23, 2018 at 01:54:00PM +0530, Oza Pawandeep wrote: > This patch protects pci_do_recovery with mutex. pcie_do_recovery() Please explain why the mutex is necessary. What bad things happen without the mutex? You named (some) of the other things "pcie"; maybe use "pcie" in the mutex name as well so they look the same. > Signed-off-by: Oza Pawandeep > > diff --git a/drivers/pci/pcie/pcie-err.c b/drivers/pci/pcie/pcie-err.c > index fcd5add..f830975 100644 > --- a/drivers/pci/pcie/pcie-err.c > +++ b/drivers/pci/pcie/pcie-err.c > @@ -20,6 +20,8 @@ > #include > #include "portdrv.h" > > +static DEFINE_MUTEX(pci_err_recovery_lock); > + > struct aer_broadcast_data { > enum pci_channel_state state; > enum pci_ers_result result; > @@ -283,6 +285,8 @@ void pcie_do_recovery(struct pci_dev *dev, int severity) > pci_ers_result_t status, result = PCI_ERS_RESULT_RECOVERED; > enum pci_channel_state state; > > + mutex_lock(&pci_err_recovery_lock); > + > if (severity == AER_FATAL) > state = pci_channel_io_frozen; > else > @@ -326,9 +330,11 @@ void pcie_do_recovery(struct pci_dev *dev, int severity) > report_resume); > > dev_info(&dev->dev, "Device recovery successful\n"); > + mutex_unlock(&pci_err_recovery_lock); > return; > > failed: > /* TODO: Should kernel panic here? */ > dev_info(&dev->dev, "Device recovery failed\n"); > + mutex_unlock(&pci_err_recovery_lock); > } > -- > Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc., > a Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project. >