Received: from eggs.gnu.org ([2001:4830:134:3::10]:39093) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bpGBF-0001yA-Dp for qemu-devel@nongnu.org; Wed, 28 Sep 2016 10:49:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bpGBA-0003PS-Ch for qemu-devel@nongnu.org; Wed, 28 Sep 2016 10:49:52 -0400 Received: from mail-sn1nam01on0108.outbound.protection.outlook.com ([104.47.32.108]:44749 helo=NAM01-SN1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bpGB9-0003OI-LQ for qemu-devel@nongnu.org; Wed, 28 Sep 2016 10:49:48 -0400 From: Felipe Franciosi Date: Wed, 28 Sep 2016 14:49:45 +0000 Message-ID: References: <1475066167-17635-1-git-send-email-felipe@nutanix.com> <1475066167-17635-2-git-send-email-felipe@nutanix.com> <20160928124400.GB15510@redhat.com> In-Reply-To: <20160928124400.GB15510@redhat.com> Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-ID: <0FA7F68F7C7A3D498D47BDA488F755FB@namprd02.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH v2 1/3] io: Fix double shift usages on QIOChannel features List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Daniel P. Berrange" Cc: Marc-Andre Lureau , Paolo Bonzini , qemu-devel Hi Daniel, > On 28 Sep 2016, at 13:44, Daniel P. Berrange wrote: >=20 > On Wed, Sep 28, 2016 at 05:36:05AM -0700, Felipe Franciosi wrote: >> When QIOChannels were introduced in 666a3af9, the feature bits were >> already defined shifted. However, when using them, the code was shifting >> them again. The incorrect use was consistent until 74b6ce43, where >> QIO_CHANNEL_FEATURE_LISTEN was defined shifted but tested unshifted. >>=20 >> This patch changes the definition to be unshifted and fixes the >> incorrect usage introduced on 74b6ce43. >>=20 >> Signed-off-by: Felipe Franciosi >> --- >> include/io/channel.h | 6 +++--- >> io/channel-socket.c | 2 +- >> 2 files changed, 4 insertions(+), 4 deletions(-) >>=20 >> diff --git a/include/io/channel.h b/include/io/channel.h >> index 752e89f..5368604 100644 >> --- a/include/io/channel.h >> +++ b/include/io/channel.h >> @@ -40,9 +40,9 @@ typedef struct QIOChannelClass QIOChannelClass; >> typedef enum QIOChannelFeature QIOChannelFeature; >>=20 >> enum QIOChannelFeature { >> - QIO_CHANNEL_FEATURE_FD_PASS =3D (1 << 0), >> - QIO_CHANNEL_FEATURE_SHUTDOWN =3D (1 << 1), >> - QIO_CHANNEL_FEATURE_LISTEN =3D (1 << 2), >> + QIO_CHANNEL_FEATURE_FD_PASS, >> + QIO_CHANNEL_FEATURE_SHUTDOWN, >> + QIO_CHANNEL_FEATURE_LISTEN, >> }; >>=20 >>=20 >> diff --git a/io/channel-socket.c b/io/channel-socket.c >> index 196a4f1..6710b2e 100644 >> --- a/io/channel-socket.c >> +++ b/io/channel-socket.c >> @@ -403,7 +403,7 @@ static void qio_channel_socket_finalize(Object *obj) >> QIOChannelSocket *ioc =3D QIO_CHANNEL_SOCKET(obj); >>=20 >> if (ioc->fd !=3D -1) { >> - if (QIO_CHANNEL(ioc)->features & QIO_CHANNEL_FEATURE_LISTEN) { >> + if (QIO_CHANNEL(ioc)->features & (1 << QIO_CHANNEL_FEATURE_LIST= EN)) { >> Error *err =3D NULL; >>=20 >> socket_listen_cleanup(ioc->fd, &err); >=20 > The change looks good, but this patch is missing additions to the > various tests/test-io-channel-*.c files, to validate that we correctly > report the SHUTDOWN/LISTEN features being set. >=20 > Any test addition should fail on current git master, and succeed with > this fix applied. >From master, if I run "make check", I'm already bumping into errors: ----------------8<---------------- CC tests/io-channel-helpers.o LINK tests/test-io-channel-socket GTESTER tests/test-io-channel-socket CC tests/test-io-channel-file.o LINK tests/test-io-channel-file GTESTER tests/test-io-channel-file CC tests/test-io-channel-tls.o LINK tests/test-io-channel-tls GTESTER tests/test-io-channel-tls test-io-channel-tls: ath.c:193: _gcry_ath_mutex_lock: Assertion `*lock =3D= =3D ((ath_mutex_t) 0)' failed. GTester: last random seed: R02S9b33b323b6d5e03d003037e20885bc0a make: *** [check-tests/test-io-channel-tls] Error 1 ----------------8<----------------=20 I'm very unfamiliar with qemu's test framework. Are you able to look into t= his? I think you know more about the tls io channel work than me. Do you need the tests amended to take this series or can we do that separat= ely? Given that this is currently (quite) broken, I'd prioritise taking the= fix and working on the unit tests afterwards. Thanks, Felipe >=20 > Regards, > Daniel > --=20 > |: http://berrange.com -o- http://www.flickr.com/photos/dberrange= / :| > |: http://libvirt.org -o- http://virt-manager.or= g :| > |: http://entangle-photo.org -o- http://search.cpan.org/~danberr= / :|