linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Scott Wood <scottwood@freescale.com>
To: Zhao Qiang-B45475 <qiang.zhao@freescale.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>,
	"lauraa@codeaurora.org" <lauraa@codeaurora.org>,
	Xie Xiaobo-R63061 <X.Xie@freescale.com>,
	"benh@kernel.crashing.org" <benh@kernel.crashing.org>,
	Li Yang-Leo-R58472 <LeoLi@freescale.com>,
	"paulus@samba.org" <paulus@samba.org>
Subject: Re: [PATCH v10 3/5] CPM/QE: use genalloc to manage CPM/QE muram
Date: Thu, 24 Sep 2015 18:30:06 -0500	[thread overview]
Message-ID: <1443137406.32298.74.camel@freescale.com> (raw)
In-Reply-To: <SN1PR0301MB155040D7F785F40B2B07E6219B440@SN1PR0301MB1550.namprd03.prod.outlook.com>

On Wed, 2015-09-23 at 00:28 -0500, Zhao Qiang-B45475 wrote:
> On Wen, Sep 23, 2015 at 12:03 AM +0800, Wood Scott-B07421 wrote:
> 
> > -----Original Message-----
> > From: Wood Scott-B07421
> > Sent: Wednesday, September 23, 2015 12:03 PM
> > To: Zhao Qiang-B45475
> > Cc: linux-kernel@vger.kernel.org; linuxppc-dev@lists.ozlabs.org;
> > lauraa@codeaurora.org; Xie Xiaobo-R63061; benh@kernel.crashing.org; Li
> > Yang-Leo-R58472; paulus@samba.org
> > Subject: Re: [PATCH v10 3/5] CPM/QE: use genalloc to manage CPM/QE muram
> > 
> > On Tue, 2015-09-22 at 21:20 -0500, Zhao Qiang-B45475 wrote:
> > > On Wen, Sep 23, 2015 at 8:19 AM +0800, Wood Scott-B07421 wrote:
> > > 
> > > > > > >  {
> > > > > > > - int ret;
> > > > > > > +
> > > > > > > + unsigned long start;
> > > > > > >   unsigned long flags;
> > > > > > > + unsigned long size_alloc = size; struct muram_block *entry;
> > > > > > > + int end_bit; int order = muram_pool->min_alloc_order;
> > > > > > > 
> > > > > > >   spin_lock_irqsave(&cpm_muram_lock, flags);
> > > > > > > - ret = rh_free(&cpm_muram_info, offset);
> > > > > > > + end_bit = (offset >> order) + ((size + (1UL << order) - 1)
> > > > > > > + >>
> > > > > > order);
> > > > > > > + if ((offset + size) > (end_bit << order))
> > > > > > > +         size_alloc = size + (1UL << order);
> > > > > > 
> > > > > > Why do you need to do all these calculations here?
> > > > > 
> > > > > So do it in gen_pool_fixed_alloc?
> > > > 
> > > > Could you explain why they're needed at all?
> > > 
> > > Why it does the calculations?
> > > If the min block of gen_pool is 8 bytes, and I want to allocate a
> > > Region with offset=7, size=8bytes, I actually need block 0 and block
> > > 1, And the allocation will give me block 0.
> > 
> > How can you have offset 7 if the minimum order is 2 bytes?
> 
> Offset has no relationship with minimum order, it is not decided by minimum 
> order.

All allocations begin and end on a multiple of the minimum order.

> I want to allocate a specific region with offset=7, then algo to calculate 
> the block bit.
> And I just take it for example, it is not I really need to region offset=7.

Do you really need any fixed allocations that begin on an odd address?

> So, now minimum order is 2 bytes. If offset=7, size=4bytes needed, it 
> actually allocate 6-12 to me.

Why 6-12 and not 6-10?

-Scott

  reply	other threads:[~2015-09-24 23:30 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-18  7:15 [PATCH v10 1/5] genalloc:support memory-allocation with bytes-alignment to genalloc Zhao Qiang
2015-09-18  7:15 ` [PATCH v10 2/5] genalloc:support allocating specific region Zhao Qiang
2015-09-18  7:15 ` [PATCH v10 3/5] CPM/QE: use genalloc to manage CPM/QE muram Zhao Qiang
2015-09-21 22:47   ` Scott Wood
2015-09-22  8:10     ` Zhao Qiang
2015-09-23  0:19       ` Scott Wood
2015-09-23  2:20         ` Zhao Qiang
2015-09-23  4:02           ` Scott Wood
2015-09-23  5:28             ` Zhao Qiang
2015-09-24 23:30               ` Scott Wood [this message]
2015-09-25  2:50                 ` Zhao Qiang
2015-09-25  5:08                   ` Scott Wood
2015-09-25  5:33                     ` Zhao Qiang
2015-09-18  7:15 ` [PATCH v10 4/5] QE/CPM: move muram management functions to qe_common Zhao Qiang
2015-09-21 22:54   ` Scott Wood
2015-09-22  2:23     ` Zhao Qiang
2015-09-22  2:25       ` Scott Wood
2015-09-22  3:06         ` Zhao Qiang
2015-09-22  3:07           ` Scott Wood
2015-09-22  3:22             ` Zhao Qiang
2015-09-22  3:24               ` Scott Wood
2015-09-22  4:07                 ` Zhao Qiang
2015-09-18  7:15 ` [PATCH v10 5/5] QE: Move QE from arch/powerpc to drivers/soc Zhao Qiang
2015-09-21 22:56   ` Scott Wood
2015-09-22  8:24     ` Zhao Qiang
2015-09-22 16:39       ` Scott Wood
2015-09-23  2:01         ` Zhao Qiang

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=1443137406.32298.74.camel@freescale.com \
    --to=scottwood@freescale.com \
    --cc=LeoLi@freescale.com \
    --cc=X.Xie@freescale.com \
    --cc=benh@kernel.crashing.org \
    --cc=lauraa@codeaurora.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=paulus@samba.org \
    --cc=qiang.zhao@freescale.com \
    /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).