Re: [EXTERNAL] [PATCH 1/2] PCI: hv: Use IDR to generate transaction IDs for VMBus hardening

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> > @@ -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



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux