[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAG-HVq-Knhdgwh4QCJ1U_N+bWYavguQ0axmx-TNgF+aCYoS2AA@mail.gmail.com>
Date: Fri, 17 Feb 2023 11:42:34 +0200
From: Mohammed Gamal <mgamal@...hat.com>
To: Dexuan Cui <decui@...rosoft.com>
Cc: "linux-hyperv@...r.kernel.org" <linux-hyperv@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"Michael Kelley (LINUX)" <mikelley@...rosoft.com>,
"parri.andrea@...il.com" <parri.andrea@...il.com>,
Haiyang Zhang <haiyangz@...rosoft.com>,
"wei.liu@...nel.org" <wei.liu@...nel.org>,
"vkuznets@...hat.com" <vkuznets@...hat.com>,
"xxiong@...hat.com" <xxiong@...hat.com>
Subject: Re: [PATCH v2] Drivers: vmbus: Check for channel allocation before
looking up relids
On Fri, Feb 17, 2023 at 8:25 AM Dexuan Cui <decui@...rosoft.com> wrote:
>
> > From: Mohammed Gamal <mgamal@...hat.com>
> > Sent: Tuesday, February 14, 2023 3:28 AM
> > ...
> > So Make relid2channel() check if vmbus channels is allocated first, and if not
> > print a warning and return NULL to the caller.
> Can we change the above to:
>
> Print a warning and error out in relid2channel() for a channel id that's invalid
> in the second kernel.
Will do!
>
> > --- a/drivers/hv/connection.c
> > +++ b/drivers/hv/connection.c
> > @@ -409,6 +409,10 @@ void vmbus_disconnect(void)
> > */
> > struct vmbus_channel *relid2channel(u32 relid)
> > {
> > + if (vmbus_connection.channels == NULL) {
> > + WARN(1, "Requested relid=%u, but channel mapping not
> > allocated!\n", relid);
>
> WARN() may be too noisy. I suggest we use pr_warn() instead.
>
Makes sense. Will use pr_warn() instead.
> Can we make the line a little shorter:
> pr_warn("relid2channel: invalid channel id %u\n", relid);
>
I think this message could be a bit misleading. The problem here is
not that the relid
is invalid, but that the relid-to-channel mapping hasn't been
allocated by the second
kernel yet. An invalid relid could simply be the case where relid >=
MAX_CHANNEL_RELIDS.
May be something like:
pr_warn("relid2channel: No channels mapped for relid %d\n, relid");
would be clearer?
Powered by blists - more mailing lists