All of lore.kernel.org
 help / color / mirror / Atom feed
From: Suman Anna <s-anna@ti.com>
To: Ohad Ben-Cohen <ohad@wizery.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>
Subject: Re: [PATCH] rpmsg: compute number of buffers to allocate from vrings
Date: Wed, 13 Aug 2014 10:47:46 -0500	[thread overview]
Message-ID: <53EB88A2.1070408@ti.com> (raw)
In-Reply-To: <CAK=WgbYLUcnK1p0qUkfONavk+W1eXg5fcaTNcU4W3ova6wySuQ@mail.gmail.com>

Hi Ohad,

On 08/13/2014 08:40 AM, Ohad Ben-Cohen wrote:
> Hi Suman,
> 
> On Tue, Aug 12, 2014 at 7:19 PM, Suman Anna <s-anna@ti.com> wrote:
>> Yes, I was playing around with using less buffers in the remoteproc
>> resource table for the vrings. The remoteproc virtio code creates the
>> vrings using the number of buffers based on .num field value of struct
>> fw_rsc_vdev_vring in the resource table. The virtio rpmsg probe code
>> though tries to set up the receive buffers for the same virtqueue based
>> on the current hard-coded value of 512 buffers and virtqueue_add_inbuf
>> would fail as the virtqueue is created with less number of buffers and
>> throws a WARN_ON.
> 
> Gotcha - thanks for the details.
> 
> Limiting the number of buffers in case the vrings are too small makes
> sense, but let's use RPMSG_NUM_BUFS as an upper bound, so wacky
> resource tables won't trigger unreasonable memory waste.
> 
> Something in the lines of:
> 
> vrp->num_bufs = min(PMSG_NUM_BUFS, virtqueue_get_vring_size(vrp->rvq) * 2);
> 
> Should probably do the trick.
> 
> Does this satisfy your requirement?

Yeah, this will work for me. I will go ahead and add a WARN_ON as well
to detect above wacky condition, and if someone really needs more
buffers in the future, we can revisit this.

regards
Suman

      reply	other threads:[~2014-08-13 15:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-03 20:53 [PATCH] rpmsg: compute number of buffers to allocate from vrings Suman Anna
2014-07-03 20:53 ` Suman Anna
2014-08-12 15:30 ` Ohad Ben-Cohen
2014-08-12 16:19   ` Suman Anna
2014-08-13 13:40     ` Ohad Ben-Cohen
2014-08-13 15:47       ` Suman Anna [this message]

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=53EB88A2.1070408@ti.com \
    --to=s-anna@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=ohad@wizery.com \
    --cc=rusty@rustcorp.com.au \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.