From: Andreas Herrmann <andreas.herrmann@caviumnetworks.com>
To: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Cc: Pekka Enberg <penberg@kernel.org>,
David Daney <ddaney.cavm@gmail.com>, <kvm@vger.kernel.org>,
<linux-mips@linux-mips.org>, David Daney <david.daney@cavium.com>
Subject: Re: [PATCH 11/11] kvm tools: Modify term_putc to write more than one char
Date: Mon, 12 May 2014 13:21:11 +0200 [thread overview]
Message-ID: <20140512112111.GE15623@alberich> (raw)
In-Reply-To: <536A5826.6010008@cogentembedded.com>
On Wed, May 07, 2014 at 07:58:30PM +0400, Sergei Shtylyov wrote:
> Hello.
>
> On 06-05-2014 19:51, Andreas Herrmann wrote:
>
> >From: David Daney <david.daney@cavium.com>
>
> >It is a performance enhancement. When running in a simulator, each
> >system call to write a character takes a lot of time. Batching them
> >up decreases the overhead (in the root kernel) of each virtio console
> >write.
>
> >Signed-off-by: David Daney <david.daney@cavium.com>
> >Signed-off-by: Andreas Herrmann <andreas.herrmann@caviumnetworks.com>
> >---
> > tools/kvm/term.c | 7 +++++--
> > 1 file changed, 5 insertions(+), 2 deletions(-)
>
> >diff --git a/tools/kvm/term.c b/tools/kvm/term.c
> >index 3de410b..b153eed 100644
> >--- a/tools/kvm/term.c
> >+++ b/tools/kvm/term.c
> >@@ -52,11 +52,14 @@ int term_getc(struct kvm *kvm, int term)
> > int term_putc(char *addr, int cnt, int term)
> > {
> > int ret;
> >+ int num_remaining = cnt;
> >
> >- while (cnt--) {
> >- ret = write(term_fds[term][TERM_FD_OUT], addr++, 1);
> >+ while (num_remaining) {
> >+ ret = write(term_fds[term][TERM_FD_OUT], addr, num_remaining);
> > if (ret < 0)
> > return 0;
>
> Perhaps 'return cnt - num_remaining' instead?
Although all current callers of this function are not checking the
return value I aggree that this change would be nice to have.
I wouldn't make this change within this patch though.
(I'll add a separate patch to modify the return value.)
> >+ num_remaining -= ret;
> >+ addr += ret;
> > }
> >
> > return cnt;
>
> WBR, Sergei
Thanks,
Andreas
prev parent reply other threads:[~2014-05-12 11:21 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-06 15:51 [PATCH 00/11] kvm tools: Misc patches (mips support) Andreas Herrmann
2014-05-06 15:51 ` [PATCH 01/11] kvm tools: Print message on failure of KVM_CREATE_VM Andreas Herrmann
2014-05-06 15:51 ` [PATCH 02/11] kvm tools: Fix print format warnings Andreas Herrmann
2014-05-06 15:51 ` [PATCH 03/11] kvm tools: Move definition of TERM_MAX_DEVS to header Andreas Herrmann
2014-05-06 15:51 ` [PATCH 04/11] kvm tools: Allow to load ELF binary Andreas Herrmann
2014-05-06 15:51 ` [PATCH 05/11] kvm tools, mips: Add MIPS support Andreas Herrmann
2014-05-09 21:15 ` James Hogan
2014-05-12 13:01 ` Andreas Herrmann
2014-05-12 14:09 ` James Hogan
2014-05-19 13:37 ` Andreas Herrmann
2014-05-06 15:51 ` [PATCH 06/11] kvm tools, mips: Enable build of mips support Andreas Herrmann
2014-05-09 21:22 ` James Hogan
2014-05-12 10:46 ` Andreas Herrmann
2014-05-06 15:51 ` [PATCH 07/11] kvm tools: Provide per arch macro to specify type for KVM_CREATE_VM Andreas Herrmann
2014-05-09 21:34 ` James Hogan
2014-05-12 10:46 ` Andreas Herrmann
2014-05-06 15:51 ` [PATCH 08/11] kvm tools: Handle virtio/pci I/O space as little endian Andreas Herrmann
2014-05-06 15:51 ` [PATCH 09/11] kvm tools, mips: Add support for loading elf binaries Andreas Herrmann
2014-05-06 15:51 ` [PATCH 10/11] kvm tools: Introduce weak (default) load_bzimage function Andreas Herrmann
2014-05-09 21:44 ` James Hogan
2014-05-12 10:47 ` Andreas Herrmann
2014-05-06 15:51 ` [PATCH 11/11] kvm tools: Modify term_putc to write more than one char Andreas Herrmann
2014-05-07 15:58 ` Sergei Shtylyov
2014-05-12 11:21 ` Andreas Herrmann [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=20140512112111.GE15623@alberich \
--to=andreas.herrmann@caviumnetworks.com \
--cc=david.daney@cavium.com \
--cc=ddaney.cavm@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=penberg@kernel.org \
--cc=sergei.shtylyov@cogentembedded.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox