From: Andrea Parri <parri.andrea@gmail.com>
To: Saurabh Singh Sengar <ssengar@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>,
"Michael Kelley (LINUX)" <mikelley@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-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
"linux-hyperv@vger.kernel.org" <linux-hyperv@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [EXTERNAL] [PATCH 1/2] PCI: hv: Use IDR to generate transaction IDs for VMBus hardening
Date: Sat, 19 Mar 2022 16:59:28 +0100 [thread overview]
Message-ID: <20220319155928.GA2951@anparri> (raw)
In-Reply-To: <KL1P15301MB0295879FF28B67F3C521FFB3BE149@KL1P15301MB0295.APCP153.PROD.OUTLOOK.COM>
> > @@ -1208,6 +1211,27 @@ static void hv_pci_read_config_compl(void
> > *context, struct pci_response *resp,
> > complete(&comp->comp_pkt.host_event);
> > }
> >
> > +static inline int alloc_request_id(struct hv_pcibus_device *hbus,
> > + void *ptr, gfp_t gfp)
> > +{
> > + unsigned long flags;
> > + int req_id;
> > +
> > + spin_lock_irqsave(&hbus->idr_lock, flags);
> > + req_id = idr_alloc(&hbus->idr, ptr, 1, 0, gfp);
>
> [Saurabh Singh Sengar] Many a place we are using alloc_request_id with GFP_KERNEL, which results this allocation inside of spin lock with GFP_KERNEL.
That's a bug.
> Is this a good opportunity to use idr_preload ?
I'd rather fix (and 'simplify' a bit the interface) by doing:
static inline int alloc_request_id(struct hv_pcibus_device *hbus, void *ptr)
{
unsigned long flags;
int req_id;
spin_lock_irqsave(&hbus->idr_lock, flags);
req_id = idr_alloc(&hbus->idr, ptr, 1, 0, GFP_ATOMIC);
spin_unlock_irqrestore(&hbus->idr_lock, flags);
return req_id;
}
Thoughts?
Thanks,
Andrea
next prev parent reply other threads:[~2022-03-19 15:59 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-18 17:48 [PATCH 0/2] PCI: hv: Miscellaneous changes Andrea Parri (Microsoft)
2022-03-18 17:48 ` [PATCH 1/2] PCI: hv: Use IDR to generate transaction IDs for VMBus hardening Andrea Parri (Microsoft)
2022-03-19 7:47 ` [EXTERNAL] " Saurabh Singh Sengar
2022-03-19 15:59 ` Andrea Parri [this message]
2022-03-20 5:53 ` Saurabh Singh Sengar
2022-03-19 16:20 ` Michael Kelley (LINUX)
2022-03-20 14:58 ` Andrea Parri
2022-03-21 18:23 ` Michael Kelley (LINUX)
2022-03-22 12:51 ` Andrea Parri
2022-03-18 17:48 ` [PATCH 2/2] PCI: hv: Fix synchronization between channel callback and hv_compose_msi_msg() Andrea Parri (Microsoft)
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=20220319155928.GA2951@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=ssengar@microsoft.com \
--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).