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 E5C5BA0547; Tue, 26 Oct 2021 17:57:07 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 86DD840E0F; Tue, 26 Oct 2021 17:57:07 +0200 (CEST) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by mails.dpdk.org (Postfix) with ESMTP id E34EF407FF for ; Tue, 26 Oct 2021 17:57:05 +0200 (CEST) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 18E975C03C3; Tue, 26 Oct 2021 11:57:04 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Tue, 26 Oct 2021 11:57:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s=fm2; bh= JhyU5E4gd9vq3mhJgRNr5sDyit5tNRp+FZG+BAYWnQ8=; b=lhPQF0IeDXpuYqsK VW0fJwuNyK5xvGF1bk5cab9A9CZmXLQv/HN6qFztmaIVn+3YqVF/eeyytRzoWx6Q 22JnoR8OHoDRu2IDmIttuTvJ87cBbH4KkpDa/gp5QlmokmWby96DsrVfL03awKht zyN2wbf4OvfrwWzph2wxwOtqgIH2OAULc/XV3e8q5yN4BFBmxJg0UseOhHsUF6WN vp6urdIezaJiJVI9UyCDz87WQQ5550YPg5c0xqEKhGUcS68uG1Dm+3bS3Xh0Uw1f QnSrJB7Bf/Nm8IsKkjcTTuLvKx4dyPC0sHnbTlsLmlBrCmlHUawqGzpc92RCP6uN y0EeiA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=JhyU5E4gd9vq3mhJgRNr5sDyit5tNRp+FZG+BAYWn Q8=; b=UUuIl8hXNumiQeu9rnprdd8l0iYb9O9yF4J8rFgwmIeAYVh6vq7jErZfx 4fU3f2ZPwZaSl4YYhl77D6K8soRXcVJjIh+rJ8L1YVcuaJqH2zWMIMzATjUgZwJI Fsfw+z1bLDXHuZgdSVKMH5352ba3CbInrILfhGqoNiGJkzQKcQoczbNVOs8GY5uC OqzpeSf7zSwLvZs/JDahvo/IqEY9phAdX5fZ6fC9yqAzqsDidEjIzawNIlESYaBx Kp89EfvGPrPoSIKfpXoo2XVwwiEQasIrIFgGT7BoGq8K2+z6ALlR2GGGu4r17wAa KAvb6IJURpHsoQFied2mz0p8ou/RQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrvdefkedgheegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkfgjfhgggfgtsehtufertddttddvnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhepudeggfdvfeduffdtfeeglefghfeukefgfffhueejtdetuedtjeeu ieeivdffgeehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh homhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 26 Oct 2021 11:57:02 -0400 (EDT) From: Thomas Monjalon To: David Marchand Cc: dev@dpdk.org, konstantin.ananyev@intel.com, ferruh.yigit@intel.com, andrew.rybchenko@oktetlabs.ru, bingz@nvidia.com, Xiaoyun Li Date: Tue, 26 Oct 2021 17:56:58 +0200 Message-ID: <3415992.2jfn0xn0IN@thomas> In-Reply-To: <20211026145851.21944-1-david.marchand@redhat.com> References: <20211026145851.21944-1-david.marchand@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH] ethdev: warn only once for badly behaving applications 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" 26/10/2021 16:58, David Marchand: > Warning continuously is a pain when developping or if a unit test > is/gets broken. > > It could also be a problem if application behaves badly only in some > corner cases and a DoS results of those logs being continuously displayed. > > Let's warn once per port and per rx/tx. > > Getting such a log is scary, but let's make it more eye catching by > dumping a backtrace with it. [...] > Fixes: c87d435a4d79 ("ethdev: copy fast-path API into separate structure") > > Signed-off-by: David Marchand [...] > +static struct dummy_queue *dummy_queues_ref[RTE_MAX_ETHPORTS][RTE_MAX_QUEUES_PER_PORT]; > +static struct dummy_queue dummy_queues[RTE_MAX_ETHPORTS]; I feel we could better name those arrays, maybe adding a comment. First one is really queues array while the second one is to share the same value with all queues of a port. Right? > +RTE_INIT(dummy_queue_init) > +{ > + uint16_t port_id; > + > + for (port_id = 0; port_id < RTE_DIM(dummy_queues); port_id++) { > + unsigned int i; q would be a better name than i > + > + for (i = 0; i < RTE_DIM(dummy_queues_ref[port_id]); i++) > + dummy_queues_ref[port_id][i] = &dummy_queues[port_id]; > + } > +} > + > static uint16_t > -dummy_eth_rx_burst(__rte_unused void *rxq, > +dummy_eth_rx_burst(void *rxq, > __rte_unused struct rte_mbuf **rx_pkts, > __rte_unused uint16_t nb_pkts) > { > - RTE_ETHDEV_LOG(ERR, "rx_pkt_burst for not ready port\n"); > + struct dummy_queue *q = rxq; > + > + if (!q->rx_warn_once) { > + uint16_t port_id = q - dummy_queues; > + > + RTE_ETHDEV_LOG(ERR, "lcore %u called rx_pkt_burst for not ready port %"PRIu16"\n", > + rte_lcore_id(), port_id); > + rte_dump_stack(); > + q->rx_warn_once = true; > + } > rte_errno = ENOTSUP; > return 0; > } OK with this log. [...] > eth_dev_fp_ops_reset(struct rte_eth_fp_ops *fpo) > { > static void *dummy_data[RTE_MAX_QUEUES_PER_PORT]; > - static const struct rte_eth_fp_ops dummy_ops = { > + uint16_t port_id = fpo - rte_eth_fp_ops; > + > + dummy_queues[port_id].rx_warn_once = false; > + dummy_queues[port_id].tx_warn_once = false; > + *fpo = (struct rte_eth_fp_ops) { > .rx_pkt_burst = dummy_eth_rx_burst, > .tx_pkt_burst = dummy_eth_tx_burst, > - .rxq = {.data = dummy_data, .clbk = dummy_data,}, > - .txq = {.data = dummy_data, .clbk = dummy_data,}, > + .rxq = (struct rte_ethdev_qdata) { Why this cast? rte_eth_fp_ops.rxq is of type rte_ethdev_qdata. > + .data = (void **)&dummy_queues_ref[port_id], > + .clbk = dummy_data, > + }, > + .txq = (struct rte_ethdev_qdata) { > + .data = (void **)&dummy_queues_ref[port_id], > + .clbk = dummy_data, > + }, > }; > - > - *fpo = dummy_ops; > }