Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp892847ybb; Wed, 8 Apr 2020 11:57:19 -0700 (PDT) X-Google-Smtp-Source: APiQypKY0ppebeSaWTQs3sZYZ7ww/3n+02m48Xvq1QhYhsrwjK6Nz/AAwP/6esKZPguBlom+erQW X-Received: by 2002:aca:ba42:: with SMTP id k63mr969659oif.15.1586372239410; Wed, 08 Apr 2020 11:57:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586372239; cv=none; d=google.com; s=arc-20160816; b=qH+zVJbZDN5W3v3YWLDyD54kjPRcYohu2G+5BgsItvdxkNUqohMtptVNQZT9+em4n6 Vz0VCQ0cFOSGr5lGVRHmqexYnYg0zI5Dkmsd+zqI8zw1gyXOTMLZiNPfIefwr/Wbya5i 7hyZ4dpky6KwCPicyoAX81hVFLOJ0eW9LcRcqq/lkFv6YozGR46Zxjw7sqSKKLuLw3iF Kvv0H+wzxObbu3XYgZwiIX2DE7Li6YofYbnARCUeSpxZ1tlUv7AXW8t5bT7TNfNFNEQ8 2RNLkzWA4ucmJTsbWHZcagYbk6jDU3oJrdj193Kf3aaHsUCrXEj3Qi3b7WYbAzylciTg Xy6w== 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=aBgudGsrLZ+TDScEKcorJpGh0gEkG8ZAnpRrRFDsG38=; b=HvNAENJAbqmNH8UuTVXrHfn9OA8DQUWPI+ikMeSpkbiz45J0J0wWYCd5gm1oI4JGZ8 +Y8aVy3hOfu3Us02PEAnXLQ3x+7snnIUbzjudl7RbNm+y4tNOZe5AZkHNTtaH3MaK+vm F6z4FRa9SIqtuSdFH3edvfMENywqp2EHfJBqveksoSwLobMVQrN3MB5OIw5eQWRnknh5 bHmFvDJl7GKR97+ZQyMKopUJDyIqYSFqQweLei81Sjmf2/bNzs8wzHVU1FOAoFFKNcrn GtAYQbkBfGHAXmciXlHn6XRivXljPCp+fhoRzhzHuz5UZutesZY6D7nO346KxUzCKfSc HK5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rxcnFhtx; 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=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u135si2332163oif.248.2020.04.08.11.57.05; Wed, 08 Apr 2020 11:57:19 -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=@linaro.org header.s=google header.b=rxcnFhtx; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730100AbgDHQAK (ORCPT + 99 others); Wed, 8 Apr 2020 12:00:10 -0400 Received: from mail-io1-f66.google.com ([209.85.166.66]:40815 "EHLO mail-io1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727801AbgDHQAK (ORCPT ); Wed, 8 Apr 2020 12:00:10 -0400 Received: by mail-io1-f66.google.com with SMTP id w1so587411iot.7 for ; Wed, 08 Apr 2020 09:00:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=aBgudGsrLZ+TDScEKcorJpGh0gEkG8ZAnpRrRFDsG38=; b=rxcnFhtxDIt8Py8z0ni7LEk9HIXreuu8sDgwnsMq0QQpb9Eyctal58xsa1R2NR6Ybp PXkQPtnFlJpuoGhXmcbBpy8GGwUXBoerGdQvMFLvHZQ2PVF2CICMN5QbxSyF1k57y1CF FXXIqCeuVmkzFhJOU+OHSFjZgjH+9UVYGBRse870CyNHNeMExFE2eeOyyz0161m85uyi ARsNc9aTOTiy68zr282xOEY5qRYjzxLGPf/ievoqEd7kr9aqD3m18bYE7E1oN4a4JYi4 5+JNZB1g8ka0CujXw6zDn7BRo5Efh/TFLDz+kjqyq1a9JvVQx4d4gR8bTkVKqmuxC5DK ir4A== 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=aBgudGsrLZ+TDScEKcorJpGh0gEkG8ZAnpRrRFDsG38=; b=bQwJf3cNrdc7pAwkKw0w/FAykj77NOoCwQVIhFZMVZCSF4mAc6JpzHGs7h/48TqawY o5UkokQxqV+KvpsHhUhDuo1mu4/9i2D2DxrqV4PYToerbvpJ2PA7G+ZVs2a0fTZ5bSXD hvlibz/0N1BC8QWUYB386csgKIEtWBVF7wpK5f/k2HJXa81p9O8QFRXd2zOQ6kkfY7G4 fUEPxqaOUGvCxd3GwuRKW8lSez3BWUek2e58wBKUY0fcKX+BrobtSc/oNVHdtnKMyhow DcFfqIONy3uQKuF9QPs4QtJZQH0U9Q0oYaKUnGtEU//EZntAFfNasQlQ6+danVRTn734 3srA== X-Gm-Message-State: AGi0PuY+km1ifKWlJvsc1zsH4Fvrn021v1FVZ7DF/8HP45UvkP1s6ibY uRMJDow7AMx73nWQeSPmamMCBR60riC3ElATd88FKQ== X-Received: by 2002:a05:6638:186:: with SMTP id a6mr7273559jaq.36.1586361608649; Wed, 08 Apr 2020 09:00:08 -0700 (PDT) MIME-Version: 1.0 References: <20200310155058.1607-1-mathieu.poirier@linaro.org> <591bd727-32af-9ea2-8c46-98f46ee3711e@ti.com> <34d1277f-c35e-5df8-7d0c-ea1e961a127f@st.com> <20200327193602.GA22939@xps15> <77cba22f-5911-e88a-ec25-50cbe9b8fbbe@ti.com> In-Reply-To: <77cba22f-5911-e88a-ec25-50cbe9b8fbbe@ti.com> From: Mathieu Poirier Date: Wed, 8 Apr 2020 09:59:57 -0600 Message-ID: Subject: Re: [PATCH v2] rpmsg: core: Add wildcard match for name service To: Suman Anna Cc: Arnaud POULIQUEN , Ohad Ben-Cohen , Bjorn Andersson , linux-remoteproc , Linux Kernel Mailing List 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 Tue, 7 Apr 2020 at 17:07, Suman Anna wrote: > > Hi Mathieu, Arnaud, > > On 3/27/20 2:36 PM, Mathieu Poirier wrote: > > On Fri, Mar 27, 2020 at 10:35:34AM +0100, Arnaud POULIQUEN wrote: > >> Hi > >> > >> On 3/26/20 11:01 PM, Mathieu Poirier wrote: > >>> On Thu, 26 Mar 2020 at 14:42, Suman Anna wrote: > >>>> > >>>> On 3/26/20 3:21 PM, Mathieu Poirier wrote: > >>>>> On Thu, 26 Mar 2020 at 09:06, Suman Anna wrote: > >>>>>> > >>>>>> Hi Mathieu, > >>>>>> > >>>>>> On 3/10/20 10:50 AM, Mathieu Poirier wrote: > >>>>>>> Adding the capability to supplement the base definition published > >>>>>>> by an rpmsg_driver with a postfix description so that it is possible > >>>>>>> for several entity to use the same service. > >>>>>>> > >>>>>>> Signed-off-by: Mathieu Poirier > >>>>>>> Acked-by: Arnaud Pouliquen > >>>>>> > >>>>>> So, the concern I have here is that we are retrofitting this into the > >>>>>> existing 32-byte name field, and the question is if it is going to be > >>>>>> enough in general. That's the reason I went with the additional 32-byte > >>>>>> field with the "rpmsg: add a description field" patch. > >>>>>> > >>>>> > >>>>> That's a valid concern. > >>>>> > >>>>> Did you consider increasing the size of RPMSG_NAME_SIZE to 64? Have > >>>>> you found cases where that wouldn't work? I did a survey of all the > >>>>> places the #define is used and all destination buffers are also using > >>>>> the same #define in their definition. It would also be backward > >>>>> compatible with firmware implementations that use 32 byte. > >>>> > >>>> You can't directly bump the size without breaking the compatibility on > >>>> the existing rpmsg_ns_msg in firmwares right? All the Linux-side drivers > >>>> will be ok since they use the same macro but rpmsg_ns_msg has presence > >>>> on both kernel and firmware-sides. > >>> > >>> Ah yes yes... The amount of bytes coming out of the pipe won't match. > >>> Let me think a little... > >> > >> +1 for Suman's concern. > >> > >> Anyway i would like to challenge the need of more than 32 bytes to > >> differentiate service instances. > >> "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", seems to me enough if we only need > >> to differentiate the instances. > > Remember that the rpmsg_device_id name takes some space within here. So, > the shorter the rpmsg_device_id table name, the more room you have. > > >> > >> But perhaps the need is also to provide a short description of the service? > > I am mostly using it to provide a unique instantiation name. In anycase, > I have cross-checked against my current firmwares, and so far all of > them happen to have the name + desc < 31 bytes. > > > >> > >> Suman, could you share some examples of your need? > > > > Looking at things further it is possible to extend the name of the service to > > 64 byte while keeping backward compatibility by looking up the size of @len > > in function rpmsg_ns_cb(). From there work with an rpmsg_ns_msg or a new > > rpmsg_ns_msg64, pretty much the way you did in your patch[1]. In fact the > > approach is the same except you are using 2 arrays of 32 byte and I'm using one > > of 64. > > > > As Arnaud mentioned, is there an immediate need to support a 64-byte name? If > > not than I suggest to move forward with this patch and address the issue when we > > get there - at least we know there is room for extention. Otherwise I'll spin > > off another revision but it will be bigger and more complex. > > Yeah ok. I have managed to get my downstream drivers that use the desc > field working with this patch after modifying the firmwares to publish > using combined name, and adding logic in probe to get the trailing > portion of the name. Perfect > > So, the only thing that is missing or content for another patch is if we > need to add some tooling/helper stuff for giving the trailing stuff to > rpmsg drivers? So that all rpmsg drivers don't come up with their own parsing that ends up doing the same thing. Let me think about that - I may have to get back to you... > > regards > Suman > > > > > Thanks, > > Mathieu > > > > [1]. https://patchwork.kernel.org/patch/11096599/ > > > >>>>>> > >>>>>>> --- > >>>>>>> Changes for V2: > >>>>>>> - Added Arnaud's Acked-by. > >>>>>>> - Rebased to latest rproc-next. > >>>>>>> > >>>>>>> drivers/rpmsg/rpmsg_core.c | 20 +++++++++++++++++++- > >>>>>>> 1 file changed, 19 insertions(+), 1 deletion(-) > >>>>>>> > >>>>>>> diff --git a/drivers/rpmsg/rpmsg_core.c b/drivers/rpmsg/rpmsg_core.c > >>>>>>> index e330ec4dfc33..bfd25978fa35 100644 > >>>>>>> --- a/drivers/rpmsg/rpmsg_core.c > >>>>>>> +++ b/drivers/rpmsg/rpmsg_core.c > >>>>>>> @@ -399,7 +399,25 @@ ATTRIBUTE_GROUPS(rpmsg_dev); > >>>>>>> static inline int rpmsg_id_match(const struct rpmsg_device *rpdev, > >>>>>>> const struct rpmsg_device_id *id) > >>>>>>> { > >>>>>>> - return strncmp(id->name, rpdev->id.name, RPMSG_NAME_SIZE) == 0; > >>>>>>> + size_t len = min_t(size_t, strlen(id->name), RPMSG_NAME_SIZE); > >>>>>>> + > >>>>>>> + /* > >>>>>>> + * Allow for wildcard matches. For example if rpmsg_driver::id_table > >>>>>>> + * is: > >>>>>>> + * > >>>>>>> + * static struct rpmsg_device_id rpmsg_driver_sample_id_table[] = { > >>>>>>> + * { .name = "rpmsg-client-sample" }, > >>>>>>> + * { }, > >>>>>>> + * } > >>>>>>> + * > >>>>>>> + * Then it is possible to support "rpmsg-client-sample*", i.e: > >>>>>>> + * rpmsg-client-sample > >>>>>>> + * rpmsg-client-sample_instance0 > >>>>>>> + * rpmsg-client-sample_instance1 > >>>>>>> + * ... > >>>>>>> + * rpmsg-client-sample_instanceX > >>>>>>> + */ > >>>>>>> + return strncmp(id->name, rpdev->id.name, len) == 0; > >>>>>>> } > >>>>>>> > >>>>>>> /* match rpmsg channel and rpmsg driver */ > >>>>>>> > >>>>>> > >>>> >