mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yazen Ghannam <Yazen.Ghannam@amd.com>
To: linux-edac@vger.kernel.org
Cc: Yazen Ghannam <Yazen.Ghannam@amd.com>,
	linux-kernel@vger.kernel.org, bp@suse.de
Subject: [PATCH 2/3] EDAC/amd64: Only remove instances that exist
Date: Wed, 21 Mar 2018 14:13:34 -0500	[thread overview]
Message-ID: <20180321191335.7832-2-Yazen.Ghannam@amd.com> (raw)
In-Reply-To: <20180321191335.7832-1-Yazen.Ghannam@amd.com>

From: Yazen Ghannam <yazen.ghannam@amd.com>

An instance may have failed probing because the probed node did not have
DRAM installed. When the module is unloaded we'll get a WARNing when
we try to remove a non-existent instance.

Save a bitmask of enabled instances with a bit for each node.

Only try to remove an instance if it was successfully enabled in the
first place.

Cc: <stable@vger.kernel.org> # 4.14.x
Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
---
 drivers/edac/amd64_edac.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
index af0ce9aa8d24..054086b19c6c 100644
--- a/drivers/edac/amd64_edac.c
+++ b/drivers/edac/amd64_edac.c
@@ -13,6 +13,8 @@ module_param(report_gart_errors, int, 0644);
 static int ecc_enable_override;
 module_param(ecc_enable_override, int, 0644);
 
+static unsigned long int enabled_instances;
+
 static struct msr __percpu *msrs;
 
 /* Per-node stuff */
@@ -3366,6 +3368,7 @@ static int probe_one_instance(unsigned int nid)
 		goto err_enable;
 	}
 
+	set_bit(nid, &enabled_instances);
 	return ret;
 
 err_enable:
@@ -3383,6 +3386,9 @@ static void remove_one_instance(unsigned int nid)
 	struct mem_ctl_info *mci;
 	struct amd64_pvt *pvt;
 
+	if (!test_bit(nid, &enabled_instances))
+		return;
+
 	mci = find_mci_by_dev(&F3->dev);
 	WARN_ON(!mci);
 
@@ -3405,6 +3411,8 @@ static void remove_one_instance(unsigned int nid)
 
 	kfree(pvt);
 	edac_mc_free(mci);
+
+	clear_bit(nid, &enabled_instances);
 }
 
 static void setup_pci_device(void)
-- 
2.14.1

  reply	other threads:[~2018-03-21 19:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-21 19:13 [PATCH 1/3] EDAC/amd64: Print ECC enabled/disabled for nodes with enabled MCs Yazen Ghannam
2018-03-21 19:13 ` Yazen Ghannam [this message]
2018-03-21 19:13 ` [PATCH 3/3] EDAC/amd64: Add DIMM device type for Fam17h Yazen Ghannam
2018-03-28 13:00 ` [PATCH 1/3] EDAC/amd64: Print ECC enabled/disabled for nodes with enabled MCs Borislav Petkov
2018-03-28 14:38   ` Ghannam, Yazen
2018-03-28 15:43     ` Borislav Petkov
2018-03-28 15:59       ` Ghannam, Yazen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180321191335.7832-2-Yazen.Ghannam@amd.com \
    --to=yazen.ghannam@amd.com \
    --cc=bp@suse.de \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®