Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp6488329ybi; Wed, 5 Jun 2019 01:36:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqy9ZiwEy/G+l9RZYRnpLjBThDxQeytiLqPqqIj40bNtOniLa8thEW0sCpR7/RRDkMcePrHZ X-Received: by 2002:a17:90a:216c:: with SMTP id a99mr28124067pje.3.1559723796948; Wed, 05 Jun 2019 01:36:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559723796; cv=none; d=google.com; s=arc-20160816; b=jWkgB67256QgaWLjc9JViAhRVAyTHLEEim9CiPdWneaBuScS5S0mGUAR4FhJVKAH4q 2bEg2zFcfwqjIAMubaZdD7rVcYvU8I4AySpwETWZIV+n2Jj82mYVNPoPCR8jhRaLb+om w4ZPPVw9IE8FcS/UEKewVtpc2KeS7/rdEEHdxCJRxUeHPgcAXsOgdXGqsMzUOWjOSjmK KnCujOGzQzkSrGkfCY58FPRxeAHf0RBOXY4rS8dY3g//+VnSwhtCunbqwbN+WOZtKuup uypmWqL44xne9k8+MJvCjltkOuRR8X7lFsNDX21zuvHdLjqCzsftvpL7rRCnS99Y3j7G j05A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=HG+CIt6o8yGGbLnlsmSij7gPt1dv9dO42aZ62jE5d9w=; b=kfl6ZA1IWmygpVE9IG0EPXHm8NO/xNxXfs1GrquCe3YTapbs1Z0eF9W5wpL1+ALhQZ D2aGSr78pfyS8Lm3GG5URFWJU11xeIEcuj3afpYZafLfHjJADLz93LsFibxP0XTPDTZ0 j/uQqpJ1ER0EPoG+z3wJAwTWUws+e14+yx8iFEEE1fjnh+r68WFZ3C/Ibo6GcZguqZTY Lqg/hXTgeB652c5+cs3ZyLPRl2l41SNydSV5Fo3L6Ou58Jl6teI1du4WQFNZdHuXdTFz HZpR7lX7DC8be1c/To/OPY9Q6dj9tQc9zRaU4R3nTDyyw12bMahmaiy3U4+qGhbZuaSt 9KQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=B72Gaciq; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 9si26550407pjd.48.2019.06.05.01.36.19; Wed, 05 Jun 2019 01:36:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=B72Gaciq; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726695AbfFEIfN (ORCPT + 99 others); Wed, 5 Jun 2019 04:35:13 -0400 Received: from mail-qt1-f194.google.com ([209.85.160.194]:45062 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726604AbfFEIfM (ORCPT ); Wed, 5 Jun 2019 04:35:12 -0400 Received: by mail-qt1-f194.google.com with SMTP id j19so13315745qtr.12; Wed, 05 Jun 2019 01:35:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=HG+CIt6o8yGGbLnlsmSij7gPt1dv9dO42aZ62jE5d9w=; b=B72Gaciqkdjdtm7MB2ws3CYsjdDuK9zAYhageiUCfgwWkx3FDHWDckjRAYQNE5sJbN K7A3eISAk79YAociLc0xKRWyJcrOnP/rH5Ift4b1Dvu8XoqPUMKGZTwH7/N2cfed3kHZ SwMw9WEKlGX1ILrop25xS0cnh3KEkA98TuvwDR3BCkUAYWekfR6cZX0KwemzZlV+JJHy I3LPazBAbAnbvyIYINzZZEXmGEqoBs13Z+jdD+5ys5AhMY+ZvOCMkt3ZNKZzip5wRLwm DNv1IyCYGshCBAYdW/+YOYPPcDq00Q/NTsnK6bHHme+zHAuxKQVPjYdjz731ttzM/wTx HXOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=HG+CIt6o8yGGbLnlsmSij7gPt1dv9dO42aZ62jE5d9w=; b=nGfMyQ69i9/A5XOOoiixNx0VJL9U1Ud6sp6Y20F84FOWt+zoqt2g5JfaQ6R2CV2wFc L2bYkMIDeYjxf6qASddhpTxESWPhlZyE/6kRmS4EE1fXbdep2Jd5M8Nj2vFpQM6MOvYA HvY0j1VxMcoWozgKBwxK8uxbxR/P88f5fFSFqyQynj7grkSuO4zuMJ0RAc7AHBmjjQlv TrbdAne1kEo/1huKHojqfn+cFkbMXO8yCjG/5F+LitNoLb1D/J+5n68PwAQG8Y4SqY6a ubNmunXxjgUccLq8Ozfqgeu74svTSZmznDy9tIK1X5rmW/2yeb5VQ+1WmmkSUZJcpxi/ OjtA== X-Gm-Message-State: APjAAAVL1xinoLFHPn6NSqGfSmFlHSWuVkkfXj79aibevD7t6iR/A6uI kJ20uyZ+iyUBzk2gKOVRUM8WzJ+B6wbrUe5xgEM= X-Received: by 2002:ac8:3d51:: with SMTP id u17mr10223327qtf.53.1559723711675; Wed, 05 Jun 2019 01:35:11 -0700 (PDT) MIME-Version: 1.0 References: <1548949280-31794-1-git-send-email-xiaoxiang@xiaomi.com> <20190605043452.GI22737@tuxbook-pro> <2d60dd1e-f7a0-ea63-9fda-0ea97aab0406@st.com> In-Reply-To: <2d60dd1e-f7a0-ea63-9fda-0ea97aab0406@st.com> From: xiang xiao Date: Wed, 5 Jun 2019 16:35:00 +0800 Message-ID: Subject: Re: [PATCH 0/3] Enhance virtio rpmsg bus driver buffer allocation To: Arnaud Pouliquen Cc: Bjorn Andersson , Ohad Ben Cohen , wendy.liang@xilinx.com, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, Xiang Xiao Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 5, 2019 at 3:33 PM Arnaud Pouliquen wrote: > > Hi Bjorn, > > On 6/5/19 6:34 AM, Bjorn Andersson wrote: > > On Thu 31 Jan 07:41 PST 2019, Xiang Xiao wrote: > > > >> Hi, > >> This series enhance the buffer allocation by: > >> 1.Support the different buffer number in rx/tx direction > >> 2.Get the individual rx/tx buffer size from config space > >> > >> Here is the related OpenAMP change: > >> https://github.com/OpenAMP/open-amp/pull/155 > >> > > > > This looks pretty reasonable, but can you confirm that it's possible to > > use new firmware with an old Linux kernel when introducing this? > > > > > > But ever since we discussed Loic's similar proposal earlier I've been > > questioning if the fixed buffer size isn't just an artifact of how we > > preallocate our buffers. The virtqueue seems to support arbitrary sizes > > of buffers and I see that the receive function in OpenAMP has been fixed > > to put back the buffer of the size that was received, rather than 512 > > bytes. So it seems like Linux would be able to send whatever size > > messages to OpenAMP it would handle it. > > > > The question is if we could do the same in the other direction, perhaps > > by letting the OpenAMP side do it's message allocation when it's > > sending, rather than Linux pushing inbufs to be filled by the remote. > > IMHO, both could be useful and could be not correlated. > On-the fly buffer allocation seems more efficient but needs an > allocator.This can be a generic allocator (with a va to da) for system > where large amount of memories are accessible from both side. > > Now what about system with small shared memory? In this case you have to > deal with a limited/optimized memory chunk. To avoid memory > fragmentation the allocator should have a pre-reserved buffers pool(so > similar to existing implementation). This serie seems useful to optimize > the size of the pre-reserved pool. > Maybe we can reuse rxbuf_size/txbuf_size to trigger the different allocation policy: 1.If buf_size equal 0xfffffff, turn on the dynamic allocator 2.If buf_size equall 0, turn on the fixed allocator with the default buffer size 3.otherwise, turn on the fixed allocator with the configed buffer size So, both requirement could be satisfied without breaking the compatibility. > > > > This would remove the problem of always having suboptimal buffer sizes. > > > > Regards, > > Bjorn > > > >> Xiang Xiao (3): > >> rpmsg: virtio_rpmsg_bus: allow the different vring size for send/recv > >> rpmsg: virtio_rpmsg_bus: allocate rx/tx buffer separately > >> rpmsg: virtio_rpmsg_bus: get buffer size from config space > >> > >> drivers/rpmsg/virtio_rpmsg_bus.c | 127 +++++++++++++++++++++++--------------- > >> include/uapi/linux/virtio_rpmsg.h | 24 +++++++ > >> 2 files changed, 100 insertions(+), 51 deletions(-) > >> create mode 100644 include/uapi/linux/virtio_rpmsg.h > >> > >> -- > >> 2.7.4 > >> > > -- > > Regards, > Arnaud