diff mbox

[3/4] s390x/css: remove dubious error handling branch

Message ID 20170908152446.14606-4-pasic@linux.vnet.ibm.com (mailing list archive)
State New, archived
Headers show

Commit Message

Halil Pasic Sept. 8, 2017, 3:24 p.m. UTC
The case in question actually never happens. Let us get rid of the dead
code.

Signed-off-by: Halil Pasic <pasic@linux.vnet.ibm.com>
---
 hw/s390x/css.c | 7 -------
 1 file changed, 7 deletions(-)

Comments

Cornelia Huck Sept. 11, 2017, 9:48 a.m. UTC | #1
On Fri,  8 Sep 2017 17:24:45 +0200
Halil Pasic <pasic@linux.vnet.ibm.com> wrote:

s/dubious/unused/

> The case in question actually never happens. Let us get rid of the dead
> code.

I had tried to be complete in my initial implementation. With the
current implementation, it can never happen, yes. We can easily
resurrect it from git history should we need it in the future.

> 
> Signed-off-by: Halil Pasic <pasic@linux.vnet.ibm.com>
> ---
>  hw/s390x/css.c | 7 -------
>  1 file changed, 7 deletions(-)
> 
> diff --git a/hw/s390x/css.c b/hw/s390x/css.c
> index a44d87ab3e..a9cdd54efc 100644
> --- a/hw/s390x/css.c
> +++ b/hw/s390x/css.c
> @@ -980,13 +980,6 @@ static void sch_handle_start_func_virtual(SubchDev *sch)
>                      SCSW_STCTL_ALERT | SCSW_STCTL_STATUS_PEND;
>              s->cpa = sch->channel_prog + 8;
>              break;
> -        case -EBUSY:
> -            /* subchannel busy, generate deferred cc 1 */
> -            s->flags &= ~SCSW_FLAGS_MASK_CC;
> -            s->flags |= (1 << 8);
> -            s->ctrl &= ~SCSW_CTRL_MASK_STCTL;
> -            s->ctrl |= SCSW_STCTL_ALERT | SCSW_STCTL_STATUS_PEND;
> -            break;
>          case -EINPROGRESS:
>              /* channel program has been suspended */
>              s->ctrl &= ~SCSW_ACTL_START_PEND;

Thanks, queued.
Halil Pasic Sept. 11, 2017, 1:08 p.m. UTC | #2
On 09/11/2017 11:48 AM, Cornelia Huck wrote:
> On Fri,  8 Sep 2017 17:24:45 +0200
> Halil Pasic <pasic@linux.vnet.ibm.com> wrote:
> 
> s/dubious/unused/
> 

Nod.

>> The case in question actually never happens. Let us get rid of the dead
>> code.
> 
> I had tried to be complete in my initial implementation. With the
> current implementation, it can never happen, yes. We can easily
> resurrect it from git history should we need it in the future.
> 

I've tried to understand the branch but I failed. Weather the subchannel
is busy or not should be already decided, and if the device is busy
that is probably supposed to be indicated via device status (word 2 bit 3).

So I wrote dubious because I could not figure it out. But unused
is certainly nicer.

I think shall the need emerge the preferred way of handling would
be to use the custom handling (-EIO) branch.


>>
>> Signed-off-by: Halil Pasic <pasic@linux.vnet.ibm.com>
>> ---
>>  hw/s390x/css.c | 7 -------
>>  1 file changed, 7 deletions(-)
>>
>> diff --git a/hw/s390x/css.c b/hw/s390x/css.c
>> index a44d87ab3e..a9cdd54efc 100644
>> --- a/hw/s390x/css.c
>> +++ b/hw/s390x/css.c
>> @@ -980,13 +980,6 @@ static void sch_handle_start_func_virtual(SubchDev *sch)
>>                      SCSW_STCTL_ALERT | SCSW_STCTL_STATUS_PEND;
>>              s->cpa = sch->channel_prog + 8;
>>              break;
>> -        case -EBUSY:
>> -            /* subchannel busy, generate deferred cc 1 */
>> -            s->flags &= ~SCSW_FLAGS_MASK_CC;
>> -            s->flags |= (1 << 8);
>> -            s->ctrl &= ~SCSW_CTRL_MASK_STCTL;
>> -            s->ctrl |= SCSW_STCTL_ALERT | SCSW_STCTL_STATUS_PEND;
>> -            break;
>>          case -EINPROGRESS:
>>              /* channel program has been suspended */
>>              s->ctrl &= ~SCSW_ACTL_START_PEND;
> 
> Thanks, queued.
> 

Thanks!
Cornelia Huck Sept. 12, 2017, 2:05 p.m. UTC | #3
On Mon, 11 Sep 2017 15:08:52 +0200
Halil Pasic <pasic@linux.vnet.ibm.com> wrote:

> On 09/11/2017 11:48 AM, Cornelia Huck wrote:
> > On Fri,  8 Sep 2017 17:24:45 +0200
> > Halil Pasic <pasic@linux.vnet.ibm.com> wrote:

> >> The case in question actually never happens. Let us get rid of the dead
> >> code.  
> > 
> > I had tried to be complete in my initial implementation. With the
> > current implementation, it can never happen, yes. We can easily
> > resurrect it from git history should we need it in the future.
> >   
> 
> I've tried to understand the branch but I failed. Weather the subchannel
> is busy or not should be already decided, and if the device is busy
> that is probably supposed to be indicated via device status (word 2 bit 3).
> 
> So I wrote dubious because I could not figure it out. But unused
> is certainly nicer.
> 
> I think shall the need emerge the preferred way of handling would
> be to use the custom handling (-EIO) branch.

What this is trying to do is deferred cc 1 handling. On a real system,
a ssch may return with cc 0 to indicate that the channel program has
been accepted; but when the channel subsystem actually tries to execute
it, a status is already pending. Basically, it's a race condition:
Therefore the 'deferred' cc 1.

Maybe I should have called this 'deferred subchannel busy'... but
anyway, this cannot happen in our current implementation.
diff mbox

Patch

diff --git a/hw/s390x/css.c b/hw/s390x/css.c
index a44d87ab3e..a9cdd54efc 100644
--- a/hw/s390x/css.c
+++ b/hw/s390x/css.c
@@ -980,13 +980,6 @@  static void sch_handle_start_func_virtual(SubchDev *sch)
                     SCSW_STCTL_ALERT | SCSW_STCTL_STATUS_PEND;
             s->cpa = sch->channel_prog + 8;
             break;
-        case -EBUSY:
-            /* subchannel busy, generate deferred cc 1 */
-            s->flags &= ~SCSW_FLAGS_MASK_CC;
-            s->flags |= (1 << 8);
-            s->ctrl &= ~SCSW_CTRL_MASK_STCTL;
-            s->ctrl |= SCSW_STCTL_ALERT | SCSW_STCTL_STATUS_PEND;
-            break;
         case -EINPROGRESS:
             /* channel program has been suspended */
             s->ctrl &= ~SCSW_ACTL_START_PEND;