public inbox for linux-edac@vger.kernel.org
 help / color / mirror / Atom feed
From: Yazen Ghannam <yazen.ghannam@amd.com>
To: "Naik, Avadhut" <avadnaik@amd.com>
Cc: linux-edac@vger.kernel.org, bp@alien8.de,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	Avadhut Naik <avadhut.naik@amd.com>
Subject: Re: [PATCH] EDAC/amd64: Fix size calculation for Non-Power-of-Two DIMMs
Date: Mon, 14 Apr 2025 09:11:01 -0400	[thread overview]
Message-ID: <20250414131101.GA65192@yaz-khff2.amd.com> (raw)
In-Reply-To: <642236b9-a19f-417b-bf1c-888ca54cecca@amd.com>

On Wed, Apr 09, 2025 at 12:48:57AM -0500, Naik, Avadhut wrote:

[...]

> >>  
> >>  	edac_dbg(1, "CS%d DIMM%d AddrMasks:\n", csrow_nr, dimm);
> >> -	edac_dbg(1, "  Original AddrMask: 0x%x\n", addr_mask_orig);
> >> -	edac_dbg(1, "  Deinterleaved AddrMask: 0x%x\n", addr_mask_deinterleaved);
> >> +	edac_dbg(1, "  Primary AddrMask: 0x%x\n", addr_mask);
> >>  
> >>  	/* Register [31:1] = Address [39:9]. Size is in kBs here. */
> >> -	size = (addr_mask_deinterleaved >> 2) + 1;
> >> +	size = calculate_cs_size(addr_mask, cs_mode);
> >> +
> >> +	if (addr_mask_sec) {
> > 
> > I think we can skip this check.
> > 
> Commented below on this.
> 
> > For debug messages, it doesn't hurt to be more explicit. So printing a
> > 'mask: 0x0' message is more helpful/reassuring than 'no message'.
> > 
> >> +		edac_dbg(1, "  Secondary AddrMask: 0x%x\n", addr_mask);
> > 
> > addr_mask -> addr_mask_sec
> > 
> >> +		size += calculate_cs_size(addr_mask_sec, cs_mode);
> > 
> > Maybe add a "!mask" check to return early if you want to save some
> > cycles in this helper function.
> > 
> In a way, this is the reason why I had added the above condition check.
> To avoid unnecessary function calls.
> 
> AFAIK, power-of-2 DIMMs are predominantly used, so the Secondary Address
> Mask register will seldom be used.
> 
> Would you agree?

I don't know. It seems non-power-of-2 (24G, 48G, 96G) is becoming more
common for individual DIMMs and sets of DIMMs.

Thinking on it more, I don't think we need to be concerned about saving
cycles here. These functions are only called during module init,
correct?

Thanks,
Yazen

  reply	other threads:[~2025-04-14 13:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-27 21:03 [PATCH] EDAC/amd64: Fix size calculation for Non-Power-of-Two DIMMs Avadhut Naik
2025-04-05  0:58 ` Yazen Ghannam
2025-04-09  5:48   ` Naik, Avadhut
2025-04-14 13:11     ` Yazen Ghannam [this message]
2025-04-14 16:36       ` Naik, Avadhut

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=20250414131101.GA65192@yaz-khff2.amd.com \
    --to=yazen.ghannam@amd.com \
    --cc=avadhut.naik@amd.com \
    --cc=avadnaik@amd.com \
    --cc=bp@alien8.de \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@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