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 0E68B42B6F; Mon, 22 May 2023 10:14:27 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0C4CC42D41; Mon, 22 May 2023 10:14:09 +0200 (CEST) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by mails.dpdk.org (Postfix) with ESMTP id 7975941148 for ; Fri, 19 May 2023 12:19:22 +0200 (CEST) Received: from dggpeml500011.china.huawei.com (unknown [172.30.72.53]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4QN2pr4H0SzLmN3; Fri, 19 May 2023 18:17:56 +0800 (CST) Received: from [10.67.101.191] (10.67.101.191) by dggpeml500011.china.huawei.com (7.185.36.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Fri, 19 May 2023 18:19:19 +0800 Message-ID: <9fe13815-9a53-d7cb-a533-bd037de59ad8@huawei.com> Date: Fri, 19 May 2023 18:18:53 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH] app/testpmd: fix segment fault with invalid queue id Content-Language: en-US To: Stephen Hemminger CC: , , References: <20230516110021.1801443-1-huangdengdui@huawei.com> <20230516081206.792072d0@hermes.local> From: huangdengdui In-Reply-To: <20230516081206.792072d0@hermes.local> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.101.191] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpeml500011.china.huawei.com (7.185.36.84) X-CFilter-Loop: Reflected X-Mailman-Approved-At: Mon, 22 May 2023 10:14:02 +0200 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 On 2023/5/16 23:12, Stephen Hemminger wrote: > On Tue, 16 May 2023 19:00:21 +0800 > Dengdui Huang wrote: > >> When input queue id is invalid, it will lead to >> Segmentation fault, like: >> >> dpdk-testpmd -a 0000:01:00.0 -- -i >> testpmd> show port 0 txq/rxq 99 desc 0 status >> Segmentation fault >> >> dpdk-testpmd -a 0000:01:00.0 -- -i >> testpmd> show port 0 rxq 99 desc used count >> Segmentation fault >> >> This patch fixes it. >> >> In addition, this patch add the check for the offset >> of the descriptor in case of other anomalies. >> >> Fixes: fae9aa717d6c ("app/testpmd: support checking descriptor status") >> Fixes: 3f9acb5c83bb ("ethdev: avoid non-dataplane checks in Rx queue count") >> Cc: stable@dpdk.org >> >> Signed-off-by: Dengdui Huang > > What is the backtrace and device driver? The problem is that other users > besides testpmd might hit same problem. > > It would make sense to have a function to test for valid rx and tx queue id > in rte_ethdev. Similar to existing rte_eth_dev_is_valid_port() rather than > open coding it. Maybe rte_eth_dev_is_valid_rxq(port_id, queue_id)? > > here was talk that the existing rx queue descriptor status is racy, and > unused by any real application; and therefore would be good candidate for > future removal. Hi, Stephen OK. Agreed. But these APIs are still in dpdk, so testpmd as user side should use them correctly. Thanks, Dengdui