From: Andrea Parri <parri.andrea@gmail.com>
To: "Michael Kelley (LINUX)" <mikelley@microsoft.com>
Cc: KY Srinivasan <kys@microsoft.com>,
Haiyang Zhang <haiyangz@microsoft.com>,
Stephen Hemminger <sthemmin@microsoft.com>,
Wei Liu <wei.liu@kernel.org>, Dexuan Cui <decui@microsoft.com>,
Wei Hu <weh@microsoft.com>,
Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
Rob Herring <robh@kernel.org>,
Krzysztof Wilczynski <kw@linux.com>,
Bjorn Helgaas <bhelgaas@google.com>,
"linux-hyperv@vger.kernel.org" <linux-hyperv@vger.kernel.org>,
"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 4/6] Drivers: hv: vmbus: Introduce vmbus_request_addr_match()
Date: Fri, 8 Apr 2022 22:38:28 +0200 [thread overview]
Message-ID: <20220408203828.GA305168@anparri> (raw)
In-Reply-To: <PH0PR21MB30258AE4C3CD9674E953C765D7E99@PH0PR21MB3025.namprd21.prod.outlook.com>
> > > In the case where a specific match is required, and trans_id is
> > > valid but the addr's do not match, it looks like this function will
> > > return the addr that didn't match, without removing the entry.
> >
> > Yes, that is consistent with the description on vmbus_request_addr_match():
> >
> > Returns the memory address stored at @trans_id, or VMBUS_RQST_ERROR if
> > @trans_id is not contained in the requestor.
> >
> >
> > > Shouldn't it return VMBUS_RQST_ERROR in that case?
> >
> > Can certainly be done, although I'm not sure to follow your concerns. Can
> > you elaborate?
> >
>
> Having the function return "success" when it failed to match is unexpected
> for me. There's only one invocation where we care about matching
> (in hv_compose_msi_msg). In that invocation the purpose for matching is to
> not remove the wrong entry, and the return value is ignored. So I think
> it all works correctly.
You're reading it wrongly: the point is that there's nothing wrong in *not
removing the "wrong entry" (or in failing to match). In the mentioned use,
that means the channel callback has already processed "our" request, and
that we don't have to worry about the ID. (Otherwise, i.e. if we do match,
the callback will eventually scream "Invalid transaction".)
> Just thinking out loud, maybe vmbus_request_addr_match() should be
> renamed to vmbus_request_addr_remove(), and not have a return value?
Mmh. We have vmbus_request_addr() that (always) removes the ID; it seems
a _remove() would just add to the confusion. And removing the return value
would mean duplicating most of vmbus_request_addr() in the "new" function.
So, I'm not convinced that's the right thing to do. I'm inclined to leave
this patch as is (and, as usual, happy to be proven wrong).
Thanks,
Andrea
next prev parent reply other threads:[~2022-04-08 20:38 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-07 4:30 [PATCH 0/6] PCI: hv: VMbus requestor and related fixes Andrea Parri (Microsoft)
2022-04-07 4:30 ` [PATCH 1/6] Drivers: hv: vmbus: Fix handling of messages with transaction ID of zero Andrea Parri (Microsoft)
2022-04-08 15:16 ` Michael Kelley (LINUX)
2022-04-07 4:30 ` [PATCH 2/6] PCI: hv: Use vmbus_requestor to generate transaction IDs for VMbus hardening Andrea Parri (Microsoft)
2022-04-08 15:20 ` Michael Kelley (LINUX)
2022-04-08 16:34 ` Andrea Parri
2022-04-07 4:30 ` [PATCH 3/6] Drivers: hv: vmbus: Introduce vmbus_sendpacket_getid() Andrea Parri (Microsoft)
2022-04-08 15:20 ` Michael Kelley (LINUX)
2022-04-07 4:30 ` [PATCH 4/6] Drivers: hv: vmbus: Introduce vmbus_request_addr_match() Andrea Parri (Microsoft)
2022-04-08 15:25 ` Michael Kelley (LINUX)
2022-04-08 16:47 ` Andrea Parri
2022-04-08 17:41 ` Michael Kelley (LINUX)
2022-04-08 20:38 ` Andrea Parri [this message]
2022-04-11 2:31 ` Michael Kelley (LINUX)
2022-04-07 4:30 ` [PATCH 5/6] Drivers: hv: vmbus: Introduce {lock,unlock}_requestor() Andrea Parri (Microsoft)
2022-04-08 15:28 ` Michael Kelley (LINUX)
2022-04-07 4:30 ` [PATCH 6/6] PCI: hv: Fix synchronization between channel callback and hv_compose_msi_msg() Andrea Parri (Microsoft)
2022-04-08 15:29 ` Michael Kelley (LINUX)
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=20220408203828.GA305168@anparri \
--to=parri.andrea@gmail.com \
--cc=bhelgaas@google.com \
--cc=decui@microsoft.com \
--cc=haiyangz@microsoft.com \
--cc=kw@linux.com \
--cc=kys@microsoft.com \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=mikelley@microsoft.com \
--cc=robh@kernel.org \
--cc=sthemmin@microsoft.com \
--cc=weh@microsoft.com \
--cc=wei.liu@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;
as well as URLs for NNTP newsgroup(s).