From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35382) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gJeGD-0006oI-Ky for qemu-devel@nongnu.org; Mon, 05 Nov 2018 07:45:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gJeG9-0000st-Kr for qemu-devel@nongnu.org; Mon, 05 Nov 2018 07:45:39 -0500 Received: from mail-lj1-x232.google.com ([2a00:1450:4864:20::232]:39032) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gJeG5-0000AO-Ly for qemu-devel@nongnu.org; Mon, 05 Nov 2018 07:45:34 -0500 Received: by mail-lj1-x232.google.com with SMTP id t9-v6so4687029ljh.6 for ; Mon, 05 Nov 2018 04:45:18 -0800 (PST) From: Artem Pisarenko Date: Mon, 5 Nov 2018 18:45:08 +0600 Message-Id: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PATCH v2 0/2] chardev: fix mess in OPENED/CLOSED events when muxed List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Artem Pisarenko This issue actually more complex. Idea of generating events from inside function called '*_set_handlers' isn't good, at least its implicit nature, and especially a fact, that function decides about open state (see 'fe_open' variable), but generates event only in one direction. Combined with 'mux_chr_set_handlers()' hack this makes things even worse. Better solution is to change fe interface and rewrite all frontends code (a lot of stuff in hw/char/* and somewhere else). Although first patch doesn't fix any bug (known to me), its main effect is optimization of emulation performance by avoiding extra activity. Added testing demonstrates issue and prevents potential bugs in future. v2 changes: - fix failed unit test - 'mux_chr_set_handlers()' hack rewritten (as supposed by Marc-André Lureau) - added testing of issue to unit test (new patch) Artem Pisarenko (2): chardev: fix mess in OPENED/CLOSED events when muxed tests/test-char: add muxed chardev testing for open/close chardev/char-fe.c | 33 +++++++++++++------ chardev/char-mux.c | 16 +++++----- include/chardev/char-fe.h | 18 ++++++++++- tests/test-char.c | 80 +++++++++++++++++++++++++++++++++++++++++++++-- 4 files changed, 127 insertions(+), 20 deletions(-) -- 2.7.4