From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0111.outbound.protection.outlook.com [104.47.1.111]) by dpdk.org (Postfix) with ESMTP id AA01314E8 for ; Tue, 19 Jun 2018 11:20:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nokia.onmicrosoft.com; s=selector1-nokia-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nR8d1FNZlQZZ22tl3YFQRw3rtxrlwUIjFE5Y6wwqqUE=; b=Fz1WgbdKidnoaM9S65noiwFrB8sQoigH0ZcGf1G9O0Np1jQrQU+mGEMCZpPv6EyqmJ38BAk9sAhXhdZjEMGuWCgBzCBiL3lOz7zEtdeCnWh27TIqNlsKpiEO+WKHfXPOsBUCwo21X42/ql/mC0N4WvhNzcewJaQBS1ybyRFfN0Q= Received: from HE1PR07MB0844.eurprd07.prod.outlook.com (10.162.24.17) by HE1PR07MB1242.eurprd07.prod.outlook.com (10.164.51.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.884.15; Tue, 19 Jun 2018 09:20:03 +0000 Received: from HE1PR07MB0844.eurprd07.prod.outlook.com ([fe80::c58a:f50b:88dd:ae6f]) by HE1PR07MB0844.eurprd07.prod.outlook.com ([fe80::c58a:f50b:88dd:ae6f%2]) with mapi id 15.20.0884.010; Tue, 19 Jun 2018 09:20:02 +0000 From: "Elo, Matias (Nokia - FI/Espoo)" To: "harry.van.haaren@intel.com" CC: "dev@dpdk.org" , "jerin.jacob@caviumnetworks.com" Thread-Topic: [dpdk-dev] [Bug 60] rte_event_port_unlink() causes subsequent events to end up in wrong port Thread-Index: AQHUB66zfZa2ZYsKV02/DRe7x30OUA== Date: Tue, 19 Jun 2018 09:20:02 +0000 Message-ID: <09B2B474-8558-4EE6-BB26-460EF8C89909@nokia.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: Apple Mail (2.3445.8.2) authentication-results: spf=none (sender IP is ) smtp.mailfrom=matias.elo@nokia.com; x-originating-ip: [131.228.32.171] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; HE1PR07MB1242; 7:DjqS8cQEMAiiINDPCBuueoJj3xaAlG9zgQWocTZKf7QCp1Yw68k1XaQGGM3ufgg3zcelCdrrEhz3snW2vyKgZA6e6HqSygR4wZmcMVnA6t1u5SEN7g8nY4UW5zfLDgNMKUQvxqL3u6q10shHENLACoIsVasnUM6LdjVSoKFjsNT132maK5UHf9NPSdnQYTRCBM9JYsuBfteP/zaxwLteMIZ/qgjIU8cVNgqBJoZ5WyUXBJKQfw7R6DyVLRc5LoSq x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: 8b8d691c-64d6-4924-ae1f-08d5d5c5d69b x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(8989080)(4534165)(4627221)(201703031133081)(201702281549075)(8990040)(5600026)(711020)(48565401081)(2017052603328)(7193020); SRVR:HE1PR07MB1242; x-ms-traffictypediagnostic: HE1PR07MB1242: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(5005006)(8121501046)(10201501046)(3231254)(11241501184)(806099)(944501410)(52105095)(93006095)(93001095)(3002001)(6055026)(149027)(150027)(6041310)(20161123564045)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(6072148)(201708071742011)(7699016); SRVR:HE1PR07MB1242; BCL:0; PCL:0; RULEID:; SRVR:HE1PR07MB1242; x-forefront-prvs: 07083FF734 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39860400002)(39380400002)(366004)(346002)(396003)(376002)(199004)(189003)(316002)(6506007)(82746002)(102836004)(6916009)(54906003)(2900100001)(83716003)(2616005)(68736007)(33656002)(6436002)(66066001)(478600001)(25786009)(5640700003)(26005)(86362001)(97736004)(6512007)(486006)(476003)(186003)(99286004)(3280700002)(14454004)(229853002)(8936002)(57306001)(36756003)(81166006)(50226002)(3660700001)(81156014)(6116002)(5660300001)(106356001)(6246003)(53936002)(105586002)(7736002)(6486002)(2351001)(3846002)(4326008)(305945005)(8676002)(2501003)(5250100002)(2906002); DIR:OUT; SFP:1102; SCL:1; SRVR:HE1PR07MB1242; H:HE1PR07MB0844.eurprd07.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: nokia.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: XaxX0xWHSiJslL/sGTdef+Ccqy7BgReC2Ts9pG8oqib2lBanV2cvLbQ4KOU5LOR+lgo/2kjvor9JhKoU2hFODiXSjdFLD6CIAdJAU+hK9pMT8+Xg0cx4wS0oaO7PTLTPBFl0PC4PC5q+voFlzUqXJ2KfmOzBMyVwxpLIpEMBPRh40f50+06bBXl4bFCrxQbOxNqypkplxE5gZBednrxzjrgovt613n1XnTIJjJostEi9VatyuPcjhbdNNPa9pntt3cJdDLPneK0qvRYltYPWbHKXyTJ8+5V4bhO8P/FX1QEAxrfMdpMZjU3+ghKuXJ5P/qXCUzb1OhIUTn9fzlhXCkjNZYNGB5Joz8ASRBJx0dBwFiqhO2sbOef00VRfAGA8 spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-ID: <02064E29F7680D4BAF92AE40B8886F27@eurprd07.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8b8d691c-64d6-4924-ae1f-08d5d5c5d69b X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Jun 2018 09:20:02.6752 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 5d471751-9675-428d-917b-70f44f9630b0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR07MB1242 Subject: Re: [dpdk-dev] [Bug 60] rte_event_port_unlink() causes subsequent events to end up in wrong port X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jun 2018 09:20:04 -0000 > I think this should handle the unlink case you mention, however perhaps y= ou have identified a genuine bug. If you have more info or a sample config = / app that easily demonstrates the issue that would help reproduce/debug he= re?=20 Hi Harry, The bug report includes a simple test application for demonstrating the iss= ue. I've done some further digging and the following simple patch seems to = fix the issue of events ending up in wrong ports. diff --git a/drivers/event/sw/sw_evdev_scheduler.c b/drivers/event/sw/sw_ev= dev_scheduler.c index 8a2c9d4f9..57298345d 100644 --- a/drivers/event/sw/sw_evdev_scheduler.c +++ b/drivers/event/sw/sw_evdev_scheduler.c @@ -79,9 +79,11 @@ sw_schedule_atomic_to_cq(struct sw_evdev *sw, struct sw_= qid * const qid, int cq =3D fid->cq; =20 if (cq < 0) { - uint32_t cq_idx =3D qid->cq_next_tx++; - if (qid->cq_next_tx =3D=3D qid->cq_num_mapped_cqs) + uint32_t cq_idx; + if (qid->cq_next_tx >=3D qid->cq_num_mapped_cqs) qid->cq_next_tx =3D 0; + cq_idx =3D qid->cq_next_tx++; + cq =3D qid->cq_map[cq_idx]; =20 /* find least used */ @@ -168,9 +170,11 @@ sw_schedule_parallel_to_cq(struct sw_evdev *sw, struct= sw_qid * const qid, do { if (++cq_check_count > qid->cq_num_mapped_cqs) goto exit; - cq =3D qid->cq_map[cq_idx]; - if (++cq_idx =3D=3D qid->cq_num_mapped_cqs) + + if (cq_idx >=3D qid->cq_num_mapped_cqs) cq_idx =3D 0; + cq =3D qid->cq_map[cq_idx++]; + } while (rte_event_ring_free_count( sw->ports[cq].cq_worker_ring) =3D=3D 0 || sw->ports[cq].inflights =3D=3D SW_PORT_HIST_LIST); @@ -251,6 +255,9 @@ sw_schedule_qid_to_cq(struct sw_evdev *sw) if (iq_num >=3D SW_IQS_MAX) continue; =20 + if (qid->cq_num_mapped_cqs =3D=3D 0) + continue; + uint32_t pkts_done =3D 0; uint32_t count =3D iq_ring_count(qid->iq[iq_num]); However, events from atomic/ordered queues may still end up getting stuck w= hen unlinking (scheduled back to unlinked port). In case of atomic queues t= he problem seems to be related to (struct sw_fid_t *)fid->cq fields being i= nvalid. With ordered queues events get stuck in reorder buffer. -Matias