From patchwork Mon Jul 23 20:16:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 10540899 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CD70B14BC for ; Mon, 23 Jul 2018 20:28:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BD4262624D for ; Mon, 23 Jul 2018 20:28:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B190526861; Mon, 23 Jul 2018 20:28:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A1B822624D for ; Mon, 23 Jul 2018 20:28:17 +0000 (UTC) Received: from localhost ([::1]:36380 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fhhRI-0001iz-LV for patchwork-qemu-devel@patchwork.kernel.org; Mon, 23 Jul 2018 16:28:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40868) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fhhIU-0001cC-67 for qemu-devel@nongnu.org; Mon, 23 Jul 2018 16:19:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fhhIS-0002jm-Do for qemu-devel@nongnu.org; Mon, 23 Jul 2018 16:19:10 -0400 Received: from mail-oi0-x244.google.com ([2607:f8b0:4003:c06::244]:34583) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fhhIS-0002iY-87; Mon, 23 Jul 2018 16:19:08 -0400 Received: by mail-oi0-x244.google.com with SMTP id 13-v6so3498191ois.1; Mon, 23 Jul 2018 13:19:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zFzq6Ei3lfnSF0Mmyno6jMb8yhtaZ0caRWnInTl9j2A=; b=suXkQ0/j3h4kE86zPFBoQpmHCCz3ruTL4wGSMG57CgVoQS4iBSnnhNgxPijn3qGFek cVz2YXYX0HW8MPSgBogg+Q4Q6PWYKAo3FEr+sqymQ4LDiHik7RaiCbSOtdYQkXYf4pjp ozOCt+52eHGhRqKN/H3U06eU7FxfAYw+a1FbH8ZlgEoNyMivJ6rh/K62asLiF9mKYQJX bQphx4aJGi9wfPgyYrv+11tszfTNX5BITAkOWleDbnmhagFn+vV6hIkJVbuSHTuEkrM4 +7EDhKnCCcqYDsRJ4ghllgtJyqSZgEEC7zEX+CHKDe6XneGVM3Zp+PVjuPypsj1GEUUF i4wA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=zFzq6Ei3lfnSF0Mmyno6jMb8yhtaZ0caRWnInTl9j2A=; b=PcmiTKZrEqcajaL0YHCNEnDs+8WCjQsjaRHO+VqmroKQyCZf+BkuPbAVx3THM+yZ9M UdKtdX1/C6Zz39VWyE73W4oVIuJCSdC0WeO9c1A79bq576pkBku+mzldV5l+eqwN3pig zS3SqnBqiCKpUmU2cyvJwL8s4+3RcP8IUjhWyGBGcZtpXFeM6n/cm376gdTpDXlBSutJ Xv+K+d0Cv7OLbqt+Y27eLU3YNXwpaCACSl/N8pZ3GA975snHtUTcnu5NkebQeJuf3p59 AaY8gyMmJ7QjJqBcf7cHp9owzMIIAA2RjNbpaydDp4FC8osJHtAWavEwGynSkR8e1Nne k+Fw== X-Gm-Message-State: AOUpUlGNoQgQnMoP7Hpb1l1owO5zx+aC+kc/rrxoHl0/58YlarYYAlQY 3RH4wKedHiNnkwd9lSPQDQQfH0zpaR0= X-Google-Smtp-Source: AAOMgpfQ1ETvC3v5WFAuyEbWZ9HbVanpVNlzBVy1y1dggCNnBDhPPyLwpGzR4qPqTiGP8Niis4mbPw== X-Received: by 2002:aca:ea05:: with SMTP id i5-v6mr340436oih.60.1532377147028; Mon, 23 Jul 2018 13:19:07 -0700 (PDT) Received: from localhost (76-251-165-188.lightspeed.austtx.sbcglobal.net. [76.251.165.188]) by smtp.gmail.com with ESMTPSA id r10-v6sm7202995oif.37.2018.07.23.13.19.05 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Jul 2018 13:19:05 -0700 (PDT) From: Michael Roth To: qemu-devel@nongnu.org Date: Mon, 23 Jul 2018 15:16:10 -0500 Message-Id: <20180723201748.25573-2-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180723201748.25573-1-mdroth@linux.vnet.ibm.com> References: <20180723201748.25573-1-mdroth@linux.vnet.ibm.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4003:c06::244 Subject: [Qemu-devel] [PATCH 01/99] tests: fix tpm-crb tpm-tis tests race X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Tokarev , qemu-stable@nongnu.org, Stefan Berger Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Marc-André Lureau No need to close the TPM data socket on the emulator end, qemu will close it after a SHUTDOWN. This avoids a race between close() and read() in the TPM data thread. Reported-by: Peter Maydell Signed-off-by: Marc-André Lureau Signed-off-by: Stefan Berger Reviewed-by: Daniel P. Berrangé Signed-off-by: Michael Tokarev (cherry picked from commit 7647d5c6b5e3b3f36a6e0441c81ae3fe797eb233) Signed-off-by: Michael Roth --- tests/tpm-emu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/tpm-emu.c b/tests/tpm-emu.c index 4dada76834..8c2bd53cad 100644 --- a/tests/tpm-emu.c +++ b/tests/tpm-emu.c @@ -125,7 +125,7 @@ void *tpm_emu_ctrl_thread(void *data) case CMD_SHUTDOWN: { ptm_res res = 0; qio_channel_write(ioc, (char *)&res, sizeof(res), &error_abort); - qio_channel_close(s->tpm_ioc, &error_abort); + /* the tpm data thread is expected to finish now */ g_thread_join(s->emu_tpm_thread); break; }