From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47224) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dnIgW-0007Vj-0R for qemu-devel@nongnu.org; Thu, 31 Aug 2017 02:10:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dnIgR-0005cY-QY for qemu-devel@nongnu.org; Thu, 31 Aug 2017 02:10:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60618) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dnIgR-0005c2-KK for qemu-devel@nongnu.org; Thu, 31 Aug 2017 02:10:31 -0400 References: <20170830163609.50260-1-pasic@linux.vnet.ibm.com> <20170830163609.50260-4-pasic@linux.vnet.ibm.com> From: Thomas Huth Message-ID: <62fe261c-09d4-e4c2-fb88-b8c05b700e56@redhat.com> Date: Thu, 31 Aug 2017 08:10:26 +0200 MIME-Version: 1.0 In-Reply-To: <20170830163609.50260-4-pasic@linux.vnet.ibm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 3/9] s390x/css: be more consistent if broken beyond repair List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Halil Pasic , Cornelia Huck Cc: Dong Jia Shi , Pierre Morel , qemu-devel@nongnu.org On 30.08.2017 18:36, Halil Pasic wrote: > If we detect that the internally manged state of the subchannel > is broken beyond repair while in do_subchannel_work in case of > virtual we just abort the operation and pretend all went well, > while in case of pass-through we honor the situation with -ENODEV > which results in cc 3 for the instruction whose handler triggered > the call. >=20 > Let's be consistent on this and do the -ENODEV also for virtual > subchannels. >=20 > Signed-off-by: Halil Pasic > Acked-by: Pierre Morel > --- > hw/s390x/css.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/hw/s390x/css.c b/hw/s390x/css.c > index 0822538cde..bc47bf5b20 100644 > --- a/hw/s390x/css.c > +++ b/hw/s390x/css.c > @@ -1078,7 +1078,7 @@ int do_subchannel_work_virtual(SubchDev *sch) > sch_handle_start_func_virtual(sch); > } else { > /* Cannot happen. */ > - return 0; > + return -ENODEV; > } > css_inject_io_interrupt(sch); > return 0; First, I think ENODEV is not really a good choice here since there certainly was a device. So maybe use EINVAL or EBADR or something else instead? Second, while return an error code is certainly better than returning 0, I think most errors will still go unnoticed here, since most callers of do_subchannel_work() seem to ignore the return value ... so I wonder whether we rather want to have another way to recognize this condition. If the comment is right and this really can not happen, I think you should use an g_assert_notreached() here instead. Otherwise the comment should be changed and it's maybe a good idea to use a qemu_log_mask(LOG_GUEST_ERROR, "subchannel in bad state bla bla...") here= . Thomas