From: Halil Pasic <pasic@linux.vnet.ibm.com>
To: Cornelia Huck <cohuck@redhat.com>
Cc: qemu-devel@nongnu.org, Alexander Graf <agraf@suse.de>,
Christian Borntraeger <borntraeger@de.ibm.com>,
"Jason J . Herne" <jjherne@linux.vnet.ibm.com>,
Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com>,
Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH 1/2] s390x/3270: IDA support for 3270 via CcwDataStream
Date: Thu, 21 Sep 2017 13:22:44 +0200 [thread overview]
Message-ID: <efa7f105-78c4-1ec0-dcf5-9b97678cd7e5@linux.vnet.ibm.com> (raw)
In-Reply-To: <20170921111552.41167e80.cohuck@redhat.com>
On 09/21/2017 11:15 AM, Cornelia Huck wrote:
>> +static inline CcwDataStream *get_cds(Terminal3270 *t)
>> +{
>> + return &(CCW_DEVICE(&t->cdev)->sch->cds);
>> +}
>> +
>> +static int read_payload_3270(EmulatedCcw3270Device *dev)
>> {
>> Terminal3270 *t = TERMINAL_3270(dev);
>> int len;
>>
>> - len = MIN(count, t->in_len);
>> - cpu_physical_memory_write(cda, t->inv, len);
>> + len = MIN(ccw_dstream_avail(get_cds(t)), t->in_len);
>> + ccw_dstream_write_buf(get_cds(t), t->inv, len);
> CCW_DEVICE() as called by get_cds() goes through qom, which implies a
> bit of overhead. Not sure if it makes sense to cache it in this
> function so you don't go through it multiple times. (Dito for the other
> callback.)
>
I've cargo-culted this way of getting CCW_DEVICE(&t->cdev) to the CcwDevice
form terminal_read (the pattern used at multiple places in the file). As
far as I can tell, the overhead basically depends on CONFIG_QOM_CAST_DEBUG.
I have no idea what do we have in production, but my guess is, that
ONFIG_QOM_CAST_DEBUG makes only sense for development and testing
(especially if proper test coverage is assumed).
Can you enlighten me?
CCW_DEVICE() may contain a run-time check (depending on CONFIG_QOM_CAST_DEBUG),
we however can make sure things are OK at compile time. This brings
me to the next question. Does it even make sense to use OBJECT_CHECK based
constructs when going from specific to general (we don't actually need a
cast here)? Obviously, for the other direction we really need a cast, so doing
a run-time check there does indeed provide added value.
Halil
>> t->in_len -= len;
>>
>> return len;
next prev parent reply other threads:[~2017-09-21 11:23 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-20 17:23 [Qemu-devel] [PATCH 0/2] 3270 improvements Halil Pasic
2017-09-20 17:23 ` [Qemu-devel] [PATCH 1/2] s390x/3270: IDA support for 3270 via CcwDataStream Halil Pasic
2017-09-21 9:15 ` Cornelia Huck
2017-09-21 11:22 ` Halil Pasic [this message]
2017-09-21 12:05 ` Cornelia Huck
2017-09-21 16:11 ` Halil Pasic
2017-09-22 13:38 ` Cornelia Huck
2017-09-20 17:23 ` [Qemu-devel] [PATCH 2/2] s390x/3270: handle writes of arbitrary length Halil Pasic
2017-09-21 9:23 ` Cornelia Huck
2017-09-21 10:30 ` Halil Pasic
2017-09-20 18:22 ` [Qemu-devel] [PATCH 0/2] 3270 improvements no-reply
2017-09-21 9:24 ` Cornelia Huck
2017-09-21 10:22 ` Halil Pasic
2017-09-21 10:48 ` Cornelia Huck
2017-09-21 11:00 ` Halil Pasic
2017-09-27 14:15 ` Halil Pasic
2017-09-28 15:19 ` Cornelia Huck
2017-09-28 15:20 ` Halil Pasic
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=efa7f105-78c4-1ec0-dcf5-9b97678cd7e5@linux.vnet.ibm.com \
--to=pasic@linux.vnet.ibm.com \
--cc=agraf@suse.de \
--cc=bjsdjshi@linux.vnet.ibm.com \
--cc=borntraeger@de.ibm.com \
--cc=cohuck@redhat.com \
--cc=jjherne@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/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;
as well as URLs for NNTP newsgroup(s).