qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Farman <farman@linux.ibm.com>
To: Cornelia Huck <cohuck@redhat.com>
Cc: Halil Pasic <pasic@linux.ibm.com>,
	Jason Herne <jjherne@linux.ibm.com>,
	qemu-s390x@nongnu.org, qemu-devel@nongnu.org,
	Jared Rossi <jrossi@linux.ibm.com>
Subject: Re: [PATCH v3 6/7] s390x/css: Refactor the css_queue_crw() routine
Date: Tue, 21 Apr 2020 09:04:52 -0400	[thread overview]
Message-ID: <ecd45274-0116-72b4-44f5-818032e14ebf@linux.ibm.com> (raw)
In-Reply-To: <20200421142834.16f5ea16.cohuck@redhat.com>



On 4/21/20 8:28 AM, Cornelia Huck wrote:
> On Fri, 17 Apr 2020 04:34:39 +0200
> Eric Farman <farman@linux.ibm.com> wrote:
> 
>> We have a use case (vfio-ccw) where a CRW is already built and
>> ready to use.  Rather than teasing out the components just to
>> reassemble it later, let's rework this code so we can queue a
>> fully-qualified CRW directly.
>>
>> Signed-off-by: Eric Farman <farman@linux.ibm.com>
>> ---
>>  hw/s390x/css.c         | 44 ++++++++++++++++++++++++++++--------------
>>  include/hw/s390x/css.h |  1 +
>>  2 files changed, 30 insertions(+), 15 deletions(-)
>>
>> diff --git a/hw/s390x/css.c b/hw/s390x/css.c
>> index a44faa3549..a72c09adbe 100644
>> --- a/hw/s390x/css.c
>> +++ b/hw/s390x/css.c
>> @@ -2170,30 +2170,23 @@ void css_subch_assign(uint8_t cssid, uint8_t ssid, uint16_t schid,
>>      }
>>  }
>>  
>> -void css_queue_crw(uint8_t rsc, uint8_t erc, int solicited,
>> -                   int chain, uint16_t rsid)
>> +void css_queue_crw_cont(CRW crw)
> 
> Don't really like this name, as it makes me think of 'continuation'
> instead of 'container'.
> 
> css_queue_crw_container?
> css_crw_add_to_queue?
> 
> Naming is hard :(

Yeah, I don't like it either.  Just took it from the variable "crw_cont"
in the original code, but it does seem more like a continuation.  Since
the "container" is something built in that routine, maybe the
"add_to_queue" variant fits better.

> 
>>  {
>>      CrwContainer *crw_cont;
>>  
>> -    trace_css_crw(rsc, erc, rsid, chain ? "(chained)" : "");
>> +    trace_css_crw((crw.flags & CRW_FLAGS_MASK_RSC) >> 8,
>> +                  crw.flags & CRW_FLAGS_MASK_ERC,
>> +                  crw.rsid,
>> +                  (crw.flags & CRW_FLAGS_MASK_C) ? "(chained)" : "");
>> +
>>      /* TODO: Maybe use a static crw pool? */
>>      crw_cont = g_try_new0(CrwContainer, 1);
>>      if (!crw_cont) {
>>          channel_subsys.crws_lost = true;
>>          return;
> 
> Now that we actually pass something in, do we want to inform the caller
> whether the crw was queued or not?

Hrm...  Well I guess we could use it to break out of our loop in patch
7.  But for the existing callers of css_queue_crw(), it doesn't provide
much value to anyone but css_generate_css_crws().  I'll poke at this a bit.

> 
>>      }
>> -    crw_cont->crw.flags = (rsc << 8) | erc;
>> -    if (solicited) {
>> -        crw_cont->crw.flags |= CRW_FLAGS_MASK_S;
>> -    }
>> -    if (chain) {
>> -        crw_cont->crw.flags |= CRW_FLAGS_MASK_C;
>> -    }
>> -    crw_cont->crw.rsid = rsid;
>> -    if (channel_subsys.crws_lost) {
>> -        crw_cont->crw.flags |= CRW_FLAGS_MASK_R;
>> -        channel_subsys.crws_lost = false;
>> -    }
>> +
>> +    crw_cont->crw = crw;
>>  
>>      QTAILQ_INSERT_TAIL(&channel_subsys.pending_crws, crw_cont, sibling);
>>  
> 
> Generally, looks sane to me.
> 


  reply	other threads:[~2020-04-21 13:07 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-17  2:34 [PATCH v3 0/7] s390x/vfio-ccw: Channel Path Handling [QEMU] Eric Farman
2020-04-17  2:34 ` [PATCH v3 1/7] linux-headers: update Eric Farman
2020-04-17  2:34 ` [PATCH v3 2/7] vfio-ccw: Refactor cleanup of regions Eric Farman
2020-04-17  2:34 ` [PATCH v3 3/7] vfio-ccw: Add support for the schib region Eric Farman
2020-04-22 11:36   ` Cornelia Huck
2020-04-22 12:17     ` Eric Farman
2020-04-17  2:34 ` [PATCH v3 4/7] vfio-ccw: Add support for the crw region Eric Farman
2020-04-21 12:21   ` Cornelia Huck
2020-04-21 12:57     ` Eric Farman
2020-04-17  2:34 ` [PATCH v3 5/7] vfio-ccw: Refactor ccw irq handler Eric Farman
2020-04-17  2:34 ` [PATCH v3 6/7] s390x/css: Refactor the css_queue_crw() routine Eric Farman
2020-04-21 12:28   ` Cornelia Huck
2020-04-21 13:04     ` Eric Farman [this message]
2020-04-17  2:34 ` [PATCH v3 7/7] vfio-ccw: Add support for the CRW irq Eric Farman
2020-04-22 10:38   ` Cornelia Huck
2020-04-17  3:25 ` [PATCH v3 0/7] s390x/vfio-ccw: Channel Path Handling [QEMU] no-reply

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=ecd45274-0116-72b4-44f5-818032e14ebf@linux.ibm.com \
    --to=farman@linux.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=jjherne@linux.ibm.com \
    --cc=jrossi@linux.ibm.com \
    --cc=pasic@linux.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    /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).