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 4E0A945A84 for ; Wed, 2 Oct 2024 21:26:17 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 42E2F40615; Wed, 2 Oct 2024 21:26:17 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id B3B0E402AE 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-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-417-ME_QK7SQPpC9p4zOwgV7mA-1; Wed, 02 Oct 2024 15:26:13 -0400 X-MC-Unique: ME_QK7SQPpC9p4zOwgV7mA-1 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-37cd08d3678so84369f8f.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=SlsjT63wX604RTi+Q5v3er9bmSHHtH/yEODJfuGPIUADAS/Kxiu//cwGv8VFuSjcl+ kF/foML4MyVJ4rXVFvFk2g6ZSHhBbjWBfEKF2zxalJbzglXyVzY32hATwYvGHyiv+QfB aH5UMNBFD+LHt92JAlRogoxK0vfKTs3QY4npE8NAR3VDkueChKeGVIKyQfGy77rGW5cm 1VO2Yywu1zfwgrPEHEZuKkVuPLYkWuYyKyxFyumk9fjf4AuuHMQCAoMYeaZs31vHGDHE ksL4p6PqaMXxNmpnotLp4HfID2PzSeackw9BV79ZuxhsU44qRFjW3c74w43rCLGhna1U N5RQ== X-Forwarded-Encrypted: i=1; AJvYcCXe3wMXWjFbT7qY/FfxA/gImYo4+2M6IFexRfjh/8qfP/lYfrAp0w6DcTcYwaXv+6Jrn78V840=@dpdk.org X-Gm-Message-State: AOJu0YxxYJXvEMjiBSIJHSm4qxFSWhbipsA2I9ZpNpWIs8bP6iPCMzkR 3LF7AXTAY9bW4fXy9o/4LG0/EClmK2ZHLW6U+upqfecxvaa8w29xy/53tmxW7DkISaWDDx92+xN dLVayTZ//q5P3CSD4tl1VUDX0GjHDb0jeh3SoFuDNBSto X-Received: by 2002:adf:f051:0:b0:374:cee6:c298 with SMTP id ffacd0b85a97d-37d04a576efmr465774f8f.21.1727897171745; 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: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-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