Received: by 10.223.185.116 with SMTP id b49csp2096098wrg; Thu, 22 Feb 2018 08:06:01 -0800 (PST) X-Google-Smtp-Source: AH8x227zLDvCs6UN1IumpdhNPjOOg8FPXjbKl6c08zuDCSzsnnjKnXDfdWVP8l7tMQZC8uPTRGHe X-Received: by 2002:a17:902:b109:: with SMTP id q9-v6mr7153031plr.340.1519315561172; Thu, 22 Feb 2018 08:06:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519315561; cv=none; d=google.com; s=arc-20160816; b=cpwKV/u5QvqYJm+GbQBWSTq4n4hUo+fd6IKHxZY7XCnn2gxL1HcAMyXfadCWcf9ZmA FCy/XbW/OluuVKEcknPQxr1o1bOnwzwlW1qVQSAbrcWVViapS/FB/EbpmPEt9etA6ycv fQ2yrrc4o5X0DV99HNWI40LfIPjq7Y+Mhc0bcWUdeX6H1V27WMQkW0IJBH2/eWAemOuQ br1bzs1JRF0YrOF0sS3EiYPUDtXLSPvEqOrHNEebERxv5w4VW4uRBr0eDScwQlKMFJoO 4gU+o0ZBlifebdSQiDm8bT6BnBwh5eoskSlmdHRZaAWVJjT6iFO6Zx5bX0jDhDnyLtkn 4zxg== 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=BQ9xOmpdx+7MmhmvbBgaPrXlqHbjNItDnJ/z45n11ew=; b=fuwWQcm+ST6+MoqofnVvrINlVR8XrrEOUCQXtEjvmZ733GqzCs8dlNQkjiMS1TSVDu av6zdIFxibXhD+usVLCvqpuOh7oFx90tgzdHvU490q/wGCy4nsPziKNQ1otdlhaiKP5q A4EfAnyDx4bmEs9/hm0JabFkMW/2F/oa+bLOpe+2+2w0mlDXs/Hm/sz5Z9CTCLh6Yhps OCDHqFtsTL+UCxg8LlhpicrbwF/M9YYRLWHtIqT1iM9x189kLUApmcgjxkdI9UwdolS+ IOU6xzuf6P1YZlp0VfiqnNxcWkPn3siD3sLyVw2JSUg1rHuXrOprjYZa4SOstMHM8n8m VWyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=jDzv7gOF; dkim=pass header.i=@codeaurora.org header.s=default header.b=g0yiuWV1; 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 s12si199664pgf.263.2018.02.22.08.05.45; Thu, 22 Feb 2018 08:06:01 -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=jDzv7gOF; dkim=pass header.i=@codeaurora.org header.s=default header.b=g0yiuWV1; 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 S933213AbeBVQCs (ORCPT + 99 others); Thu, 22 Feb 2018 11:02:48 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:55104 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933094AbeBVQCn (ORCPT ); Thu, 22 Feb 2018 11:02:43 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 06B7360F93; Thu, 22 Feb 2018 16:02:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1519315363; bh=AsvJ+SOFQRslN6hmcHEEPHLzEs1VFTOYfij4cYW9OVE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jDzv7gOFo81EXXoS3WoM2g5WsqkM2n62Iic2UiSsVHvA8vgKQvbQs7IfL7QoTdNb3 B5cx9NV83k4ajVvP9Cuk/IXde/r5RUjSbE5TllQ1pHCc+a4qZ9FyUd3ZqJupsDOhWS L+FezxXxjIYQhOQEmMUmLe6xIiB6GA3oUDuc8n1I= 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 E94E360F8E; Thu, 22 Feb 2018 16:02:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1519315355; bh=AsvJ+SOFQRslN6hmcHEEPHLzEs1VFTOYfij4cYW9OVE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g0yiuWV1jFAOf4l5vGetywyzAXytZEh7ju/P5BFaGPoUxctYBg9jySORtGvYF/OmR oi63wgEWo68mM8X/CBhZ0TaCXgDZoynl6w3oM6uDtXmA5jLy5Uwt+Qb+zOC5V8djKq s55j0VTlBijv4NN4oL7WFwyU1F0j4EM+xbed3Bq4= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org E94E360F8E 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 v10 3/7] PCI/ERR: add mutex to synchronize recovery Date: Thu, 22 Feb 2018 21:32:08 +0530 Message-Id: <1519315332-26852-4-git-send-email-poza@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1519315332-26852-1-git-send-email-poza@codeaurora.org> References: <1519315332-26852-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 a532fe0..8318c84 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 pci_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 pci_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.