From: Dave Hansen <dave.hansen@intel.com>
To: Steve Wahl <steve.wahl@hpe.com>,
Dimitri Sivanich <dimitri.sivanich@hpe.com>,
Russ Anderson <russ.anderson@hpe.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4] x86/platform/uv: UV support for sub-NUMA clustering
Date: Thu, 23 Mar 2023 09:26:50 -0700 [thread overview]
Message-ID: <41a01b03-26f9-a9ae-d8f7-6b0eeb941cf5@intel.com> (raw)
In-Reply-To: <20230224225904.2618624-1-steve.wahl@hpe.com>
On 2/24/23 14:59, Steve Wahl wrote:
> + if (np) {
> + s = ((i * 64) + __ffs(np)) & s_mask;
> + if (sock_min > s)
> + sock_min = s;
> + s = ((i * 64) + __fls(np)) & s_mask;
> + if (sock_max < s)
> + sock_max = s;
> + }
> }
> }
> if (UVH_NODE_PRESENT_0) {
> np = uv_read_local_mmr(UVH_NODE_PRESENT_0);
> pr_info("UV: NODE_PRESENT_0 = 0x%016lx\n", np);
> - uv_pb += hweight64(np);
> + if (np) {
> + s = __ffs(np) & s_mask;
> + if (sock_min > s)
> + sock_min = s;
> + s = __fls(np) & s_mask;
> + if (sock_max < s)
> + sock_max = s;
> + }
> }
> if (UVH_NODE_PRESENT_1) {
> np = uv_read_local_mmr(UVH_NODE_PRESENT_1);
> pr_info("UV: NODE_PRESENT_1 = 0x%016lx\n", np);
> - uv_pb += hweight64(np);
> + if (np) {
> + s = (64 + __ffs(np)) & s_mask;
> + if (sock_min > s)
> + sock_min = s;
> + s = (64 + __fls(np)) & s_mask;
> + if (sock_max < s)
> + sock_max = s;
> + }
> + }
I guess this patch is modifying code that very few people care about.
But, this is kinda a mess. This patch does a *TON* of different things
and makes almost no effort to refactor the code before diving into the
changes.
I quoted the above text because whatever that code is doing, it's
gloriously uncommented. That kind of thing demands a helper even if
it's just used once so that a read can have _some_ idea what it's doing
logically.
Could you please take another pass at this? I think it demands to be
broken up into at _least_ 5-10 individual patches.
For instance, you could introduce and use uv_pnode_to_socket() in one patch.
Or this:
> - nasid_mask = UVH_RH_GAM_MMIOH_OVERLAY_CONFIG0_BASE_MASK;
> + nasid_mask =
> + is_uv(UV4A) ? UV4AH_RH_GAM_MMIOH_REDIRECT_CONFIG0_NASID_MASK :
> + is_uv(UV4) ? UV4H_RH_GAM_MMIOH_REDIRECT_CONFIG0_NASID_MASK :
> + UV3H_RH_GAM_MMIOH_REDIRECT_CONFIG0_NASID_MASK;
> n = UVH_RH_GAM_MMIOH_REDIRECT_CONFIG0_DEPTH;
> min_nasid = min_pnode * 2;
> max_nasid = max_pnode * 2;
> @@ -1046,7 +1050,10 @@ static void __init calc_mmioh_map(enum mmioh_arch index,
> break;
> case UVX_MMIOH1:
> mmr = UVH_RH_GAM_MMIOH_REDIRECT_CONFIG1;
> - nasid_mask = UVH_RH_GAM_MMIOH_OVERLAY_CONFIG1_BASE_MASK;
> + nasid_mask =
> + is_uv(UV4A) ? UV4AH_RH_GAM_MMIOH_REDIRECT_CONFIG0_NASID_MASK :
> + is_uv(UV4) ? UV4H_RH_GAM_MMIOH_REDIRECT_CONFIG1_NASID_MASK :
> + UV3H_RH_GAM_MMIOH_REDIRECT_CONFIG1_NASID_MASK;
That could use a helper to reduce the duplication and add clarity and be
done in a separate patch.
next prev parent reply other threads:[~2023-03-23 16:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-24 22:59 Steve Wahl
2023-03-23 16:10 ` Steve Wahl
2023-03-23 16:26 ` Dave Hansen [this message]
2023-03-23 21:46 ` Steve Wahl
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=41a01b03-26f9-a9ae-d8f7-6b0eeb941cf5@intel.com \
--to=dave.hansen@intel.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=dimitri.sivanich@hpe.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=russ.anderson@hpe.com \
--cc=steve.wahl@hpe.com \
--cc=tglx@linutronix.de \
--cc=x86@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®