Received: by 10.223.185.116 with SMTP id b49csp415969wrg; Fri, 23 Feb 2018 00:28:29 -0800 (PST) X-Google-Smtp-Source: AH8x224f5iULQi7y3TDAh3LwYxXnWZm+RWSN7tmveUXxYMgkMOBnzEvkpMOqKYPNPXK24XHUb2o6 X-Received: by 10.101.100.208 with SMTP id t16mr802149pgv.398.1519374509697; Fri, 23 Feb 2018 00:28:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519374509; cv=none; d=google.com; s=arc-20160816; b=H568lj+73yx/99M3WVclNZvE4MtLVhT0nJhNUWxcKA2apciBWCe8XrTivI71PupFlb Wd4Nk1TWAuc2cKnQpymVyrsU3wnmOGQorYviyB+j4nP6G471yltLc/2HrLRaJXkLtWNk pgEeAT4e7SJFlC48oyIy5wulfYCoP8u0C1uneu/a47ne6VdUFU9btrK1tBaf2pdVoQyr Rp+8Fmgnl8ODkqT7X8cR3LveCvg1o6C8D3BViIf9IIxaXvEtwkG/7PxlrbeDOdtZCa9c dx6lS7dbyQlK84Mz7Hi8I0JmzE4r7An5kyzro8qw1oJKxVPNn4h6OjCIG8+rv6oUEhr1 32Mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dmarc-filter:dkim-signature:dkim-signature :arc-authentication-results; bh=I66auP7Odxgw/yAkDnrgZ/4PugO/xZ35+kA3agpTmcc=; b=qQS+76tFeGa1suVnDEa1hFW4vNHdnUr6r5i0SrDYhdMYUUr5yqWoYAtgGD5Kj/YZru lSY9P2Tb/JrM9N21FZ0Z763DUD8PyVrO3ChFV8REysSiNo2urjEHNAHPWb5R+2Lrihp2 ZvtBoc3O1uGbVOasmdqNq3RKBuqWE4ERuoIN/1gO9qIZzPfzJx6zWZ9EHP+/dZPc6kzl qsviPxFZ1yuALkLdZpXw1H5Kv4uGARg+YHPce3inwrpLRapm+wCHZTD7T+4kubrl7r21 5VwQ+YvWsJQw2aTjGTIfUqVCTu2nMRGNIHkBw27sY+RplN7Z2MyajJqcpYIZvXWBWbc+ YzTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=Q12K9W8J; dkim=pass header.i=@codeaurora.org header.s=default header.b=LeI94hEr; 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 i124si1208224pgc.589.2018.02.23.00.28.15; Fri, 23 Feb 2018 00:28:29 -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; dkim=pass header.i=@codeaurora.org header.s=default header.b=Q12K9W8J; dkim=pass header.i=@codeaurora.org header.s=default header.b=LeI94hEr; 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 S1751580AbeBWI0j (ORCPT + 99 others); Fri, 23 Feb 2018 03:26:39 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:60248 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751474AbeBWIY2 (ORCPT ); Fri, 23 Feb 2018 03:24:28 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 455EA607C6; Fri, 23 Feb 2018 08:24:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1519374268; bh=zk5khcVkUGGsPk4ggY3bcTGygGu6iwf5n8sx+cUMxN0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q12K9W8JqLE9Lva/g9TaR6KwnDPOVg1BZsubBtoWvkHbH7GFwgjuqPX5EUeDs8Cy9 pocCD3FHQYeWb+ULNKx1nt1I0wTSyzqyQZ/+5cCgTZxXuBTjbb2WXXUZ9IRZL+rFor hlmiJQQVm8b3Lxe50PE3TIyj0wS0zNYJeRaY9gXQ= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from blr-ubuntu-poza.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.18.19]) (using TLSv1.1 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: poza@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id D0522607C6; Fri, 23 Feb 2018 08:24:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1519374267; bh=zk5khcVkUGGsPk4ggY3bcTGygGu6iwf5n8sx+cUMxN0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LeI94hErVC6gHQ4AZ50zilUEV++CwPbtuPnOpEdlyLkS1vCGYxrA/8C9zxdD+Q+FX wiHOz6F1fkZiHeI6AQqrT0fNoslcjZz2jqoEMIny2I3+vT2nk20Cma8+tIdtd82eOn 9Zt3znQkE5QVxbLb+w8oWGLpmh4WLrc1B3yP6TsA= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org D0522607C6 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=poza@codeaurora.org From: Oza Pawandeep To: 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 Cc: Oza Pawandeep Subject: [PATCH v11 3/7] PCI/ERR: add mutex to synchronize recovery Date: Fri, 23 Feb 2018 13:54:00 +0530 Message-Id: <1519374244-20539-4-git-send-email-poza@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1519374244-20539-1-git-send-email-poza@codeaurora.org> References: <1519374244-20539-1-git-send-email-poza@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch protects pci_do_recovery with mutex. 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.