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 8E3C345A82; Wed, 2 Oct 2024 21:26:16 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1FEDC402AE; Wed, 2 Oct 2024 21:26:16 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 74C4E402A7 for ; Wed, 2 Oct 2024 21:26:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1727897174; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KKHyXPBeo7ZnVpcjpAmt+l7yfcf9Cx6vtJLzXNjKuVk=; b=DxdXJMzEbiY/bO+646V6zUEoaCQjIGJJjZFLwHRejdO9nfEndsttnE8XDD4v5eWdIrjo9o EXJkvv+LFVvxRkWhT6pl8VBdbAf8W5QnfqbSFLOBGgaY1eX9QgB3LTIBAvYdEz8iF5UuaL Km3bJjNZhBQcFouhFwhJmmyKWqsixL8= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-10-7B8MiI4APbWtr82WY8LdEA-1; Wed, 02 Oct 2024 15:26:13 -0400 X-MC-Unique: 7B8MiI4APbWtr82WY8LdEA-1 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-37cd08d3678so84367f8f.1 for ; Wed, 02 Oct 2024 12:26:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727897172; x=1728501972; h=in-reply-to:references:user-agent:from:cc:subject:to:message-id :date:content-transfer-encoding:mime-version:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=KKHyXPBeo7ZnVpcjpAmt+l7yfcf9Cx6vtJLzXNjKuVk=; b=Mu+SC/iLPjJipCkbWW8bf+ds6xQxo9/ZsJEjqxqvTkcu8dFbrlXFuk47cLCb9MrOir kfhk4H+EjH7ZKK1h+yGUsH6aKmINBQyMghv5Ms5JMCaslICIkngs+tnyjBFD3zzaFu7y QhlFRW7e6wpPazsd0RTEHdvTT5QSXSMlwvJ124VFg/3saH1SImoX7TU9L69WNwEcThSX Bf7SdwDDlIO3/wJ2Dgh7HjLQFopcpqb36qHB4vwKehOx6EHFmFyqXs/YLYgCrCGIi6/j XeMhvmLvIm+yQo2WlxB5kKRmIUCnqn3ep4tgMjKB18Hr7a7NPF7OeU6JQmjW2vY+LgCl ZLsg== X-Forwarded-Encrypted: i=1; AJvYcCX65TnQg5ZYdmIqX2L2qO9TytW9eQ9+TjuXaNkp/DqO1cYgF1zvGwaG5REVqze/oe1Mebc=@dpdk.org X-Gm-Message-State: AOJu0YwZvMvYq3RTSD9bXhrhkWEfrxzvIFreZcuepxsORYwT9e9FGHfG aOd4xk/3ahtRr9UD8pyc0Da8Q12MSbW44d1uGOx4uxzCy01ZcMNt/QUlU/LRe2G7qtXFv6S4wQF xAQnC4fW3eeoHMLfpGaj9lgu7KZlTr6ja4v5Orw7v X-Received: by 2002:adf:f051:0:b0:374:cee6:c298 with SMTP id ffacd0b85a97d-37d04a576efmr465776f8f.21.1727897171746; Wed, 02 Oct 2024 12:26:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGoobDkbavFWvPEbkav3KBWorRqj8sWbaneI95FKZ13A8ZmYHyYMuf7pHKijD+0Yv6+7nOdLQ== X-Received: by 2002:adf:f051:0:b0:374:cee6:c298 with SMTP id ffacd0b85a97d-37d04a576efmr465763f8f.21.1727897171336; Wed, 02 Oct 2024 12:26:11 -0700 (PDT) Received: from localhost (2a01cb00025433001b9f807167cdbf20.ipv6.abo.wanadoo.fr. [2a01:cb00:254:3300:1b9f:8071:67cd:bf20]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42f79d8d693sm27034995e9.2.2024.10.02.12.26.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 02 Oct 2024 12:26:11 -0700 (PDT) Mime-Version: 1.0 Date: Wed, 02 Oct 2024 21:26:10 +0200 Message-Id: To: "David Marchand" Subject: Re: [PATCH 2/2] ethdev: fix race on ports for telemetry commands Cc: "Bruce Richardson" , , , , "Thomas Monjalon" , "Ferruh Yigit" , "Andrew Rybchenko" , "Keith Wiles" , "Ciara Power" From: "Robin Jarry" User-Agent: aerc/0.18.2-74-g7e4ac1a5f54c References: <20241002155709.2522273-1-david.marchand@redhat.com> <20241002155709.2522273-3-david.marchand@redhat.com> In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8; format=Flowed 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 David Marchand, Oct 02, 2024 at 21:18: > On Wed, Oct 2, 2024 at 9:09=E2=80=AFPM Robin Jarry wr= ote: >> I was going to suggest adding a rte_spinlock_t* parameter to a new >> telemetry register function that would need to be held while the >> callback is invoked. Or if we want to keep doors open to other kinds of >> lock, a wrapper callback. > > Well, as you had experimented this approach, we know this does not > work: the ethdev lock is in dpdk shared memory which is not available > yet at the time RTE_INIT() is called. > > A single callback is strange, I guess you mean pre/post callbacks then. It could be a single function that will wrap the callbacks. E.g.: static int eth_dev_telemetry_with_lock( telemetry_cb fn, const char *cmd, const char *params, struct rte_tel_da= ta *d) { int ret; rte_spinlock_lock(rte_mcfg_ethdev_get_lock()); ret =3D fn(cmd, params, d); rte_spinlock_unlock(rte_mcfg_ethdev_get_lock()); return ret; } RTE_INIT(ethdev_init_telemetry) { .... rte_telemetry_register_cmd("/ethdev/stats", eth_dev_handle_port_stats, "Returns the common stats for a port. Parameters: int port_id", eth_dev_telemetry_with_lock); .... } I'm not sure which solution is the uglier :D