Hi Wang Bowen,

Do you have plans to submit and integrate it on the Linux kernel?

I think this way it will be easier for more people start to use RPMSG
integrated with Linux and NuttX.

BR,

Alan

On Tue, Nov 12, 2024 at 3:27 AM 汪博文 <wangbow...@xiaomi.com.invalid> wrote:

> Hi Andre,
>
> The attachment is the rpmsg_release_tx_buffer patch file.
>
> And thanks for sharing the solution to the rpmsgfs bug in linux 6.6, this
> is very helpful for us.
>
> Kind regards,
> Wang Bowen
>
> ---- Replied Message ----
> From Andre Heinemans<andre.heinem...@nxp.com> <undefined>
> Date 11/8/2024 21:30
> To 汪博文<wangbow...@xiaomi.com>,
> <wangbow...@xiaomi.com>dev@nuttx.apache.org<dev@nuttx.apache.org>
> <dev@nuttx.apache.org>
> Subject [External Mail]RE: [EXT] Re: RPMsg FS on NuttX and Linux
> [外部邮件] 此邮件来源于小米公司外部,请谨慎处理。若对邮件安全性存疑,请将邮件转发给mi...@xiaomi.com进行反馈
>
> Hi Wang Bowen,
>
> Thanks for sending me the updated files.
>
> I think I found the problem with the move/rename. When porting to 6.6.23 I
> had to adapt the assignment of 'struct renamedata rd' since the struct got
> changed in commit abf0857.
> Previously I only updated 'rd.old_mnt_userns = &init_user_ns;' to
> 'rd.old_mnt_idmap = &nop_mnt_idmap;'. The error disappeared when I added
> 'rd.new_mnt_idmap = &nop_mnt_idmap;' as well.
> See below our rpmsgfs_rename_handler.
>
> Do you also have the file that contain the rpmsg_release_tx_buffer()
> function? It could not be resolved. I guess rpmsg_core.c.
>
> Kind regards,
> Andre Heinemans
>
> static int rpmsgfs_rename_handler(struct rpmsg_device *rpdev,
> void *data, int len, void *priv, u32 src)
> {
> struct rpmsgfs_rename *msg = data;
> #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 12, 0)
> struct renamedata rd;
> #endif
> struct path oldpath, newpath;
> struct dentry *newdentry;
> char *oldname, *newname;
> int ret, oldlen;
> oldname = msg->pathname;
> oldlen  = (strlen(msg->pathname) + 1 + 0x7) & ~0x7;
> newname = msg->pathname + oldlen;
> ret = kern_path(oldname, 0, &oldpath);
> if (ret < 0)
> goto fail;
> if (!oldpath.dentry || !oldpath.dentry->d_parent) {
> ret = -ENOENT;
> goto fail1;
> }
> newdentry = kern_path_locked(newname, &newpath);
> if (IS_ERR(newdentry)) {
> ret = PTR_ERR(newdentry);
> goto fail1;
> }
> #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 12, 0)
> #if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)
> rd.old_mnt_idmap = &nop_mnt_idmap;
> rd.new_mnt_idmap = &nop_mnt_idmap;
> #else
> rd.old_mnt_userns = &init_user_ns;
> #endif
> rd.old_dir = oldpath.dentry->d_parent->d_inode;
> rd.old_dentry = oldpath.dentry;
> rd.new_dir = d_inode(newpath.dentry);
> rd.new_dentry = newdentry;
> rd.delegated_inode = NULL;
> rd.flags = 0;
> ret = vfs_rename(&rd);
> #else
> ret = vfs_rename(oldpath.dentry->d_parent->d_inode, oldpath.dentry,
> d_inode(newpath.dentry), newdentry, NULL, 0);
> #endif
> dput(newdentry);
> inode_unlock(d_inode(newpath.dentry));
> path_put(&newpath);
> fail1:
> path_put(&oldpath);
> fail:
> msg->header.result = ret;
> return rpmsg_send(rpdev->ept, msg, sizeof(*msg));
> }
>
> -----Original Message-----
> From: 汪博文 <wangbow...@xiaomi.com>
> Sent: Friday, 8 November 2024 10:11
> To: dev@nuttx.apache.org; Andre Heinemans <andre.heinem...@nxp.com>
> Subject: Re: [External Mail]RE: [EXT] Re: RPMsg FS on NuttX and Linux
>
> Caution: This is an external email. Please take care when clicking links
> or opening attachments. When in doubt, report the message using the 'Report
> this email' button
>
> Hi Andre,
>
> Sorry for late reply.
> ‍
> ‍About your questions:
> 1. Your small fixes in Linux Rpmsg FS is right or not?
>
> ‍‍
> Yes, your fix is right and we will update our internal version.
> 2. Any updates in our internal rpmsgfs and rpmsgtty?
>
> Actually, only some minor updates:
> ‍
> - We changed the rpmsg_fs and rpmsg_tty to kernel modules, and I have
> attached the new rpmsg_fs.c and rpmsg_tty.c in this email, you can check
> them;
> -  We also add some kernel version checks in rpmsg_fs and rpmsg_tty to make
> them can work with both kernel v5.10 and v5.15 And no other updates in
> rpmsg_fs and rpmsg_tty But we are planing to implement the rpmsg_fs client
> in linux (linux mount nuttx file system) and also port these rpmsg
> services to
> the linux kernel v6.6.
> 3. The panic in linux caused by move or rename operation We haven't
> encountered this problem before, but we can try this case in v6.6 when we
> porting rpmsg services to the new kernel version.
>
> Kind regards,
> Wang Bowen
>
> ---- Replied Message ----
> From   Andre Heinemans<andre.heinem...@nxp.com> <mailto:undefined>
>
> Date   11/8/2024 00:33
> To     dev@nuttx.apache.org<dev@nuttx.apache.org>,
> <mailto:dev@nuttx.apache.org> Xiang Xiao<xiaoxiang781...@gmail.com>,
> <mailto:xiaoxiang781...@gmail.com> Bowen
> Wang<bowenwa...@gmail.com> <mailto:bowenwa...@gmail.com>
> Subject        [External Mail]RE: [EXT] Re: RPMsg FS on NuttX and Linux
> [外部邮件]
> 此邮件来源于小米公司外部,请谨慎处理。若对邮件安全性存疑,请将
> 邮件转发给mi...@xiaomi.com进行反馈
>
> Hi Wang Bowen, Xiang Xiao,
>
> When I want to move a file through rpmsgfs from within nuttx on a
> filesystem
> hosted on linux, then I get this linux kernel oops below.
> I used the rpmsgfs linux implementation provided on this mail thread but
> ported it to 6.6.23.
>
> It looks like every move or rename gives the error. Do you know what could
> cause the problem?
>
> Are there maybe any updates of the linux rpmsgfs driver which I could try?
>
> Kind regards,
> Andre
>
> [  121.160624] Unable to handle kernel paging request at virtual address
> ffff8003848c38dc [  121.168612] Mem abort info:
> [  121.171464]   ESR = 0x0000000096000005
> [  121.175216]   EC = 0x25: DABT (current EL), IL = 32 bits
> [  121.180568]   SET = 0, FnV = 0
> [  121.183660]   EA = 0, S1PTW = 0
> [  121.186801]   FSC = 0x05: level 1 translation fault
> [  121.191709] Data abort info:
> [  121.194592]   ISV = 0, ISS = 0x00000005, ISS2 = 0x00000000
> [  121.200094]   CM = 0, WnR = 0, TnD = 0, TagAccess = 0
> [  121.205172]   GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
> [  121.210511] swapper pgtable: 4k pages, 48-bit VAs,
> pgdp=000000009216d000 [  121.217236] [ffff8003848c38dc]
> pgd=100000047ffff003, p4d=100000047ffff003, pud=0000000000000000
> [  121.225975] Internal error: Oops: 0000000096000005 [#1] PREEMPT SMP
> [  121.232241] Modules linked in:
> [  121.235320] CPU: 0 PID: 8 Comm: kworker/0:0 Not tainted 6.6.23-
> g32082bae40f6 #55 [  121.242735] Hardware name: NXP i.MX95 19X19
> board (DT) [  121.247885] Workqueue: imx95-cm7 imx_rproc_vq_work
> [  121.252703] pstate: a0400009 (NzCv daif +PAN -UAO -TCO -DIT -SSBS
> BTYPE=--) [  121.259678] pc : cmp_map_id+0x4/0x64 [  121.263266] lr :
> bsearch+0x50/0xb8 [  121.266698] sp : ffff8000825d39e0 [  121.270026]
> x29: ffff8000825d39e0 x28: ffff0000812c7600 x27: ffff0000824f8900
> [  121.277176] x26: ffff8000825d3bd8 x25: ffff800080158ae0 x24:
> ffff8000825d3a5c [  121.284326] x23: ffff800080fffe1c x22:
> 000000000000000c x21: 00000000404baf90 [  121.291476] x20:
> ffff8003848c38dc x19: 0000000080975f1f x18: ffff800082e7be28
> [  121.298626] x17: 00000000672cba83 x16: 0000000000000fdc x15:
> 0000000000001000 [  121.305793] x14: ffffffffffffffff x13:
> ffff00008086e029 x12: ffff8000825d3a74 [  121.312943] x11:
> 000000075b7a4da2 x10: 0000000000000002 x9 : 0000000000000007
> [  121.320102] x8 : ffff00008874affc x7 : 000000000000000c x6 :
> 0000000000000001 [  121.327243] x5 : 0000000000000001 x4 :
> 0000000000000001 x3 : 000000000000000c [  121.334385] x2 :
> 0000000080975f20 x1 : ffff8003848c38dc x0 : ffff8000825d3a5c
> [  121.341536] Call trace:
> [  121.343997]  cmp_map_id+0x4/0x64
> [  121.347238]  map_id_up+0xe4/0xec
> [  121.350479]  from_kuid+0x10/0x1c
> [  121.353712]  from_vfsuid+0x48/0x7c
> [  121.357135]  vfs_rename+0x43c/0xa14
> [  121.360627]  rpmsgfs_rename_handler+0xcc/0x148 [  121.365091]
> rpmsgfs_callback+0x34/0x88 [  121.368930]
> rpmsg_recv_done+0x114/0x368 [  121.372874]  vring_interrupt+0x74/0x110
> [  121.376721]  rproc_vq_interrupt+0x3c/0x90 [  121.380751]
> imx_rproc_notified_idr_cb+0x18/0x28
> [  121.385397]  idr_for_each+0x68/0xf4
> [  121.388907]  imx_rproc_vq_work+0x24/0x30 [  121.392850]
> process_one_work+0x138/0x260 [  121.396880]
> worker_thread+0x32c/0x438 [  121.400633]  kthread+0x118/0x11c
> [  121.403883]  ret_from_fork+0x10/0x20 [  121.407506] Code: 12800000
> 17ffffdd 00000000 39400004 (29400823) [  121.413609] ---[ end trace
> 0000000000000000 ]---
>
>
>
> -----Original Message-----
> From: Andre Heinemans <andre.heinem...@nxp.com>
> Sent: Friday, 1 November 2024 12:14
> To: dev@nuttx.apache.org
> Subject: RE: [EXT] Re: RPMsg FS on NuttX and Linux
>
> Caution: This is an external email. Please take care when clicking links
> or opening
> attachments. When in doubt, report the message using the 'Report
> this email'
> button
>
>
> Hi Wang Bowen, Xiang Xiao
>
> The RPMsg fs and tty works wonderful with the linux drivers I received
> from you.
> I was wondering if there are any updates on the linux drivers since the
> NuttX
> drivers do get updates quite often. It would be great if you could share
> these
> updates.
>
> On the rpmsg fs driver in linux I made a small fix on the file flags
> mapping in
> rpmsgfs_open_handler(). In NuttX the O_RDONLY symbol resolves to
> bit 0(value
> 1) but in linux it has the value 0.
> When you open a file in NuttX with O_RDWR then on linux it would
> result in
> opening the file as write-only.
>
> Below change fixed it.
>
> diff --git a/drivers/rpmsg/rpmsg_fs.c b/drivers/rpmsg/rpmsg_fs.c
> index
> 3cd35196f408..f354c6ac5ab4 100755
> --- a/drivers/rpmsg/rpmsg_fs.c
> +++ b/drivers/rpmsg/rpmsg_fs.c
> @@ -283,12 +283,15 @@ static int rpmsgfs_open_handler(struct
> rpmsg_device
> *rpdev,
> struct rpmsgfs *priv = dev_get_drvdata(&rpdev->dev);
> struct rpmsgfs_open *msg = data;
> struct file *filp;
> -       int id, flags = 0;
> +       int id, flags = O_RDONLY;
> +
> +       if (msg->flags & RPMSGFS_O_WRONLY) {
> +               if (msg->flags & RPMSGFS_O_RDONLY)
> +                       flags = O_RDWR;
> +               else
> +                       flags = O_WRONLY;
> +       }
>
> -       if (msg->flags & RPMSGFS_O_RDONLY)
> -               flags |= O_RDONLY;
> -       if (msg->flags & RPMSGFS_O_WRONLY)
> -               flags |= O_WRONLY;
> if (msg->flags & RPMSGFS_O_CREAT)
> flags |= O_CREAT;
> if (msg->flags & RPMSGFS_O_EXCL)
>
>
> Kind regards,
> Andre
>
>
>
> -----Original Message-----
> From: Bowen Wang <bowenwa...@gmail.com>
> Sent: Thursday, 27 June 2024 11:26
> To: dev@nuttx.apache.org
> Subject: Re: [EXT] Re: RPMsg FS on NuttX and Linux
>
> Caution: This is an external email. Please take care when
> clicking links or opening attachments. When in doubt, report
> the
> message using the 'Report this email' button
>
> Hi Andre,
>
> The attachment is the patch for rpmsgfs, we only implement
> the rpmsgfs
> server side in linux for now, rpmsgfs client side in linux is still
> under development.
>
> So we can access the Linux‘s file system in NuttX, but in Linux,
> we
> can't mount the Vela's file system.
>
>
> Kind regards,
>
> Wang Bowen
>
> Andre Heinemans <andre.heinem...@nxp.com
> <mailto:andre.heinem...@nxp.com> >
> 于2024年6月27日周四 17:12写道:
>
>
> Hi Bowen,
>
> I am using 6.6.3. But it would be okay for me if I receive the
> patches for version 5.15. I will try to adapt them.
>
> Thanks in advance!
>
> Kind regards,
> Andre
>
> -----Original Message-----
> From: Bowen Wang <bowenwa...@gmail.com
> <mailto:bowenwa...@gmail.com> >
> Sent: Thursday, 27 June 2024 03:46
> To: dev@nuttx.apache.org <mailto:dev@nuttx.apache.org>
> Subject: [EXT] Re: RPMsg FS on NuttX and Linux
>
> Caution: This is an external email. Please take care when
> clicking links or opening attachments. When in doubt, report
> the
> message using the 'Report this email' button
>
>
> Hi, Andre
>
> Which Linux version are you using?
> We have adapted RPMSGFS on 5.4 and 5.15. We are not sure
> if it
> meets your requirements.
>
> Kind regards,
> Wang Bowen
>
> Xiang Xiao <xiaoxiang781...@gmail.com
> <mailto:xiaoxiang781...@gmail.com> >
> 于2024年6月25日周二 22:47写道:
>
>
>
> rpmsg_fs isn't upstreamed to the Linux community
> yet. Bowen
>
>
> could give
>
>
> you a patch to try.
>
> On Tue, Jun 25, 2024 at 8:44 PM Andre Heinemans
> <andre.heinem...@nxp.com
>
>
> <mailto:andre.heinem...@nxp.com> >
>
>
> wrote:
>
>
>
> Hi,
>
> I am searching for a solution to share a disk or
> directory on a
> Linux
>
>
> host
>
>
> and make it accessible in NuttX through
> RPMsg. It looks like
> CONFIG_FS_RPMSGFS is the feature I need.
> According to this
>
>
> NuttX
>
>
> channel video
>
>
>
>
> (https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F
> %2Fwww
> .youtube.com%2Fwatch%3Fv%3D-
>
>
> YLAQlJR1vA&data=05%7C02%7Candre.heinemans%
>
>
>
> 40nxp.com%7C6f0b6a9c5414411f9a6f08dcfa6682e9%7C686ea1d3
> bc2b4c6fa92c
> d99
>
>
>
> c5c301635%7C0%7C0%7C638660565421329758%7CUnknown%7
> CTWFpbGZsb3
> d8eyJWIjo
>
>
>
> iMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3
> D%7C0%7C
> %7C%
>
>
>
> 7C&sdata=dQFQqYjk0nIFKGjDD%2FM54PHXW54rnZVWyYojrOGCV%
> 2BY%3D&res
> erved=0
>
>
>
> <https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F
> %2Fwww%2F
> &data=05%7C02%7Candre.heinemans%40nxp.com%7C6f0b6a9c54
> 14411f9a6f08
> dcfa6682e9%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%
> 7C63866056
> 5421352725%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAw
> MDAiLCJQIjoiV
> 2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdat
> a=8GauYdm
> OMhqbLro1EWfPIBGftfYLE%2B79%2BDzvvfBqw7E%3D&reserved=0.
>
>
> youtube.com%2Fwatch%3Fv%3D-
>
> YLAQlJR1vA&data=05%7C02%7Candre.heinemans%40nxp.com%7C7
> b20118b
>
>
>
> 5af34936356e08dc968b5405%7C686ea1d3bc2b4c6fa92cd99c5c30
> 1635%7C0%
>
>
>
> 7C0%7C638550772355433038%7CUnknown%7CTWFpbGZsb3d8ey
> JWIjoiMC4
>
> wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7
> C0%7C%7
>
> C%7C&sdata=wNH%2FytC3N7YXDeP8Cff3UZ3JeMbwpFIqaNWeznee
> oJ0%3D&
> reserved=0> )  various RPMsg services in Nuttx are supported
> in Linux
> including RPMsg FS.
>
>
>
> So, I tried setting this up but couldn’t find the
> correct linux
> module that is able to interact with this
> service.
>
> When I try to mount a directory with
> nsh> mount -t rpmsgfs -o
> cpu=netcore,fs=/mnt /mnt
>
> Some interaction happens. See linux dmesg
> log:
> [   61.086471] virtio_rpmsg_bus virtio0:
> creating channel
> rpmsgfs-0x2000c1c8 addr 0x401
>
> But it seems no linux driver is listening to that
> channel. When I
> try to access the mounted directory in NuttX
> then nsh freezes.
>
> What do I need to do on Linux to support this
> service? Do I maybe
> need a patch or a different fork?
>
> Kind regards,
> Andre
>
>
>
>
>
>
> #/******本邮件及其附件含有小米公司的保密信息,仅限于发送给上面
> 地址中列出的个人或群组。禁止任何其他人以任何形式使用(包括但不
> 限于全部或部分地泄露、复制、或散发)本邮件中的信息。如果您错收
> 了本邮件,请您立即电话或邮件通知发件人并删除本邮件! This e-mail
> and its attachments contain confidential information from XIAOMI, which is
> intended only for the person or entity whose address is listed above. Any
> use
> of the information contained herein in any way (including, but not limited
> to,
> total or partial disclosure, reproduction, or dissemination) by persons
> other
> than the intended recipient(s) is prohibited. If you receive this e-mail
> in error,
> please notify the sender by phone or email immediately and delete
> it!******/#
>
> #/******本邮件及其附件含有小米公司的保密信息,仅限于发送给上面地址中列出的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制、或散发)本邮件中的信息。如果您错收了本邮件,请您立即电话或邮件通知发件人并删除本邮件!
> This e-mail and its attachments contain confidential information from
> XIAOMI, which is intended only for the person or entity whose address is
> listed above. Any use of the information contained herein in any way
> (including, but not limited to, total or partial disclosure, reproduction,
> or dissemination) by persons other than the intended recipient(s) is
> prohibited. If you receive this e-mail in error, please notify the sender
> by phone or email immediately and delete it!******/#
>

Reply via email to