From: "Naik, Avadhut" <avadnaik@amd.com>
To: Yazen Ghannam <yazen.ghannam@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: [PATCH] EDAC/amd64: Fix size calculation for Non-Power-of-Two DIMMs
Date: Mon, 14 Apr 2025 11:36:41 -0500 [thread overview]
Message-ID: <9a33b6ff-9ce8-4abd-8629-3c9f6a546514@amd.com> (raw)
In-Reply-To: <20250414131101.GA65192@yaz-khff2.amd.com>
On 4/14/2025 08:11, Yazen Ghannam wrote:
> 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?
>
Yes, this should only be executed during module init.
Get your point. Will remove the condition check and move it to the
new helper function.
> Thanks,
> Yazen
--
Thanks,
Avadhut Naik
prev parent reply other threads:[~2025-04-14 16:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-27 21:03 Avadhut Naik
2025-04-05 0:58 ` Yazen Ghannam
2025-04-09 5:48 ` Naik, Avadhut
2025-04-14 13:11 ` Yazen Ghannam
2025-04-14 16:36 ` Naik, Avadhut [this message]
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=9a33b6ff-9ce8-4abd-8629-3c9f6a546514@amd.com \
--to=avadnaik@amd.com \
--cc=avadhut.naik@amd.com \
--cc=bp@alien8.de \
--cc=linux-edac@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=yazen.ghannam@amd.com \
/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®