Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2532580pxb; Tue, 13 Apr 2021 04:22:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw34CIHObuAy4qi1HFuAxnAuQUCbsQmJM4UrxAEUGWW82tiUJb+YKiDZMdcu9oONzHE1bkd X-Received: by 2002:a05:6402:34f:: with SMTP id r15mr33549521edw.195.1618312963560; Tue, 13 Apr 2021 04:22:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1618312963; cv=pass; d=google.com; s=arc-20160816; b=zWQBCPsXlW2MpbXJWHKnZpahaeQ4pEKiea+TNMNeC9EdG+rfRC1PXKwnTEaP4+sAtB 9KJf1f0ziLDh1YLXuTdRyfBUhnUnN0i/lW9aYy2ZJWV9okVJ0PltayCmvy9B0dqMwclF TUSGwb+9vc3WLfP9eb550WbL7DRKkRXSCMQX3CicAWGPd0Rp6kMrISFDAuB6vrjjxDyD gx6QoBKskIRaSZjyEpUMx6fMa9d2mcsvnMvRlUi/ukwC0e03WeQ5MkVWHGb67lEsMyO5 7rFXLLeXQMD2ZFEwPucMtGJizQHGQv0C3rCBOqWFnaI3V4UkXf8/zWCxr2Zjk50W022o qaZg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :msip_labels:content-language:accept-language:in-reply-to:references :message-id:date:thread-index:thread-topic:subject:cc:to:from :dkim-signature; bh=o8cgHDCOmoEeJaXM1EesibwNghJ5ZdKHXVGm004+5f0=; b=c+Onm9Kdj/wx5FHAUNRE2fXWodozW3PWUnpYkq/hljK8eDP+2SgoNYKRWZ/SPaYewg yFkArJPr125nrsC/sDDYrQs+X/LFtpuP3ps2yJeJOgZigxIAM3RHzqwOg58s5TxIHXa1 8Vz6v/2lPipLlRUDwTgOMMOt1c/rm2s+syscwXVVLgU3ndmEj+5hSmbhuiGiWrTIWsXs N/c/U9dwjx1pkZvgFrvsG7KZJt8+tNxE/pYmUVotadMxARCd1sHTW6l89Yjhjl/zV5pM liBYu22KLDN0u7e9XtOER3h9V5hpoc5hLqgyZOasPnoNl5WmvnLzPmM+ea5FFHz2Y+X7 9zGQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector2 header.b=Buy2lSXT; arc=pass (i=1 spf=pass spfdomain=microsoft.com dkim=pass dkdomain=microsoft.com dmarc=pass fromdomain=microsoft.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w24si6539838ejb.394.2021.04.13.04.22.20; Tue, 13 Apr 2021 04:22:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector2 header.b=Buy2lSXT; arc=pass (i=1 spf=pass spfdomain=microsoft.com dkim=pass dkdomain=microsoft.com dmarc=pass fromdomain=microsoft.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239047AbhDLUas (ORCPT + 99 others); Mon, 12 Apr 2021 16:30:48 -0400 Received: from mail-mw2nam10on2124.outbound.protection.outlook.com ([40.107.94.124]:7648 "EHLO NAM10-MW2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S238367AbhDLUar (ORCPT ); Mon, 12 Apr 2021 16:30:47 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bMIgRZXPcYJeQbKEdofVKO96HJETg4wN7/cVdM/E2K7Lu5203VLNygfkeXsokx4+uS+2pNybstXdDYS/btyC2JRUJurEsGq1WMNKrOUJdGNNXRzKsi4+vT80NBlS9jIGL0QyyUJzkfTgxNznHFNCqaWYvwhzb8OWz0uTgjoY+P0eiEnxmoWLID3XyajgpYYa5rMAPXPQssm9ymTxbu+TzY7iIEi2L9ZT7GZJ2FZVOa/JP1nddoe45QjF0sIqbB2Wca+QPb+dtb4uEUg8jNTspXbzgK5MLyyXqwLAP98mfEksA6zkRbS7ntXkScI1kSBxXXz3+zzh7sDSNyJUVsMxlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=o8cgHDCOmoEeJaXM1EesibwNghJ5ZdKHXVGm004+5f0=; b=OEbxBQ6cuFvcFNpNPLuZ8kPL8wivxICJx0G/v/r9y4Phh+sjC0MwDiM9LACYCygS6372EWFZ0UAmL8OlR0ivLoxcYMCIBZoN7MDa9obBPrmO8t37GJ8awmIOeXczTnWR0OcBIlG1cd0oEM6fBz2RSaRjp5PkgbJe77L8QavVN9Lgm6YW3YjpkCOyxr0cejtoHJDcufXXuSk8EJSd7b+EFkqo9+/j0fvWEW10ME2roMncu5jn8whtLZtxxPM/fAL94AEkgoYBqzY2FcvqCd7jnAdpXbAwaTk673LjwCPSpw0+moCE2ZUlz/1wzW2+YzMj4Xqwner/0u6Z6lYYm6tr5w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microsoft.com; dmarc=pass action=none header.from=microsoft.com; dkim=pass header.d=microsoft.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=o8cgHDCOmoEeJaXM1EesibwNghJ5ZdKHXVGm004+5f0=; b=Buy2lSXT9wnTFHqxODjqlGQON1nAA7pF/3bgQ2B02iz5ywAImjW/RtJB+MBxTwP0cKSYOtvOdWnnPuxM5vvIJDUuRTMDvZ2ILPucN9Y0qqjVWwa1D1u3nD5xeHSUsZe7mH5F1NkKS+1Sw7oifn/x9d4f9Rza3mNQ07m5OUaaNXI= Received: from MW2PR2101MB0892.namprd21.prod.outlook.com (2603:10b6:302:10::24) by MWHPR21MB0510.namprd21.prod.outlook.com (2603:10b6:300:df::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.2; Mon, 12 Apr 2021 20:30:27 +0000 Received: from MW2PR2101MB0892.namprd21.prod.outlook.com ([fe80::5548:cbd8:43cd:aa3d]) by MW2PR2101MB0892.namprd21.prod.outlook.com ([fe80::5548:cbd8:43cd:aa3d%6]) with mapi id 15.20.4065.005; Mon, 12 Apr 2021 20:30:27 +0000 From: Dexuan Cui To: Haiyang Zhang , Andrew Lunn CC: "davem@davemloft.net" , "kuba@kernel.org" , KY Srinivasan , Stephen Hemminger , "wei.liu@kernel.org" , Wei Liu , "netdev@vger.kernel.org" , "leon@kernel.org" , "bernd@petrovitsch.priv.at" , "rdunlap@infradead.org" , Shachar Raindel , "linux-kernel@vger.kernel.org" , "linux-hyperv@vger.kernel.org" Subject: RE: [PATCH v4 net-next] net: mana: Add a driver for Microsoft Azure Network Adapter (MANA) Thread-Topic: [PATCH v4 net-next] net: mana: Add a driver for Microsoft Azure Network Adapter (MANA) Thread-Index: AQHXL6mpok+TxRuwHk2RzEnwF60u5qqxS9kg Date: Mon, 12 Apr 2021 20:30:27 +0000 Message-ID: References: <20210412023455.45594-1-decui@microsoft.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ActionId=f9c20ac4-18ce-4841-81fa-9dee29306b51;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ContentBits=0;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Enabled=true;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Method=Standard;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Name=Internal;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2021-04-12T14:31:36Z;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47; authentication-results: microsoft.com; dkim=none (message not signed) header.d=none;microsoft.com; dmarc=none action=none header.from=microsoft.com; x-originating-ip: [2601:600:8b00:6b90:6473:731a:ac25:3e78] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: c3e16268-0cdf-46b1-0009-08d8fdf1cef4 x-ms-traffictypediagnostic: MWHPR21MB0510: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:3826; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: a9ztV/+bukw2roeD/Tiov3PjFGDfKCf4LwrhN8ueQmaYtSI36/ploiTOuvb0cfexSYsv/t8GwMDAmJWXXrjdQ0wnkTFNL5uvbcbu5t4A/GvQb2ItgC8Rq4HbsMeW7g8ZaVnhqJHJgDSmKPTC8gbprsFOoLgcxRhWA7iciALApUZ71lJkgfBOoXNGAQ2ou/4m3cP85nM96TZ91lHk59+7XIHOxZ7D1hjs4EoyLoG79c1oFE+pvT5miH7KkabW66tzGJIfvDaz41QVqn9uYwkvEnU9k/wDyDwkAKb3jXuBvoYGF3gSBtN0m00lMUdGgjDC8OcFnPrFwr4fRe4Rsq2rrXiSvugXFetGLgdf+UIEPwblMwMi0FdUpG6IJp/pT3yO/lB0OMjlyj5ubZiVrkY5Oo4cbEIHxUhbmCf2FdrfzLHBAyhKijmnjlAp4XbQhOdP6NLhaXVK2m/EANCXtMohb0LEZSHv5ChSgEpcGXezXrcpalZoYDvCCG1Sbz0UB0JNOkblOFRqT7O2+aqqaPn6y0sfRRNcAJH2OA0pXachKC5Fudm0oyzotbr9462yTzxkY3uxlFqTHrz6KNudP8g1jdhoK6+TMJYEucbl/qec/Og= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MW2PR2101MB0892.namprd21.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(136003)(366004)(346002)(376002)(39860400002)(396003)(47530400004)(82950400001)(478600001)(10290500003)(186003)(76116006)(52536014)(6506007)(83380400001)(4326008)(55016002)(7696005)(33656002)(86362001)(64756008)(316002)(38100700002)(66476007)(66446008)(110136005)(66556008)(8990500004)(71200400001)(8676002)(54906003)(66946007)(9686003)(5660300002)(8936002)(2906002)(7416002)(82960400001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?6raczCMQ47UrAMZ4iKx+uGrazx0A3OUMEZtBucLhfMP3lEp61g2k47Cz3P0K?= =?us-ascii?Q?H3S84p8SVa/pfJpOQcQeX5Y7ktZFATMMvrlCheiejFxNLpiCqKXWkZBu1GlX?= =?us-ascii?Q?2c7YbRjLE06akPVCjr/KUeOwjyOXExwsjcMFGRAxo5f6Iot2aKr3GzGdtukk?= =?us-ascii?Q?25r9qdTZB5yTlbsie7I8LRMq/FbspF0bxfWdkAOLyp1VOPDqIBg4JyoQ6WgE?= =?us-ascii?Q?VBU2j+MPwOtRT3J4nb1KZ/jQA4wbYtYzoWY0rPvOj5pxC3tiKNbp980iVLlQ?= =?us-ascii?Q?A1wo1VBiFKEDA1CNV+DVSefWDZheyjzQwT43uv+LCZ2eZrDRfj5S56zGl071?= =?us-ascii?Q?mDWUM3pdenC4pqkwKFoBZnI8V4Zi60/iiI2Tg6lpmEXe2GTXwrqHP3S5pJ64?= =?us-ascii?Q?jkmkHqiAgpeoqZX7451mMd5vRu6O3ZK6l1gWtDganIzg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/uw6G8t4z3csDVRjJY9c/7FVT/0a/NmANfXNlvEsXV+5Md/?= =?us-ascii?Q?egUqtm/UHOzSCVEzJ/T1/OuHf+20?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MW2PR2101MB0892.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: c3e16268-0cdf-46b1-0009-08d8fdf1cef4 X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Apr 2021 20:30:27.2818 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: M5hOkf9JgiieK3LZGhk6rDO9atMbuK0FF8dBVYJTUenth00FYoGRFmb03hoL8oipEEbDiqFe5c8jBWUUCz8iNQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR21MB0510 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > From: Haiyang Zhang > Sent: Monday, April 12, 2021 7:40 AM > > From: Andrew Lunn > > Sent: Monday, April 12, 2021 8:32 AM > > > ... > > > + /* At most num_online_cpus() + 1 interrupts are used. */ > > > + msix_index =3D queue->eq.msix_index; > > > + if (WARN_ON(msix_index > num_online_cpus())) > > > + return; > > > > Do you handle hot{un}plug of CPUs? > We don't have hot{un}plug of CPU feature yet. Hyper-V doesn't support vCPU hot plug/unplug for VMs running on it, but potentially the VM is able to offline and online its virtual CPUs, though this is not a typical usage at all in production system (to offline a vCPU, the VM also needs to unbind all the para-virtualized devices' vmbus channels from that vCPU, which is kind of undoable in a VM that has less than about 32 vCPUs, because typically all the vCPUs are bound to one of the vmbus channels of the NetVSC device(s) and StorVSC device(s), and can't be (easily) unbound. So I think the driver does need to handle cpu online/offlining properly, but I think we can do that in some future patch, because IMO that would need more careful consideration. IMO here the WARN_ON() is good as it at least lets us know something unexpected (if any) happens. > > > +static void mana_hwc_init_event_handler(void *ctx, struct gdma_queue > > *q_self, > > > + struct gdma_event *event) > > > +{ > > > + struct hw_channel_context *hwc =3D ctx; > > > + struct gdma_dev *gd =3D hwc->gdma_dev; > > > + union hwc_init_type_data type_data; > > > + union hwc_init_eq_id_db eq_db; > > > + u32 type, val; > > > + > > > + switch (event->type) { > > > + case GDMA_EQE_HWC_INIT_EQ_ID_DB: > > > + eq_db.as_uint32 =3D event->details[0]; > > > + hwc->cq->gdma_eq->id =3D eq_db.eq_id; > > > + gd->doorbell =3D eq_db.doorbell; > > > + break; > > > + > > > + case GDMA_EQE_HWC_INIT_DATA: > > > + > > > + type_data.as_uint32 =3D event->details[0]; > > > + > > > + case GDMA_EQE_HWC_INIT_DONE: > > > + complete(&hwc->hwc_init_eqe_comp); > > > + break; > > > > ... > > > > > + default: > > > + WARN_ON(1); > > > + break; > > > + } > > > > Are these events from the firmware? If you have newer firmware with an > > older driver, are you going to spam the kernel log with WARN_ON dumps? > For protocol version mismatch, the host and guest will either negotiate t= he > highest common version, or fail to probe. So this kind of warnings are no= t > expected. I agree, but I think we'd better remove the WARN_ON(1), which was mainly for debugging purposem, and was added just in case. Thanks, Dexuan