From: Xiang W <wxjstz@126.com>
To: opensbi@lists.infradead.org
Subject: [PATCH 0/3] Sparse HART id improvements
Date: Mon, 09 Oct 2023 17:25:09 +0800 [thread overview]
Message-ID: <dee74ff21f4e73f7394d541361a3f65cc35adebe.camel@126.com> (raw)
In-Reply-To: <CAAhSdy119qy6zksV6ofVf_iy1nTJsGTwNNhKEUiFqNYjaL+fEw@mail.gmail.com>
? 2023-10-09???? 14:06 +0530?Anup Patel???
> On Sat, Oct 7, 2023 at 9:19?AM Xiang W <wxjstz@126.com> wrote:
> >
> > ? 2023-10-06???? 10:05 +0530?Anup Patel???
> > > On Sun, Sep 24, 2023 at 9:28?PM Xiang W <wxjstz@126.com> wrote:
> > > >
> > > > Modify last_hartindex_having_scratch/hartindex_to_hartid_table
> > > > /hartindex_to_scratch_table as static variables to prevent accidental
> > > > modification and reduce memory consumption
> > > >
> > > > Xiang W (3):
> > > > ? lib: sbi: Refactor sbi_scratch_last_hartindex as a function
> > > > ? lib: sbi: Refactor sbi_hartindex_to_hartid as a function
> > > > ? lib: sbi: Refactor sbi_hartindex_to_scratch as a function
> > >
> > > All these are in hot-path at various places so introducing a
> > > function is certainly not helping.
> > >
> > > Also, if some buggy code is accidentally modifying global data
> > > then that buggy code should be fixed rather than papering over
> > > the problem by introducing these functions.
> > PATCH1:
> > The original code is a bit strange in that there is already a global variable
> > last_hartindex_having_scratch, but instead of using it outside of sbi_scratch.c,
> > the macro sbi_scratch_last_hartindex is used. If don't want to modify this macro
> > into a function, why not just change the name of the last_hartindex_having_scratch
> > renamed to sbi_scratch_last_hartindex and then remove the macro?
>
> The sbi_scratch_last_hartindex() macro allows adding instrumentation
> code for debugging purposes. The caller of sbi_scratch_last_hartindex()
> should not care about how it is implemented.
>
> >
> > PATCH2:
> > The arrays hartindex_to_hartid_table and plat->hart_index2id store similar content,
> > and the extra length of the hartindex_to_hartid_table array is not used because
> > there is a determination of whether the index is less than sbi_scratch_last_ hartindex.
> > the array can be removed by adding just a little bit of checking.
>
> The "plat->hart_index2id" is optional and can be NULL as well so
> we have to always use "if ()" before accessing "plat->hart_index2id".
>
> Also, we always have to access "hart_index2id[]" via "plat" pointer
> which is slower compared to a global array like "hartindex_to_hartid_table[]".
My expression may not be very accurate, please review my code.
https://lists.infradead.org/pipermail/opensbi/2023-October/005703.html
Regards,
Xiang W
>
> Regards,
> Anup
>
> >
> > Regards,
> > Xiang W
> > >
> > > Regards,
> > > Anup
> > >
> > > >
> > > > ?include/sbi/sbi_scratch.h | 35 ++++++++++++-----------------------
> > > > ?lib/sbi/sbi_scratch.c???? | 30 ++++++++++++++++++++++++++----
> > > > ?2 files changed, 38 insertions(+), 27 deletions(-)
> > > >
> > > > --
> > > > 2.40.1
> > > >
> > > >
> > > > --
> > > > opensbi mailing list
> > > > opensbi at lists.infradead.org
> > > > http://lists.infradead.org/mailman/listinfo/opensbi
> >
prev parent reply other threads:[~2023-10-09 9:25 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-24 15:57 [PATCH 0/3] Sparse HART id improvements Xiang W
2023-09-24 15:57 ` [PATCH 1/3] lib: sbi: Refactor sbi_scratch_last_hartindex as a function Xiang W
2023-09-24 15:57 ` [PATCH 2/3] lib: sbi: Refactor sbi_hartindex_to_hartid " Xiang W
2023-09-24 15:57 ` [PATCH 3/3] lib: sbi: Refactor sbi_hartindex_to_scratch " Xiang W
2023-10-06 4:35 ` [PATCH 0/3] Sparse HART id improvements Anup Patel
2023-10-07 3:48 ` Xiang W
2023-10-09 8:36 ` Anup Patel
2023-10-09 9:25 ` Xiang W [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=dee74ff21f4e73f7394d541361a3f65cc35adebe.camel@126.com \
--to=wxjstz@126.com \
--cc=opensbi@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.