Re: [PATCH 25/30] lpfc: Reduce memory footprint for lpfc_queue

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

 



On Tue, 2019-03-19 at 20:35 -0700, James Smart wrote:
> > On Mar 19, 2019, at 6:02 PM, James Bottomley <James.Bottomley@Hanse
> > nPartnership.com> wrote:
> > 
> > On Tue, 2019-03-12 at 16:30 -0700, James Smart wrote:
> > > Currently the driver maintains a sideband structure which has a
> > > pointer for each queue element. However, at 8bytes a pointer, and
> > > up
> > > to 4k elements per queue, and 100's of queues, this can take up a
> > > lot
> > > of memory.
> > > 
> > > Convert the driver to using an access routine that calculates the
> > > element address based on it's index rather than using the pointer
> > > table.
> > 
> > We're getting a failure from the ppc builds according to linux-
> > next:
> > 
> > n file included from drivers/scsi/lpfc/lpfc_debugfs.c:46:
> > drivers/scsi/lpfc/lpfc_debugfs.c: In function
> > 'lpfc_idiag_queacc_write':
> > drivers/scsi/lpfc/lpfc_sli4.h:1083:14: error: inlining failed in
> > call to always_inline 'lpfc_sli4_qe': function body not available
> > inline void *lpfc_sli4_qe(struct lpfc_queue *, uint16_t);
> >              ^~~~~~~~~~~~
> > drivers/scsi/lpfc/lpfc_debugfs.c:4488:12: note: called from here
> >   pentry = lpfc_sli4_qe(pque, index);
> >            ^~~~~~~~~~~~~~~~~~~~~~~~~
> > In file included from drivers/scsi/lpfc/lpfc_debugfs.c:46:
> > drivers/scsi/lpfc/lpfc_sli4.h:1083:14: error: inlining failed in
> > call to always_inline 'lpfc_sli4_qe': function body not available
> > inline void *lpfc_sli4_qe(struct lpfc_queue *, uint16_t);
> >              ^~~~~~~~~~~~
> > drivers/scsi/lpfc/lpfc_debugfs.c:4488:12: note: called from here
> >   pentry = lpfc_sli4_qe(pque, index);
> >            ^~~~~~~~~~~~~~~~~~~~~~~~~
> > 
> > You can't declare a function inline in a header if it doesn't have
> > a
> > body available to the compiler.  So realistically you either don't
> > declare it inline or you make it a static inline in the header.  I
> > think the latter applies in this case, so this should be the fix
> > 
> > James
> > 
> > ---
> > 
> > diff --git a/drivers/scsi/lpfc/lpfc_sli.c
> > b/drivers/scsi/lpfc/lpfc_sli.c
> > index 6fc9ef888813..d6ea0c473ed7 100644
> > --- a/drivers/scsi/lpfc/lpfc_sli.c
> > +++ b/drivers/scsi/lpfc/lpfc_sli.c
> > @@ -14574,12 +14574,6 @@ lpfc_sli4_queue_alloc(struct lpfc_hba
> > *phba, uint32_t page_size,
> > 	return NULL;
> > }
> > 
> > -inline void *lpfc_sli4_qe(struct lpfc_queue *q, uint16_t idx)
> > -{
> > -	return q->q_pgs[idx / q->entry_cnt_per_pg] +
> > -		(q->entry_size * (idx % q->entry_cnt_per_pg));
> > -}
> > -
> > /**
> >  * lpfc_dual_chute_pci_bar_map - Map pci base address register to
> > host memory
> >  * @phba: HBA structure that indicates port to create a queue on.
> > diff --git a/drivers/scsi/lpfc/lpfc_sli4.h
> > b/drivers/scsi/lpfc/lpfc_sli4.h
> > index bd5b5c3de35e..20bc6d3d0653 100644
> > --- a/drivers/scsi/lpfc/lpfc_sli4.h
> > +++ b/drivers/scsi/lpfc/lpfc_sli4.h
> > @@ -1080,4 +1080,8 @@ int lpfc_sli4_post_status_check(struct
> > lpfc_hba *);
> > uint8_t lpfc_sli_config_mbox_subsys_get(struct lpfc_hba *,
> > LPFC_MBOXQ_t *);
> > uint8_t lpfc_sli_config_mbox_opcode_get(struct lpfc_hba *,
> > LPFC_MBOXQ_t *);
> > void lpfc_sli4_ras_dma_free(struct lpfc_hba *phba);
> > -inline void *lpfc_sli4_qe(struct lpfc_queue *, uint16_t);
> > +static inline void *lpfc_sli4_qe(struct lpfc_queue *q, uint16_t
> > idx)
> > +{
> > +	return q->q_pgs[idx / q->entry_cnt_per_pg] +
> > +		(q->entry_size * (idx % q->entry_cnt_per_pg));
> > +}
> 
> 
> Agree. Thank You James.

So there are a couple of other instances you can fix at your leisure:
they're not causing immediate linux-next problems because the body of
they're only apparently used within one file so the body is available,
but if the use expands we'll get the same problem:

lpfc_sli4.h:inline void lpfc_sli4_eq_clr_intr(struct lpfc_queue *);
lpfc_sli4.h:inline void lpfc_sli4_if6_eq_clr_intr(struct lpfc_queue *q);

James




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux