From mboxrd@z Thu Jan 1 00:00:00 1970 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=-1.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_PASS 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 211E5C43381 for ; Tue, 19 Mar 2019 12:38:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D5A0620828 for ; Tue, 19 Mar 2019 12:38:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="DbCSKeso" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726688AbfCSMig (ORCPT ); Tue, 19 Mar 2019 08:38:36 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:56714 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726002AbfCSMig (ORCPT ); Tue, 19 Mar 2019 08:38:36 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x2JCYZ7G127204; Tue, 19 Mar 2019 12:38:15 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=content-type : mime-version : subject : from : in-reply-to : date : cc : content-transfer-encoding : message-id : references : to; s=corp-2018-07-02; bh=ptbnfk60qsL8msycgXvMi4mVCIfDseIWOKdwjV9ZiH8=; b=DbCSKeso1kizlmBdIgdkg+hU0lCYr2mWYT3lFtTAW+T4rLagzocFg8NKlg4AnrmDos6j siD9NRku5bgWQqXWen7tthn4DG61sFqiXXBXbQqWiz2+rz0fh9Iq1tJ3Eh2CRj9303gk a59LZGrqwTH/r17RjagcX8WNIjN+e3QmLORdGWyDSX8CeV6DNeVjO3EZKIPjjYMS8Vyz rpt4T7SGSBeCWlVgxbar2YDN8HWAa1YTfDmmF99Fhf/GMv3LS1WDRnQLp88333Pcld9z UQn3uMSu1357zAvO1E+uQ/D4hMroe218vgW3I+UoOkYE7EuWhb5vFUeszTlhLwqkJz8M gA== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2120.oracle.com with ESMTP id 2r8ssrc7qu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 19 Mar 2019 12:38:15 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id x2JCcECV021628 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 19 Mar 2019 12:38:14 GMT Received: from abhmp0003.oracle.com (abhmp0003.oracle.com [141.146.116.9]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x2JCcC2L022216; Tue, 19 Mar 2019 12:38:13 GMT Received: from [10.0.5.57] (/213.57.127.10) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 19 Mar 2019 05:38:12 -0700 Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 11.1 \(3445.4.7\)) Subject: Re: [summary] virtio network device failover writeup From: Liran Alon In-Reply-To: <20190317095052-mutt-send-email-mst@kernel.org> Date: Tue, 19 Mar 2019 14:38:06 +0200 Cc: Si-Wei Liu , Sridhar Samudrala , Alexander Duyck , Stephen Hemminger , Jakub Kicinski , Jiri Pirko , David Miller , Netdev , virtualization@lists.linux-foundation.org, boris.ostrovsky@oracle.com, vijay.balakrishna@oracle.com, jfreimann@redhat.com, ogerlitz@mellanox.com, vuhuong@mellanox.com Content-Transfer-Encoding: quoted-printable Message-Id: <54E7C3AF-C3C5-4AF2-86C9-AA50389F855F@oracle.com> References: <20190317095052-mutt-send-email-mst@kernel.org> To: "Michael S. Tsirkin" X-Mailer: Apple Mail (2.3445.4.7) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9199 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1903190093 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Hi Michael, Great blog-post which summarise everything very well! Some comments I have: 1) I think that when we are using the term =E2=80=9C1-netdev model=E2=80=9D= on community discussion, we tend to refer to what you have defined in = blog-post as "3-device model with hidden slaves=E2=80=9D. Therefore, I would suggest to just remove the =E2=80=9C1-netdev model=E2=80= =9D section and rename the "3-device model with hidden slaves=E2=80=9D = section to =E2=80=9C1-netdev model=E2=80=9D. 2) The userspace issues result both from using =E2=80=9C2-netdev = model=E2=80=9D and =E2=80=9C3-netdev model=E2=80=9D. However, they are = described in blog-post as they only exist on =E2=80=9C3-netdev model=E2=80= =9D. The reason these issues are not seen in Azure environment is because = these issues were partially handled by Microsoft for their specific = 2-netdev model. Which leads me to the next comment. 3) I suggest that blog-post will also elaborate on what exactly are the = userspace issues which results in models different than =E2=80=9C1-netdev = model=E2=80=9D. The issues that I=E2=80=99m aware of are (Please tell me if you are = aware of others!): (a) udev rename race-condition: When net-failover device is opened, it = also opens it's slaves. However, the order of events to udev on KOBJ_ADD = is first for the net-failover netdev and only then for the virtio-net = netdev. This means that if userspace will respond to first event by open = the net-failover, then any attempt of userspace to rename virtio-net = netdev as a response to the second event will fail because the = virtio-net netdev is already opened. Also note that this udev rename = rule is useful because we would like to add rules that renames = virtio-net netdev to clearly signal that it=E2=80=99s used as the = standby interface of another net-failover netdev. The way this problem was workaround by Microsoft in NetVSC is to delay = the open done on slave-VF from the open of the NetVSC netdev. However, = this is still a race and thus a hacky solution. It was accepted by = community only because it=E2=80=99s internal to the NetVSC driver. = However, similar solution was rejected by community for the net-failover = driver. The solution that we currently proposed to address this (Patch by = Si-Wei) was to change the rename kernel handling to allow a net-failover = slave to be renamed even if it is already opened. Patch is still not = accepted. (b) Issues caused because of various userspace components DHCP the = net-failover slaves: DHCP of course should only be done on the = net-failover netdev. Attempting to DHCP on net-failover slaves as-well = will cause networking issues. Therefore, userspace components should be = taught to avoid doing DHCP on the net-failover slaves. The various = userspace components include: b.1) dhclient: If run without parameters, it by default just enum all = netdevs and attempt to DHCP them all. (I don=E2=80=99t think Microsoft has handled this) b.2) initramfs / dracut: In order to mount the root file-system from = iSCSI, these components needs networking and therefore DHCP on all = netdevs. (Microsoft haven=E2=80=99t handled (b.2) because they don=E2=80=99t have = images which perform iSCSI boot in their Azure setup. Still an open = issue) b.3) cloud-init: If configured to perform network-configuration, it = attempts to configure all available netdevs. It should avoid however = doing so on net-failover slaves. (Microsoft has handled this by adding a mechanism in cloud-init to = blacklist a netdev from being configured in case it is owned by a = specific PCI driver. Specifically, they blacklist Mellanox VF driver. = However, this technique doesn=E2=80=99t work for the net-failover = mechanism because both the net-failover netdev and the virtio-net netdev = are owned by the virtio-net PCI driver). b.4) Various distros network-manager need to be updated to avoid DHCP on = net-failover slaves? (Not sure. Asking...) 4) Another interesting use-case where the net-failover mechanism is = useful is for handling NIC firmware failures or NIC firmware = Live-Upgrade. In both cases, there is a need to perform a full PCIe reset of the NIC. = Which lose all the NIC eSwitch configuration of the various VFs. To handle these cases gracefully, one could just hot-unplug all VFs from = guests running on host (which will make all guests now use the = virtio-net netdev which is backed by a netdev that eventually is on top = of PF). Therefore, networking will be restored to guests once the PCIe = reset is completed and the PF is functional again. To re-acceelrate the = guests network, hypervisor can just hot-plug new VFs to guests. P.S: I would very appreciate all this forum help in closing on the pending = items written in (3). Which currently prevents using this net-failover = mechanism in real production use-cases. Regards, -Liran > On 17 Mar 2019, at 15:55, Michael S. Tsirkin wrote: >=20 > Hi all, > I've put up a blog post with a summary of where network > device failover stands and some open issues. > Not sure where best to host it, I just put it up on blogspot: > = https://urldefense.proofpoint.com/v2/url?u=3Dhttps-3A__mstsirkin.blogspot.= com_2019_03_virtio-2Dnetwork-2Ddevice-2Dfailover-2Dsupport.html&d=3DDwIBAg= &c=3DRoP1YumCXCgaWHvlZYR8PZh8Bv7qIrMUB65eapI_JnE&r=3DJk6Q8nNzkQ6LJ6g42qARk= g6ryIDGQr-yKXPNGZbpTx0&m=3Djd0emHx6EkPSTvO0TytfYmG4rOMQ9htenhrgKprrh9E&s=3D= 5EJamlc_g1lZa0Ga7K30E6aWVg3jy8lizhw1aSguo3A&e=3D >=20 > Comments, corrections are welcome! >=20 > --=20 > MST