linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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: [RFC PATCH 2/4] PCI: hv: Use vmbus_requestor to generate transaction IDs for VMbus hardening
Date: Fri, 1 Apr 2022 18:00:36 +0200	[thread overview]
Message-ID: <20220401160036.GA437893@anparri> (raw)
In-Reply-To: <PH0PR21MB3025A45FCFD77242EB9EAB27D7E19@PH0PR21MB3025.namprd21.prod.outlook.com>

> > @@ -91,6 +91,9 @@ static enum pci_protocol_version_t pci_protocol_versions[] = {
> >  /* space for 32bit serial number as string */
> >  #define SLOT_NAME_SIZE 11
> > 
> > +/* Size of requestor for VMbus */
> > +#define HV_PCI_RQSTOR_SIZE 64
> 
> Might include a comment about how this value was derived.  I *think*
> it is an arbitrary value based on the assumption that having more than
> one request outstanding is rare, and so 64 should be extremely generous
> in ensuring that we don't ever run out.

Right, I've added a comment to that effect.


> > @@ -2696,8 +2699,9 @@ static void hv_pci_onchannelcallback(void *context)
> >  	const int packet_size = 0x100;
> >  	int ret;
> >  	struct hv_pcibus_device *hbus = context;
> > +	struct vmbus_channel *chan = hbus->hdev->channel;
> 
> Having gotten the channel as a local variable, could also use the local as
> the first argument to vmbus_recvpacket_raw().

Applied.


> > @@ -2743,11 +2747,13 @@ static void hv_pci_onchannelcallback(void *context)
> >  		switch (desc->type) {
> >  		case VM_PKT_COMP:
> > 
> > -			/*
> > -			 * The host is trusted, and thus it's safe to interpret
> > -			 * this transaction ID as a pointer.
> > -			 */
> > -			comp_packet = (struct pci_packet *)req_id;
> > +			req_addr = chan->request_addr_callback(chan, req_id);
> > +			if (req_addr == VMBUS_RQST_ERROR) {
> > +				dev_warn_ratelimited(&hbus->hdev->device,
> > +						     "Invalid request ID\n");
> 
> Could you include the req_id value in the error message that is output?  I
> was recently debugging a problem in the storvsc driver where having that
> value would have been handy.

Sure.

Thanks,
  Andrea

  reply	other threads:[~2022-04-01 16:28 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-28 14:42 [RFC PATCH 0/4] PCI: hv: Miscellaneous changes Andrea Parri (Microsoft)
2022-03-28 14:42 ` [RFC PATCH 1/4] Drivers: hv: vmbus: Remove special code for unsolicited messages Andrea Parri (Microsoft)
2022-03-31 18:00   ` Michael Kelley (LINUX)
2022-04-07  2:54   ` Andrea Parri
2022-03-28 14:42 ` [RFC PATCH 2/4] PCI: hv: Use vmbus_requestor to generate transaction IDs for VMbus hardening Andrea Parri (Microsoft)
2022-03-31 18:12   ` Michael Kelley (LINUX)
2022-04-01 16:00     ` Andrea Parri [this message]
2022-03-28 14:42 ` [RFC PATCH 3/4] Drivers: hv: vmbus: Introduce vmbus_sendpacket_getid() Andrea Parri (Microsoft)
2022-03-31 19:47   ` Michael Kelley (LINUX)
2022-04-01 16:09     ` Andrea Parri
2022-03-28 14:42 ` [RFC PATCH 4/4] PCI: hv: Fix synchronization between channel callback and hv_compose_msi_msg() Andrea Parri (Microsoft)
2022-03-31 20:04   ` Michael Kelley (LINUX)
2022-04-01 16:30     ` Andrea Parri

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=20220401160036.GA437893@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).