Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B20EC433F5 for ; Sun, 12 Sep 2021 18:09:43 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F1DA761051 for ; Sun, 12 Sep 2021 18:09:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org F1DA761051 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=t-online.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:34930 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mPTvC-0001rA-7Q for qemu-devel@archiver.kernel.org; Sun, 12 Sep 2021 14:09:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54474) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mPTk9-0007k6-DE for qemu-devel@nongnu.org; Sun, 12 Sep 2021 13:58:17 -0400 Received: from mailout06.t-online.de ([194.25.134.19]:39356) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mPTk7-0007Jy-Ii for qemu-devel@nongnu.org; Sun, 12 Sep 2021 13:58:17 -0400 Received: from fwd75.dcpf.telekom.de (fwd75.aul.t-online.de [10.223.144.101]) by mailout06.t-online.de (Postfix) with SMTP id 8BF65B772; Sun, 12 Sep 2021 19:58:11 +0200 (CEST) Received: from [192.168.211.200] ([79.208.16.31]) by fwd75.t-online.de with (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384 encrypted) esmtp id 1mPTk0-2bpHU10; Sun, 12 Sep 2021 19:58:08 +0200 Subject: Re: [PATCH 1/3] ui/console: replace QEMUFIFO with Fifo8 To: =?UTF-8?Q?Marc-Andr=c3=a9_Lureau?= References: <23041f12-b405-7dbc-b098-e9c48802e29c@t-online.de> <20210912125203.7114-1-vr_qemu@t-online.de> From: =?UTF-8?Q?Volker_R=c3=bcmelin?= Message-ID: Date: Sun, 12 Sep 2021 19:58:08 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-TOI-EXPURGATEID: 150726::1631469488-00016A87-4F54A28C/0/0 CLEAN NORMAL X-TOI-MSGID: e407ff3d-b8ef-48f7-8455-d951dae6e27e Received-SPF: none client-ip=194.25.134.19; envelope-from=vr_qemu@t-online.de; helo=mailout06.t-online.de X-Spam_score_int: -54 X-Spam_score: -5.5 X-Spam_bar: ----- X-Spam_report: (-5.5 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FROM=0.001, NICE_REPLY_A=-3.584, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gerd Hoffmann , QEMU Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" > > @@ -1185,6 +1138,7 @@ void kbd_put_keysym_console(QemuConsole *s, > int keysym) >      uint8_t buf[16], *q; >      CharBackend *be; >      int c; > +    uint32_t free; > > > Better call it num_free, to avoid symbol clash (even if we don't use > free() directly), it helps reading and can prevent mistakes. > Hi, OK, I'll send a version 2 patch. > >      if (!s || (s->console_type == GRAPHIC_CONSOLE)) >          return; > > @@ -2233,8 +2188,7 @@ static void text_console_do_init(Chardev > *chr, DisplayState *ds) >      int g_width = 80 * FONT_WIDTH; >      int g_height = 24 * FONT_HEIGHT; > > -    s->out_fifo.buf = s->out_fifo_buf; > -    s->out_fifo.buf_size = sizeof(s->out_fifo_buf); > +    fifo8_create(&s->out_fifo, 16); > > > Missing a fif8_destroy() somewhere > An opened text console stays open until QEMU exits. There's no text_console_close() function. Just like there's a ChardevClass open call but no close call. I think this is one of the many cases in QEMU where resources get allocated for the lifetime of QEMU. With best regards, Volker >      s->kbd_timer = timer_new_ms(QEMU_CLOCK_REALTIME, > kbd_send_chars, s); >      s->ds = ds; >