Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp6173854rwb; Tue, 22 Nov 2022 09:38:56 -0800 (PST) X-Google-Smtp-Source: AA0mqf5F1lQkfSI/97xttSVR1uxtOxEi5AJR03a+thW7/IfRGVUE5X5qUzvOQ3qYyFPFUYmHhU5M X-Received: by 2002:a17:90b:2711:b0:213:9b80:ceee with SMTP id px17-20020a17090b271100b002139b80ceeemr32753326pjb.243.1669138735996; Tue, 22 Nov 2022 09:38:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669138735; cv=none; d=google.com; s=arc-20160816; b=i7rilScovbHB8ILp2DxR03Sn4ooJPvXXHM6UJUYoX4Ltdstzsk7OHddoL75pCzOVSm LbX9DtiO3ZAw69YTBq3za3VFaBKlZkY8N3rQhM0JAqdMH7QIDqsJX+RJeBnml7uD/c7r oN3Woi2KnlLv1H8I6riTBARnYkkO8cHauZC+2NS1oO8MlEH2dJyDdJmsk81L1eOAwr90 bxaaYllnwjbkvlDaYe4lPfl/F0RS0q1Gl8bZsMJ62cMZydDVs2Hdqg6M8zNQgAXN8l5y M/tjdBewCEgoXfydTW3d1zaC0G3mls9atmJIUelT+TbyKc+ZqNOqBf/+UpZeSGTVaLgN 7Kiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id:dkim-signature; bh=6OthWer9O3aM/7vfA9iZRVn/4cj/z/1mGdO9oyoM7xk=; b=vbRtXtfaB/lkjQ8XTOUqW35r9O/74WB7vzsjs7s9IEEzK6x/yZXPNCsOAhyDQ9yrV4 rcSvvM/i8c/stUh7sBfXiooUnOVQj9ylV8D9krl0C4b0M9JKEVPltz/NTRub01bzr7OZ wIqetXagF2UuduA368Ettp/RYGU+AbNdMLNtH7F3t4yTVaABHBR59pPNqd4y9rAN4Wfq Rg4F7JJkaVi4RVbUsjUEs4/RHe8oi/VNNp8K58qBTBPIyCKL2PS7K4lARizPRFBwouFG u7KSAHYq/zmOPwv34XIDdmZD8gB3Aa7DIBYGb4StHQ/yNasmmJ7UqSMnKaR7cy0NL/GQ OD3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=lGNG+NpU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j71-20020a63804a000000b00430b25c0134si2751182pgd.670.2022.11.22.09.38.40; Tue, 22 Nov 2022 09:38:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=lGNG+NpU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234438AbiKVRD0 (ORCPT + 90 others); Tue, 22 Nov 2022 12:03:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234288AbiKVRDY (ORCPT ); Tue, 22 Nov 2022 12:03:24 -0500 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F16B4C25F for ; Tue, 22 Nov 2022 09:03:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=MIME-Version:Content-Transfer-Encoding :Content-Type:References:In-Reply-To:Date:Cc:To:From:Subject:Message-ID: Sender:Reply-To:Content-ID:Content-Description; bh=6OthWer9O3aM/7vfA9iZRVn/4cj/z/1mGdO9oyoM7xk=; b=lGNG+NpUCWZ0YKzSVCDfkpJka5 iXQMJ/hXxvOeh84RrUGrLBSDfCblA21i8IWVAYnTKN/+uHtaN77LJZHAQ2YnGIRXx23lR4VAEqtFW fNYMAvt4kvy8CN2ktj83WwKqeIgHXYAAy6TnSghbN/0gw9vXjPrPciNgcCkUMkVqat7263IFEMoZ9 wp2sfYK8G455k9gv1vZgFwngJvYz/TV1zCCUKGb8c5Hda7eqVaLzbo/a3HXVyIF94emcGa4uPObul sIG2gNVo2FsnpKymuD/AgXCE28FFNWlcj3qlkuP8ksfjzSCQToxwmhH+8cjf6Nhmrjy3Bxtvmd3Sy jAXCyGaw==; Received: from [54.239.6.185] (helo=[192.168.10.109]) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1oxWfq-003W9O-Fg; Tue, 22 Nov 2022 17:03:06 +0000 Message-ID: <6293fd7d415950979c55c3f09254a6f52eba708b.camel@infradead.org> Subject: Re: [PATCH v2] virtio_console: Introduce an ID allocator for virtual console numbers From: Amit Shah To: =?ISO-8859-1?Q?C=E9dric?= Le Goater , Amit Shah Cc: Arnd Bergmann , Greg Kroah-Hartman , virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org Date: Tue, 22 Nov 2022 18:03:05 +0100 In-Reply-To: <20221114173811.1977367-1-clg@kaod.org> References: <20221114173811.1977367-1-clg@kaod.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.4-0ubuntu1 MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2022-11-14 at 18:38 +0100, C=C3=A9dric Le Goater wrote: > When a virtio console port is initialized, it is registered as an hvc > console using a virtual console number. If a KVM guest is started with > multiple virtio console devices, the same vtermno (or virtual console > number) can be used to allocate different hvc consoles, which leads to > various communication problems later on. >=20 > This is also reported in debugfs : >=20 > # grep vtermno /sys/kernel/debug/virtio-ports/* > /sys/kernel/debug/virtio-ports/vport1p1:console_vtermno: 1 > /sys/kernel/debug/virtio-ports/vport2p1:console_vtermno: 1 > /sys/kernel/debug/virtio-ports/vport3p1:console_vtermno: 2 > /sys/kernel/debug/virtio-ports/vport4p1:console_vtermno: 3 >=20 > Replace the next_vtermno global with an ID allocator and start the > allocation at 1 as it is today. Also recycle IDs when a console port > is removed. When the original virtio_console module was written, it didn't have support for multiple ports to be used this way. So the oddity you're seeing is left there deliberately: VMMs should not be instantiating console ports this way. I don't know if we should take in this change, but can you walk through all combinations of new/old guest and new/old hypervisor and ensure nothing's going to break -- and confirm with the spec this is still OK to do? It may not be a goal to still ensure launches of a new guest on a very old (say) Centos5 guest still works -- but that was the point of maintaining backward compat... Amit