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 726FA43255; Tue, 31 Oct 2023 18:35:36 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9A32E40633; Tue, 31 Oct 2023 18:35:35 +0100 (CET) Received: from mail-pg1-f171.google.com (mail-pg1-f171.google.com [209.85.215.171]) by mails.dpdk.org (Postfix) with ESMTP id 915E64029E for ; Tue, 31 Oct 2023 18:35:34 +0100 (CET) Received: by mail-pg1-f171.google.com with SMTP id 41be03b00d2f7-5ab94fc098cso3897977a12.1 for ; Tue, 31 Oct 2023 10:35:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1698773733; x=1699378533; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=D1chvqHMU5+6CkLR2INoo+JDgCzzw2FSKIeO8oCx9nA=; b=lhim2s0PwSNRYe7oXZ9u7/UctqZtIEQMGCXYbgAMsy61aghsIb/qkEtCP9zgt8lbiM 2CLPAEREmmV6OgHkaTZsu9hqOGBye2FDL+H504Nng41dYyVyPXQIzYmJlkfv+esDqRyn /0nVojCyVfthWoHQFOmse25Xx2U/8b57x2p5yrLYzIz7M75abYYkwVZ6SYH9EmI86MCM hg8A4S/MDMJfBJR0//b4vXLKEPZHC5RWFn1Cnrag8g2SMn/BqugQ3MumRSBaw/L/KvX4 poIabyLWue1sfcHJg7nR8X+VjBQLpx52vTXdqC1cqYPpoJgSxRln4qbZjNWjfCnM37Cn YAig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698773733; x=1699378533; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=D1chvqHMU5+6CkLR2INoo+JDgCzzw2FSKIeO8oCx9nA=; b=C4FA/4t0k4LaSqwYbMp8wVDwQZhTjFzMcnc7hnYiEzljx1Vzy/0yQcMtToU6AsiLe7 OHeLTlRkGKzRu5KCJNOVA2xpqAZg75pVc9Hxy8sEv8xg7o8Fuob+qzBMiWxYl9iVJkEU lJgBg4x5B5XU4K5X0wqxyHc+t2nhmLKq4f2SV+jtpfvtJI9zGRpff6Y4hhVEc3bIjCMu WNNk0YALIaOFj/fQQaQPEHioa5YRAczEgNCYIZ736tvXzRRXjzENPF2BSwegLHYJx72n Bv0gB5Kvwm+gwEVMm+56nBdD7YnayC70dFLW8yGCxs49se9lEVd5X8CZDLjWfBFrF8Vd YonA== X-Gm-Message-State: AOJu0YzXn4Ijx/7LwV6bXHPGuwjUQSJC8nkvzYuX5MixLYveK/+ZlzX/ wJILucv78nzvgOBP2NVsH36GrQ== X-Google-Smtp-Source: AGHT+IGl1mdypL2ChxvZMPotw02pP43D9S5q0c1iLiB1NV02qSYX2706y1zCgs5Po5dxER0/rCMYSg== X-Received: by 2002:a05:6a20:3d01:b0:15e:2d9f:cae0 with SMTP id y1-20020a056a203d0100b0015e2d9fcae0mr14376784pzi.10.1698773733499; Tue, 31 Oct 2023 10:35:33 -0700 (PDT) Received: from fedora ([38.142.2.14]) by smtp.gmail.com with ESMTPSA id i64-20020a639d43000000b0059d6f5196fasm1308120pgd.78.2023.10.31.10.35.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 10:35:33 -0700 (PDT) Date: Tue, 31 Oct 2023 10:35:28 -0700 From: Stephen Hemminger To: Luc Pelletier Cc: grive@u256.net, dev@dpdk.org, konstantin.ananyev@huawei.com, stable@dpdk.org Subject: Re: [PATCH v3 1/5] failsafe: fix segfault on hotplug event Message-ID: <20231031103528.5fa26855@fedora> In-Reply-To: <20221129144832.2750-2-lucp.at.work@gmail.com> References: <20221110163410.12734-1-lucp.at.work@gmail.com> <20221129144832.2750-2-lucp.at.work@gmail.com> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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 Tue, 29 Nov 2022 09:48:29 -0500 Luc Pelletier wrote: > When the failsafe PMD encounters a hotplug event, it switches its rx/tx > functions to "safe" ones that validate the sub-device's rx/tx functions > before calling them. It switches the rx/tx functions by changing the > function pointers in the rte_eth_dev structure. > > Following commit 7a0935239b9e, the rx/tx functions of PMDs are no longer > called through the function pointers in the rte_eth_dev structure. They > are rather called through a flat array named rte_eth_fp_ops. The > function pointers in that array are initialized when the devices start > and are initialized. > > When a hotplug event occurs, the function pointers in rte_eth_fp_ops > still point to the "unsafe" rx/tx functions in the failsafe PMD since > they haven't been updated. This results in a segmentation fault because > it ends up using the "unsafe" functions, when the "safe" functions > should have been used. > > To fix the problem, the "unsafe" rx/tx functions were completely > removed. The "safe" functions are now always used. Modifying the rx/tx > functions on-the-fly is not supported by DPDK, so this is the correct > approach and should have very minimal impact on performance. > > Fixes: 7a0935239b9e ("ethdev: make fast-path functions to use new flat array") > Cc: Konstantin Ananyev > Cc: stable@dpdk.org > > Signed-off-by: Luc Pelletier I don't use or have way to test failsafe anymore. But wanted to give a try at reviewing this. This version does not apply to current code base. If still interested, please rebase and resubmit.