From: Arnd Bergmann <arnd@kernel.org>
To: Eric Gao <eric.tech@foxmail.com>
Cc: "catalin.marinas" <catalin.marinas@arm.com>,
will <will@kernel.org>, geert <geert@linux-m68k.org>,
monstr <monstr@monstr.eu>, tsbogend <tsbogend@alpha.franken.de>,
James Bottomley <James.Bottomley@hansenpartnership.com>,
deller <deller@gmx.de>, mpe <mpe@ellerman.id.au>,
hca <hca@linux.ibm.com>, gor <gor@linux.ibm.com>,
borntraeger <borntraeger@de.ibm.com>,
ysato <ysato@users.sourceforge.jp>, dalias <dalias@libc.org>,
davem <davem@davemloft.net>, luto <luto@kernel.org>,
tglx <tglx@linutronix.de>, mingo <mingo@redhat.com>,
bp <bp@alien8.de>, chris <chris@zankel.net>,
jcmvbkbc <jcmvbkbc@gmail.com>, arnd <arnd@arndb.de>,
benh <benh@kernel.crashing.org>, paulus <paulus@samba.org>,
hpa <hpa@zytor.com>, linux-alpha <linux-alpha@vger.kernel.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
linux-api <linux-api@vger.kernel.org>,
linux-arch <linux-arch@vger.kernel.org>
Subject: Re: [PATCH] ipc/msg: add msgsnd_timed and msgrcv_timed syscall for system V message queue
Date: Sun, 28 Feb 2021 16:38:07 +0100 [thread overview]
Message-ID: <CAK8P3a2TEc4CzE5Wg7pNy9Oq2p=HKNO7k2y2SmeD1mamqJ3Z9w@mail.gmail.com> (raw)
In-Reply-To: <tencent_2CB9BD7D4063DE3F6845F79176B2D29A7E09@qq.com>
On Sun, Feb 28, 2021 at 4:16 PM Eric Gao <eric.tech@foxmail.com> wrote:
>
> Hi Arnd:
>
> Thanks for your kindly reply.
>
> I want to prove you and all of others that these syscalls are very useful and necessary. Actually, I add these syscalls
>
> when I try to implement the local rpc by system v message queue (some people might think I am crazy to using message
>
> queue, but it's truly a very efficient method than socket except it don't have a time-controlled msgrcv syscall).
(note: please don't reply in html)
> In addition, msgrcv_timed is also necessary in usual bidirection communication. For example:
> A send a message to B, and try to receive a reply from B by msgrcv syscall. But A need to do
> something else in case of that B has terminated. So
>
> we need the msgrcv syscall return after a preset time. The similar syscall can be found in
> posix message queue(mq_timedreceive) and in z/OS system of
> IBM(https://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.2.0/com.ibm.zos.v2r2.bpxbd00/msgrcvt.htm).
>
> And when I search the web, I can find that many people need such like syscall in their
> applications. so I hope this patch can be merged into the mainline, Thanks a lot.
It might help to add some explanation on why you need to add the timeout
to the old sysv message queues, when the more modern posix message
queues already support this.
Is there something that mq_timedsend/mq_timedreceive cannot do that
you need? Would it be possible to add that feature to the posix message
queues instead?
> +COMPAT_SYSCALL_DEFINE5(msgsnd_timed, int, msqid, compat_uptr_t, msgp,
> + compat_ssize_t, msgsz, int, msgflg, compat_long_t, timeoutms)
> +{
> + struct compat_msgbuf __user *up = compat_ptr(msgp);
> + compat_long_t mtype;
> +
> + timeoutms = (timeoutms + 9) / 10;
> +
> + if (get_user(mtype, &up->mtype))
> + return -EFAULT;
> +
> + return do_msgsnd(msqid, mtype, up->mtext, (ssize_t)msgsz, msgflg, (long)timeoutms);
> +}
>
> My preference would be to simplify both the timed and non-timed version by
> moving the get_user() into do_msgsnd() and using in_compat_task() to pick
> the right type. Same for the receive side of course. If you do this,
> watch out for x32 support, which uses the 64-bit version.
>
> Actually, the timed and non-timed version have different number of
> parameter(timed version have timeoutms), so I don't
> think they can be combine together, and I don't want to impact the
> applications which have been using the old style msgrcv syscall.
What I meant was combining the implementation of the native and
compat versions, not combining the timed and non-timed versions,
which you already do to the degree possible.
Arnd
WARNING: multiple messages have this Message-ID (diff)
From: Arnd Bergmann <arnd@kernel.org>
To: Eric Gao <eric.tech@foxmail.com>
Cc: dalias <dalias@libc.org>, benh <benh@kernel.crashing.org>,
James Bottomley <James.Bottomley@hansenpartnership.com>,
jcmvbkbc <jcmvbkbc@gmail.com>, paulus <paulus@samba.org>,
hpa <hpa@zytor.com>, will <will@kernel.org>,
linux-arch <linux-arch@vger.kernel.org>, arnd <arnd@arndb.de>,
ysato <ysato@users.sourceforge.jp>, mpe <mpe@ellerman.id.au>,
deller <deller@gmx.de>, borntraeger <borntraeger@de.ibm.com>,
mingo <mingo@redhat.com>, geert <geert@linux-m68k.org>,
"catalin.marinas" <catalin.marinas@arm.com>,
gor <gor@linux.ibm.com>, hca <hca@linux.ibm.com>,
bp <bp@alien8.de>, luto <luto@kernel.org>,
tglx <tglx@linutronix.de>,
linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
chris <chris@zankel.net>, monstr <monstr@monstr.eu>,
tsbogend <tsbogend@alpha.franken.de>,
linux-api <linux-api@vger.kernel.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
linux-alpha <linux-alpha@vger.kernel.org>,
davem <davem@davemloft.net>
Subject: Re: [PATCH] ipc/msg: add msgsnd_timed and msgrcv_timed syscall for system V message queue
Date: Sun, 28 Feb 2021 16:38:07 +0100 [thread overview]
Message-ID: <CAK8P3a2TEc4CzE5Wg7pNy9Oq2p=HKNO7k2y2SmeD1mamqJ3Z9w@mail.gmail.com> (raw)
In-Reply-To: <tencent_2CB9BD7D4063DE3F6845F79176B2D29A7E09@qq.com>
On Sun, Feb 28, 2021 at 4:16 PM Eric Gao <eric.tech@foxmail.com> wrote:
>
> Hi Arnd:
>
> Thanks for your kindly reply.
>
> I want to prove you and all of others that these syscalls are very useful and necessary. Actually, I add these syscalls
>
> when I try to implement the local rpc by system v message queue (some people might think I am crazy to using message
>
> queue, but it's truly a very efficient method than socket except it don't have a time-controlled msgrcv syscall).
(note: please don't reply in html)
> In addition, msgrcv_timed is also necessary in usual bidirection communication. For example:
> A send a message to B, and try to receive a reply from B by msgrcv syscall. But A need to do
> something else in case of that B has terminated. So
>
> we need the msgrcv syscall return after a preset time. The similar syscall can be found in
> posix message queue(mq_timedreceive) and in z/OS system of
> IBM(https://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.2.0/com.ibm.zos.v2r2.bpxbd00/msgrcvt.htm).
>
> And when I search the web, I can find that many people need such like syscall in their
> applications. so I hope this patch can be merged into the mainline, Thanks a lot.
It might help to add some explanation on why you need to add the timeout
to the old sysv message queues, when the more modern posix message
queues already support this.
Is there something that mq_timedsend/mq_timedreceive cannot do that
you need? Would it be possible to add that feature to the posix message
queues instead?
> +COMPAT_SYSCALL_DEFINE5(msgsnd_timed, int, msqid, compat_uptr_t, msgp,
> + compat_ssize_t, msgsz, int, msgflg, compat_long_t, timeoutms)
> +{
> + struct compat_msgbuf __user *up = compat_ptr(msgp);
> + compat_long_t mtype;
> +
> + timeoutms = (timeoutms + 9) / 10;
> +
> + if (get_user(mtype, &up->mtype))
> + return -EFAULT;
> +
> + return do_msgsnd(msqid, mtype, up->mtext, (ssize_t)msgsz, msgflg, (long)timeoutms);
> +}
>
> My preference would be to simplify both the timed and non-timed version by
> moving the get_user() into do_msgsnd() and using in_compat_task() to pick
> the right type. Same for the receive side of course. If you do this,
> watch out for x32 support, which uses the 64-bit version.
>
> Actually, the timed and non-timed version have different number of
> parameter(timed version have timeoutms), so I don't
> think they can be combine together, and I don't want to impact the
> applications which have been using the old style msgrcv syscall.
What I meant was combining the implementation of the native and
compat versions, not combining the timed and non-timed versions,
which you already do to the degree possible.
Arnd
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
WARNING: multiple messages have this Message-ID (diff)
From: Arnd Bergmann <arnd@kernel.org>
To: Eric Gao <eric.tech@foxmail.com>
Cc: "catalin.marinas" <catalin.marinas@arm.com>,
will <will@kernel.org>, geert <geert@linux-m68k.org>,
monstr <monstr@monstr.eu>, tsbogend <tsbogend@alpha.franken.de>,
James Bottomley <James.Bottomley@hansenpartnership.com>,
deller <deller@gmx.de>, mpe <mpe@ellerman.id.au>,
hca <hca@linux.ibm.com>, gor <gor@linux.ibm.com>,
borntraeger <borntraeger@de.ibm.com>,
ysato <ysato@users.sourceforge.jp>, dalias <dalias@libc.org>,
davem <davem@davemloft.net>, luto <luto@kernel.org>,
tglx <tglx@linutronix.de>, mingo <mingo@redhat.com>,
bp <bp@alien8.de>, chris <chris@zankel.net>,
jcmvbkbc <jcmvbkbc@gmail.com>, arnd <arnd@arndb.de>,
benh <benh@kernel.crashing.org>, paulus <paulus@samba.org>,
hpa <hpa@zytor.com>, linux-alpha <linux-alpha@vger.kernel.org>,
linux-kernel <linux-kernel@vger.ker>
Subject: Re: [PATCH] ipc/msg: add msgsnd_timed and msgrcv_timed syscall for system V message queue
Date: Sun, 28 Feb 2021 16:38:07 +0100 [thread overview]
Message-ID: <CAK8P3a2TEc4CzE5Wg7pNy9Oq2p=HKNO7k2y2SmeD1mamqJ3Z9w@mail.gmail.com> (raw)
In-Reply-To: <tencent_2CB9BD7D4063DE3F6845F79176B2D29A7E09@qq.com>
On Sun, Feb 28, 2021 at 4:16 PM Eric Gao <eric.tech@foxmail.com> wrote:
>
> Hi Arnd:
>
> Thanks for your kindly reply.
>
> I want to prove you and all of others that these syscalls are very useful and necessary. Actually, I add these syscalls
>
> when I try to implement the local rpc by system v message queue (some people might think I am crazy to using message
>
> queue, but it's truly a very efficient method than socket except it don't have a time-controlled msgrcv syscall).
(note: please don't reply in html)
> In addition, msgrcv_timed is also necessary in usual bidirection communication. For example:
> A send a message to B, and try to receive a reply from B by msgrcv syscall. But A need to do
> something else in case of that B has terminated. So
>
> we need the msgrcv syscall return after a preset time. The similar syscall can be found in
> posix message queue(mq_timedreceive) and in z/OS system of
> IBM(https://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.2.0/com.ibm.zos.v2r2.bpxbd00/msgrcvt.htm).
>
> And when I search the web, I can find that many people need such like syscall in their
> applications. so I hope this patch can be merged into the mainline, Thanks a lot.
It might help to add some explanation on why you need to add the timeout
to the old sysv message queues, when the more modern posix message
queues already support this.
Is there something that mq_timedsend/mq_timedreceive cannot do that
you need? Would it be possible to add that feature to the posix message
queues instead?
> +COMPAT_SYSCALL_DEFINE5(msgsnd_timed, int, msqid, compat_uptr_t, msgp,
> + compat_ssize_t, msgsz, int, msgflg, compat_long_t, timeoutms)
> +{
> + struct compat_msgbuf __user *up = compat_ptr(msgp);
> + compat_long_t mtype;
> +
> + timeoutms = (timeoutms + 9) / 10;
> +
> + if (get_user(mtype, &up->mtype))
> + return -EFAULT;
> +
> + return do_msgsnd(msqid, mtype, up->mtext, (ssize_t)msgsz, msgflg, (long)timeoutms);
> +}
>
> My preference would be to simplify both the timed and non-timed version by
> moving the get_user() into do_msgsnd() and using in_compat_task() to pick
> the right type. Same for the receive side of course. If you do this,
> watch out for x32 support, which uses the 64-bit version.
>
> Actually, the timed and non-timed version have different number of
> parameter(timed version have timeoutms), so I don't
> think they can be combine together, and I don't want to impact the
> applications which have been using the old style msgrcv syscall.
What I meant was combining the implementation of the native and
compat versions, not combining the timed and non-timed versions,
which you already do to the degree possible.
Arnd
next parent reply other threads:[~2021-02-28 15:39 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <tencent_2CB9BD7D4063DE3F6845F79176B2D29A7E09@qq.com>
2021-02-28 15:38 ` Arnd Bergmann [this message]
2021-02-28 15:38 ` [PATCH] ipc/msg: add msgsnd_timed and msgrcv_timed syscall for system V message queue Arnd Bergmann
2021-02-28 15:38 ` Arnd Bergmann
[not found] ` <tencent_2B7E37BD494059DF7D6845F641769CD28209@qq.com>
2021-02-28 19:49 ` Arnd Bergmann
2021-02-28 19:49 ` Arnd Bergmann
2021-02-28 19:49 ` Arnd Bergmann
[not found] <tencent_E0772A5A82FD941DB0B488DF366F3F509F07@qq.com>
2021-03-04 1:12 ` Andrew Morton
2021-03-04 19:57 ` Manfred Spraul
2021-02-27 6:52 Eric Gao
2021-02-27 6:52 ` Eric Gao
2021-02-27 12:29 ` Arnd Bergmann
2021-02-27 12:29 ` Arnd Bergmann
2021-02-27 12:29 ` Arnd Bergmann
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='CAK8P3a2TEc4CzE5Wg7pNy9Oq2p=HKNO7k2y2SmeD1mamqJ3Z9w@mail.gmail.com' \
--to=arnd@kernel.org \
--cc=James.Bottomley@hansenpartnership.com \
--cc=arnd@arndb.de \
--cc=benh@kernel.crashing.org \
--cc=borntraeger@de.ibm.com \
--cc=bp@alien8.de \
--cc=catalin.marinas@arm.com \
--cc=chris@zankel.net \
--cc=dalias@libc.org \
--cc=davem@davemloft.net \
--cc=deller@gmx.de \
--cc=eric.tech@foxmail.com \
--cc=geert@linux-m68k.org \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=hpa@zytor.com \
--cc=jcmvbkbc@gmail.com \
--cc=linux-alpha@vger.kernel.org \
--cc=linux-api@vger.kernel.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=monstr@monstr.eu \
--cc=mpe@ellerman.id.au \
--cc=paulus@samba.org \
--cc=tglx@linutronix.de \
--cc=tsbogend@alpha.franken.de \
--cc=will@kernel.org \
--cc=ysato@users.sourceforge.jp \
/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.