linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: <Kelvin.Cao@microchip.com>
To: <kw@linux.com>
Cc: <kurt.schwemmer@microsemi.com>, <bhelgaas@google.com>,
	<kelvincao@outlook.com>, <logang@deltatee.com>,
	<linux-kernel@vger.kernel.org>, <linux-pci@vger.kernel.org>
Subject: Re: [PATCH v2 1/5] PCI/switchtec: Error out MRPC execution when MMIO reads fail
Date: Fri, 15 Oct 2021 22:13:36 +0000	[thread overview]
Message-ID: <5b554388b1e46a0d2f3f7082a4d4defe55707712.camel@microchip.com> (raw)
In-Reply-To: <YWjXq/NL6zex4oeR@rocinante>

On Fri, 2021-10-15 at 03:21 +0200, Krzysztof Wilczyński wrote:
> Hi Kelvin,
> 
> Thank you for sending the series over!
> 
> I am terribly sorry for a very late comment, especially since Bjorn
> already
> accepted this series to be included, but allow me for a small
> question
> below.
> 
> [...]
> > @@ -113,6 +127,7 @@ static void stuser_set_state(struct
> > switchtec_user *stuser,
> >               [MRPC_QUEUED] = "QUEUED",
> >               [MRPC_RUNNING] = "RUNNING",
> >               [MRPC_DONE] = "DONE",
> > +             [MRPC_IO_ERROR] = "IO_ERROR",
> 
> Looking at the above, and then looking at stuser_set_state(), which
> contains the following local array definition:
> 
>         const char * const state_names[] = {
>                 [MRPC_IDLE] = "IDLE",
>                 [MRPC_QUEUED] = "QUEUED",
>                 [MRPC_RUNNING] = "RUNNING",
>                 [MRPC_DONE] = "DONE",
>         };
> 
> I was wondering if there might be a small benefit of declaring this
> array
> state_names[], or list of states if you wish, as static so that we
> avoid
> having to allocate space and fill it in with values every time this
> functions runs?
> 
> The function itself if referenced in few places as per:
> 
>   Index File                           Line Content
>       1 drivers/pci/switch/switchtec.c  159 stuser_set_state(stuser,
> MRPC_RUNNING);
>       2 drivers/pci/switch/switchtec.c  178 stuser_set_state(stuser,
> MRPC_QUEUED);
>       3 drivers/pci/switch/switchtec.c  206 stuser_set_state(stuser,
> MRPC_DONE);
>       4 drivers/pci/switch/switchtec.c  567 stuser_set_state(stuser,
> MRPC_IDLE);
> 
> Even though the string representation of the state is ever only
> printed if
> a debug logging is requested, we would allocate and popular this
> array
> every time anyway, regardless of whether we print any debug
> information or
> not.
> 
> What do you think?

Thank you Krzysztof. That will be an improvement. I can probably tweak
it in the next patchset (coming soon). 

Kelvin
> 
>         Krzysztof

  reply	other threads:[~2021-10-15 22:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-14 14:18 [PATCH v2 0/5] Switchtec Fixes and Improvements kelvin.cao
2021-10-14 14:18 ` [PATCH v2 1/5] PCI/switchtec: Error out MRPC execution when MMIO reads fail kelvin.cao
2021-10-15  1:21   ` Krzysztof Wilczyński
2021-10-15 22:13     ` Kelvin.Cao [this message]
2021-10-14 14:18 ` [PATCH v2 2/5] PCI/switchtec: Fix a MRPC error status handling issue kelvin.cao
2021-10-14 14:18 ` [PATCH v2 3/5] PCI/switchtec: Update the way of getting management VEP instance ID kelvin.cao
2021-10-14 14:18 ` [PATCH v2 4/5] PCI/switchtec: Replace ENOTSUPP with EOPNOTSUPP kelvin.cao
2021-10-15  1:55   ` Krzysztof Wilczyński
2021-10-14 14:18 ` [PATCH v2 5/5] PCI/switchtec: Add check of event support kelvin.cao
2021-10-14 14:47 ` [PATCH v2 0/5] Switchtec Fixes and Improvements Bjorn Helgaas
2021-10-14 21:19   ` Kelvin.Cao

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=5b554388b1e46a0d2f3f7082a4d4defe55707712.camel@microchip.com \
    --to=kelvin.cao@microchip.com \
    --cc=bhelgaas@google.com \
    --cc=kelvincao@outlook.com \
    --cc=kurt.schwemmer@microsemi.com \
    --cc=kw@linux.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=logang@deltatee.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;
as well as URLs for NNTP newsgroup(s).