From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 54B9EA0C46; Tue, 31 Aug 2021 08:02:02 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A5FE740687; Tue, 31 Aug 2021 08:02:01 +0200 (CEST) Received: from outbound.mail.eo.outlook.com (mail-oln040093008009.outbound.protection.outlook.com [40.93.8.9]) by mails.dpdk.org (Postfix) with ESMTP id 5053940141; Tue, 31 Aug 2021 08:02:00 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Yxel4Wjhw5oDFY4joGICZJSpn5AgxoUkaSLFgZHrQ6hY94l5IR9YDQMDf+XQXxUhm9Sj0YgxLR1KAukB2omiMtiMATj6HQSuE2dVvF5yGFyOmKCMuduOMAnTz1F+Cn7hnZI+u3MoY0Bu+vbrKCtkLRMwHE1nv749JLxalVe5p+d8okq4titU9IYtFBjttfAU7sE+UhtXNaDyNQorE0rT+HdpdwWoJ5h2VqDwmXiQxXg/Ru9UZan/sY8vjOCnJ4EfEjeGeqkeR7UqgYPT7c6yVhwbzyGvc+hOAWDeMRgOWW4AOZnfBzFWRWLPnqQs1tKnmgvdtqxvyl849OYv/OoIzg== 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; bh=mzKeMqXd+URvwCyINThCQ68zD+g6z27DrJgjw6QaWYA=; b=JqOWuHzVZ7xO3DJ+xuePfVpBb4UmJzSQWasYQs/YqJ5eTBC8KhD0M+O1iO/YWfSuW/jjF3/YuOmOKCdwxFnVnwy9fau02IwuZ0QPd/AsLyJBS+Qpl5zFm0bUSOj7MW8/wqI0yq5OqdmbzDf/zOIFv0NnT3u+UxMeVzKuH5+xWEw891hy+cfPInVAUnoZWiLrveBpNjp3m/Whzb2/8/hJ0VZxnsaeNhVnxlPOrvmtFonSMjh0UelXYZLQi+eCGl+fGPTnDwwKr94jzLkqXAZPSZbRK2bxdipJR86v7qex82CyUPwK+rkIOL6mKkwcuQokj/NIWxS+aSt6Zhh0P4EfCA== 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=mzKeMqXd+URvwCyINThCQ68zD+g6z27DrJgjw6QaWYA=; b=drzlFmxRzMesPe/OE31dRISHUrJMwHWJo8y9oR89WrgQDhxMFWtwsz01nP+BUUok1Qlxq/zzl4Jk0qWSNlFvIxuDheEjtVbJ6XZPmWvGK0ftOS2VOuye19CMYsRudoCxyN1LntUo57HWbTOcSCvQE8+xc4h/7zYu6wb0fJxRfVw= Received: from BY5PR21MB1506.namprd21.prod.outlook.com (2603:10b6:a03:23d::12) by BYAPR21MB1333.namprd21.prod.outlook.com (2603:10b6:a03:115::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.1; Tue, 31 Aug 2021 06:01:58 +0000 Received: from BY5PR21MB1506.namprd21.prod.outlook.com ([fe80::d563:3f1d:58eb:e06]) by BY5PR21MB1506.namprd21.prod.outlook.com ([fe80::d563:3f1d:58eb:e06%5]) with mapi id 15.20.4500.004; Tue, 31 Aug 2021 06:01:58 +0000 From: Long Li To: Long Li , Jonathan Erb , Stephen Hemminger CC: "dev@dpdk.org" , "stable@dpdk.org" Thread-Topic: [PATCH v2] bus/vmbus: Fix crash when handling packets in secondary process Thread-Index: AQHXgj/5re0yRIwOMkiz0jbUl3USsKtVyxeggBWhpoCAAxkKgIAAaLiwgAMs+4CABiNZAIAVF6zA Date: Tue, 31 Aug 2021 06:01:58 +0000 Message-ID: References: <20210726170040.25155-1-jonathan.erb@banduracyber.com> <4387890b-e4da-9a93-a142-dfd976b291b0@banduracyber.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=f5277805-92a5-459c-bf3e-16259fb4b066; 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-08-17T19:54:17Z; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47; authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=microsoft.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 5f19f43f-3b81-4e90-22da-08d96c44d7b4 x-ms-traffictypediagnostic: BYAPR21MB1333: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:3383; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: olFfk32MJfAx1/kYFORqB7UVoUpIKijlAp9Ur37z6JrR7y7Qgc/zaK6odASfkNjR2I1hpYGsOfvY0N7OA0xBLWkok1mL6j5GNOvKE5IsOyGBsrcswkUkRJnhsKEqnC7Nm2yXtdukYkmrmlOHkUwpGk4jqYU5i0jmLEyREEK/YMx+VjKrpOmhYdTB2LwmyLM+OQZSoKkWeH9hyGNqWTiOVd2pAXTT3L+gI5N72RCNMxHQhx2TdZxKZoeQnFk/D2OYKBFcCT8Rgy3w31z+wtQSsmgPdxUVASAOIiHc/nCYFRIuD27K3YNat02GYs4BPX4WZg8aRQOQLKe61Q+UVim6V5x2wvCyE/ktsELLrrOdngmAS1oZU9X376YaVD+Ai4pBZ7huAbsTUDFrCqkQT8isTJ0ykrQtNJaYM//Z7sI4junrwiovnwhjNoEqjOCEX20yddKM2y27prfNbn7kYNEzaChHYeQt5WApYc8dU3zA9LiNz5qgVtU5FwIQq6oRX3aV8VnPenNjo6HjKKNvw5Wnz4jCJXtPghs/Elnj4+KiScmAAB6SBouGVgo8tmwmXBk1JGgaNIsEtep4+P3RiBDLKZBgUBBfR2fBwqImvMFeSF89vtHbvYvv3WOHgqMPPTO3nqmJV6QgkVoTeUFo/CGqIn/Gr4arpAfNwTaNS6GKgkbXu7QvknWgKwc3nwqJYI5NkCu/Sly8U3foGo7oPJWEO3ZqiA8Fva3myAtgbuCQu4mvNnyOfGz5wLyBVPDtAQ6pC5XsuiqIwovd3GXbCtB9+xJ/Q4JxsrtMYUYf+jnzsVe4k8l0Rj1K8CIauRwVS9rcUM84zoRsT9EtlV0qbWJ3oA== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BY5PR21MB1506.namprd21.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(82960400001)(8990500004)(7696005)(82950400001)(71200400001)(86362001)(38100700002)(38070700005)(33656002)(2906002)(8936002)(122000001)(5660300002)(966005)(54906003)(66446008)(4326008)(110136005)(9686003)(508600001)(8676002)(64756008)(66556008)(66476007)(6636002)(26005)(52536014)(316002)(83380400001)(10290500003)(186003)(55016002)(66946007)(6506007)(76116006)(53546011)(10090945008); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?sb73vfdTh+hjebhhGLYp6G/JTDwPZE8z268HuQANYR8kxzoinBWkR2P60XL6?= =?us-ascii?Q?rCyhYFd3GaEeft3vLb/UM57z3CaLcoWxrbKEIhY5YT8wi+ZB1XbDVRsMQfTg?= =?us-ascii?Q?1qsyXf6MIpxH7oMW3R9GZkjFi3DVqlNFB4lKsnrPn+T0A6TGhGnh44O+myLX?= =?us-ascii?Q?1D1HGEKbSn3g35j9BpT/bqinxya5XPbWgND9+45N6aw3Zs4IVy6SzBglNOaG?= =?us-ascii?Q?5e2obJM85v+HpXPuxT/cXO3g8xg5k7YxvpbwnIV8/YLZ1KtgwYJlM4UXQ5iR?= =?us-ascii?Q?G7jDMQjVnYi2jRowoh+kY0Gin/bwxY32n44KStOrZSvD8xuBLIQlR3srq2dh?= =?us-ascii?Q?WdpxX3P2BJR6sxds07UK3l5kQtGE8GbZZnyBs4jEWumjjoVN1aR0P9WNk9+k?= =?us-ascii?Q?Wl/iHk48fZx4/ZwJRsZz4gxc9CEANG4uAuSNXnNa2WDQBA4NHIvUFSpf6r5/?= =?us-ascii?Q?yGSOtuxI9x1MKbcIY+OwAuSOO/3BicQgUajnPBCYhwUh+5Hda1IpZT4Q58Y6?= =?us-ascii?Q?8JURaYDrOD+kJinTfBDSDkkEFSEprZJBnLPfeWQX/kvjb9o0lFJq/rJDTNg7?= =?us-ascii?Q?Lq/JQvS2rKMGz+Rn+9oXeEGrqW8snJlPXg8UhYw60GeCRGZwdk85tY1dmg5K?= =?us-ascii?Q?jP4PG7qBhBfsAHUhRg05smQ4tgdZG8L8C7B8FL4yDXjZ1R+ueZA/B1qSfIOd?= =?us-ascii?Q?UTTIGWDaceajrEndiHdIvxbmxu1z3lyq/3rdwoLkvVSOltKA7xingoNInHrP?= =?us-ascii?Q?KsFojckgMtINqvI9e7N5VELxJWHAzWgfeVJpaAkiDw6iGumPuHp/niWnMh6T?= =?us-ascii?Q?E12kWzD897/RxXn/ffNsrjz1AM9eYDCQiQNaMyQQV0y8STn5+0/DpdRzLCQ6?= =?us-ascii?Q?0IXF/rsxsAzlpFW6Vuo6Gs6l231zROkJKx+aTpBmxAOpMIbXTfeokeH/YA0K?= =?us-ascii?Q?qjR6noV4bO5FNVFjHnOoOC2z3PfrDaEbt2+vLtDs+xJzgVQgHaRDIS6XNbni?= =?us-ascii?Q?UFejJ0ru3VN4KVdvWzlXq4r/Az4GKrC9u6rp9v1kW+lUym09vSNAJH4u+NMM?= =?us-ascii?Q?X54M5zeekf1k9gNM5gT+voGlHtL+5fGyZNWo22AE+dtRfil8/mn5XfRHW5yz?= =?us-ascii?Q?O6/srlAPJ65YvOL3XhgEckwRsXH9s995eH6foqucs9dlIi3wAxpcBDHUgtNS?= =?us-ascii?Q?WUQ1gsQ1f8HtvRn3eie71OuDVQ8J8RVptviVgEF5gC39KHPrcJOBm5cF6c61?= =?us-ascii?Q?kb6y7RfoSxVUDbfCzHltokNqbI4Uo/dLe+RKBry3p7huDeJw6yjti5xyp5SD?= =?us-ascii?Q?1X0=3D?= 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: BY5PR21MB1506.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5f19f43f-3b81-4e90-22da-08d96c44d7b4 X-MS-Exchange-CrossTenant-originalarrivaltime: 31 Aug 2021 06:01:58.0933 (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: 0nzXM4BzzqIdGZrRbx3EGVBu9pKCX158w2sp+Q0JNLqm7CajWOwX+omqXcd7iYmUwDwtSI5yZ2luZE9HLHh4Uw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR21MB1333 Subject: Re: [dpdk-dev] [PATCH v2] bus/vmbus: Fix crash when handling packets in secondary process X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" I posted a patch to the mailing list. http://patchwork.dpdk.org/project/dpdk/patch/1630389404-13468-1-git-send-em= ail-longli@linuxonhyperv.com/ Jonathan, please let me know if this has fixed the crash you are seeing. Long > Subject: Re: [dpdk-dev] [PATCH v2] bus/vmbus: Fix crash when handling pac= kets > in secondary process >=20 > In the 2nd part, the mapped addresses for the sub-channels in the second > process should be the same as those mapped addresses in the primary proce= ss. >=20 > You are correct on seting br->vbr to mapaddr. (To the same addresses used= by > the primary process) This can be done by recording the mapped addresses f= or all > the sub-channels in the primary process to vmbus_tailq. Later when the > secondary process re-creates those channels, it can call > vmbus_uio_find_resource() to find out the addresses for the same sub-chan= nels > mapped by the primary process. >=20 >=20 > From: Jonathan Erb > Sent: Friday, August 13, 2021 3:10 PM > To: Long Li ; Stephen Hemminger > > Cc: dev@dpdk.org; stable@dpdk.org > Subject: Re: [PATCH v2] bus/vmbus: Fix crash when handling packets in > secondary process >=20 >=20 > The first part makes sense. There are several ways to iterate over all th= e > subchannels. >=20 > I'm probably not fully understanding the second part. > vmbus_uio_map_secondary_subchan() wants to map to br->vbr but that does > not appear to be initialized anywhere. In fact, it looks like we should s= et br->vbr > to mapaddr which is what vmbus_uio_map_subchan() does. >=20 > Jonathan > On 8/11/21 6:06 PM, Long Li wrote: > I think the code is on the right track. >=20 > Instead of using vmbus_uio_get_num_subchan() and calling > vmbus_uio_get_subchan() on each channel, you can just create a new functi= on > vmbus_uio_get_secondary_subchan(). This function goes through all > subchannels and map ring buffers to the same addresses used by the primar= y > process. >=20 > In the original code, vmbus_uio_map_secondary_subchan() has a check for "= if > (mapaddr =3D=3D ring_buf)". If the address is mapped to somewhere else, t= he > address won't work for the secondary process. So we need to keep this che= ck. >=20 > From: Stephen Hemminger > > Sent: Wednesday, August 11, 2021 8:26 AM > To: Jonathan Erb > ; > Long Li > Cc: dev@dpdk.org; > stable@dpdk.org > Subject: RE: [PATCH v2] bus/vmbus: Fix crash when handling packets in > secondary process >=20 > Looks fine, only comments would be to keep to original style and add chec= k if > primary channel not found? >=20 > From: Jonathan Erb > > > Sent: Monday, August 9, 2021 9:07 AM > To: Long Li >; Stephen > Hemminger > > Cc: dev@dpdk.org; > stable@dpdk.org > Subject: Re: [PATCH v2] bus/vmbus: Fix crash when handling packets in > secondary process >=20 > You don't often get email from > jonathan.erb@banduracyber.com. > Learn why this is important >=20 > Would it be possible to resolve the lack of subchannels in secondary proc= esses > as follows: >=20 >=20 >=20 > 1. Create the following function in vmbus_uio.c to obtain the count of > subchannels created by the primary: > int vmbus_uio_get_num_subchan(struct vmbus_channel *primary) { >=20 > const struct rte_vmbus_device *dev =3D primary->device; > char chan_path[PATH_MAX]; > struct dirent *ent; > DIR *chan_dir; > int err; > int subchan_cnt =3D 0; >=20 > snprintf(chan_path, sizeof(chan_path), > "%s/%s/channels", > SYSFS_VMBUS_DEVICES, dev->device.name); >=20 > chan_dir =3D opendir(chan_path); > if (!chan_dir) { > VMBUS_LOG(ERR, "cannot open %s: %s", > chan_path, strerror(errno)); > return 0; > } >=20 > while ((ent =3D readdir(chan_dir))) { > unsigned long relid, subid, monid; > char *endp; >=20 > if (ent->d_name[0] =3D=3D '.') > continue; >=20 > errno =3D 0; > relid =3D strtoul(ent->d_name, &endp, 0); > if (*endp || errno !=3D 0 || relid > UINT16_MAX) { > VMBUS_LOG(NOTICE, "not a valid channel relid: %s", > ent->d_name); > continue; > } > subchan_cnt++; > } >=20 > closedir(chan_dir); > //Less one for primary channel > return subchan_cnt - 1; >=20 > } >=20 >=20 >=20 > 2. Then change the bottom of vmbus_uio_map_secondary() to be simply: > /* fd is not needed in secondary process, close it */ > close(fd); >=20 > if (vmbus_chan_create(dev, dev->relid, 0, > dev->monitor_id, &dev->primary)) { > VMBUS_LOG(ERR, "cannot create primary channel"); > return -1; > } >=20 > int subchannels_cnt =3D vmbus_uio_get_num_subchan(dev->primary); > for (i =3D 0; i < subchannels_cnt; i++) { > if(vmbus_uio_get_subchan(dev->primary, &chan)) > return -1; > STAILQ_INSERT_TAIL(&dev->primary->subchannel_list, chan, next); > } > return 0; > } >=20 >=20 >=20 > In this way the secondary processes detect the number of subchannels crea= ted > by the primary, then perform their own mappings as needed. All this can o= ccur > before rte_eal_init has completed. >=20 >=20 >=20 > Jonathan >=20 >=20 >=20 >=20 > On 7/26/21 6:16 PM, Long Li wrote: >=20 > Subject: [PATCH v2] bus/vmbus: Fix crash when handling packets in >=20 > secondary process >=20 >=20 >=20 > Have secondary processes construct their own copy of primary channel with >=20 > own mappings. >=20 >=20 >=20 > Remove vmbus_channel primary ptr from struct mapped_vmbus_resource >=20 > as its not used. >=20 >=20 >=20 > Populate virtual memory address "addr" in struct rte_mem_resource for >=20 > secondary processes as netvsc will attempt to reference it thus causing a >=20 > crash. It was initialized for primary processes but not for secondary. >=20 > Cc: stable@dpdk.org >=20 >=20 >=20 > Signed-off-by: Jonathan Erb > >=20 > --- >=20 > v2: >=20 > * Remove unnecessary check for NULL pointer before call to rte_free() per >=20 > reviwer comment. >=20 >=20 >=20 > drivers/bus/vmbus/private.h | 1 - >=20 > drivers/bus/vmbus/vmbus_channel.c | 4 +--- >=20 > drivers/bus/vmbus/vmbus_common_uio.c | 14 +++++++++----- >=20 > 3 files changed, 10 insertions(+), 9 deletions(-) >=20 >=20 >=20 > diff --git a/drivers/bus/vmbus/private.h b/drivers/bus/vmbus/private.h >=20 > index 528d60a42f..746212bd5f 100644 >=20 > --- a/drivers/bus/vmbus/private.h >=20 > +++ b/drivers/bus/vmbus/private.h >=20 > @@ -42,7 +42,6 @@ struct mapped_vmbus_resource { >=20 >=20 >=20 > rte_uuid_t id; >=20 > int nb_maps; >=20 > - struct vmbus_channel *primary; >=20 > struct vmbus_map maps[VMBUS_MAX_RESOURCE]; >=20 > char path[PATH_MAX]; >=20 > }; >=20 > diff --git a/drivers/bus/vmbus/vmbus_channel.c >=20 > b/drivers/bus/vmbus/vmbus_channel.c >=20 > index f67f1c438a..119b9b367e 100644 >=20 > --- a/drivers/bus/vmbus/vmbus_channel.c >=20 > +++ b/drivers/bus/vmbus/vmbus_channel.c >=20 > @@ -351,10 +351,8 @@ int rte_vmbus_chan_open(struct rte_vmbus_device >=20 > *device, >=20 >=20 >=20 > err =3D vmbus_chan_create(device, device->relid, 0, >=20 > device->monitor_id, new_chan); >=20 > - if (!err) { >=20 > + if (!err) >=20 > device->primary =3D *new_chan; >=20 > - uio_res->primary =3D *new_chan; >=20 > - } >=20 >=20 >=20 > return err; >=20 > } >=20 > diff --git a/drivers/bus/vmbus/vmbus_common_uio.c >=20 > b/drivers/bus/vmbus/vmbus_common_uio.c >=20 > index 8582e32c1d..83c56b6fa2 100644 >=20 > --- a/drivers/bus/vmbus/vmbus_common_uio.c >=20 > +++ b/drivers/bus/vmbus/vmbus_common_uio.c >=20 > @@ -69,8 +69,10 @@ vmbus_uio_map_secondary(struct rte_vmbus_device >=20 > *dev) >=20 > fd, offset, >=20 > uio_res->maps[i].size, 0); >=20 >=20 >=20 > - if (mapaddr =3D=3D uio_res->maps[i].addr) >=20 > + if (mapaddr =3D=3D uio_res->maps[i].addr) { >=20 > + dev->resource[i].addr =3D mapaddr; >=20 > continue; /* successful map */ >=20 > + } >=20 >=20 >=20 > if (mapaddr =3D=3D MAP_FAILED) >=20 > VMBUS_LOG(ERR, >=20 > @@ -88,9 +90,9 @@ vmbus_uio_map_secondary(struct rte_vmbus_device >=20 > *dev) >=20 > /* fd is not needed in secondary process, close it */ >=20 > close(fd); >=20 >=20 >=20 > - dev->primary =3D uio_res->primary; >=20 > - if (!dev->primary) { >=20 > - VMBUS_LOG(ERR, "missing primary channel"); >=20 > + if (vmbus_chan_create(dev, dev->relid, 0, >=20 > + dev->monitor_id, &dev->primary)) { >=20 > + VMBUS_LOG(ERR, "cannot create primary channel"); >=20 > return -1; >=20 > } >=20 >=20 >=20 > Looking at this closer, I don't think it will work for subchannels in the= secondary > process. >=20 >=20 >=20 > The code after is: >=20 >=20 >=20 > STAILQ_FOREACH(chan, &dev->primary->subchannel_list, next) { >=20 > if (vmbus_uio_map_secondary_subchan(dev, chan) !=3D 0) { >=20 > VMBUS_LOG(ERR, "cannot map secondary subchan"); >=20 > return -1; >=20 > } >=20 > } >=20 >=20 >=20 > Because at this time, the primary channel is just created, "subchannel_li= st" > should be NULL. The secondary process ends up running without subchannels= . In > the primary process, "subchannel_list" are populated when it calls > hn_dev_configure(), so it is good. >=20 >=20 >=20 > Sorry I didn't spot this earlier. The best way to fix this is to use rte = memory > functions for allocating vmbus device. In this way they can be properly = mapped > to the secondary process. But rte memory functions are not available at t= he > time vmbus device is probed. I haven't been able to find a good way to fi= x this. > Will keep looking. >=20 >=20 >=20 > Thanks, >=20 > Long >=20 >=20 >=20 >=20 >=20 >=20 >=20 > @@ -211,8 +213,10 @@ vmbus_uio_unmap_resource(struct >=20 > rte_vmbus_device *dev) >=20 > return; >=20 >=20 >=20 > /* secondary processes - just free maps */ >=20 > - if (rte_eal_process_type() !=3D RTE_PROC_PRIMARY) >=20 > + if (rte_eal_process_type() !=3D RTE_PROC_PRIMARY) { >=20 > + rte_free(dev->primary); >=20 > return vmbus_uio_unmap(uio_res); >=20 > + } >=20 >=20 >=20 > TAILQ_REMOVE(uio_res_list, uio_res, next); >=20 >=20 >=20 > -- >=20 > 2.17.1 >=20