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 9E34543255 for ; Tue, 31 Oct 2023 18:35:35 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 71D244029E; Tue, 31 Oct 2023 18:35:35 +0100 (CET) Received: from mail-pg1-f172.google.com (mail-pg1-f172.google.com [209.85.215.172]) by mails.dpdk.org (Postfix) with ESMTP id 9007440284 for ; Tue, 31 Oct 2023 18:35:34 +0100 (CET) Received: by mail-pg1-f172.google.com with SMTP id 41be03b00d2f7-5b9a456798eso1596760a12.3 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=aHN2NCwSrOfk1lLSzGDd+OoUhqEEytRybJvlknci1AsSrYV5m5GLANJwbUi5se9wKR GEg3TnciG+WfmD1hf7Ig3As75kg4im/J0q/UUI9E+eWlGYe5r29UNNJHlO+mrfsXrAMX l+gCUNfxSSz1+lHjWGrvlay6FuanyEX71qmo+0CjsADcG38KfuzFkbWCVDVGop+MhLce uWT1RFz7+VYtHsvmzU+tNbLTJdi3Eq1sikx6AuXBO7aWKij2YdSgX8845ArZd5wIDEws AgDpZ1Zf32UGUula3D2m1Xaem4jTYuxJ0pmPoEsuiTSYYIGPuMnwh0k7PM1nl0Cr3ixN kV1A== X-Gm-Message-State: AOJu0Yzr6dglvF0H6GBTEPTP+wXIQrU3FUvuM5bRhkrAJjjfmKh7I3o8 S7qU2ZHER/YC0WPKtmVkqB6Xqw== 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: 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 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.