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 7B04EA0542; Fri, 11 Nov 2022 00:33:07 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0919740697; Fri, 11 Nov 2022 00:33:07 +0100 (CET) Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) by mails.dpdk.org (Postfix) with ESMTP id D498440141 for ; Fri, 11 Nov 2022 00:33:05 +0100 (CET) Received: by mail-pl1-f179.google.com with SMTP id 4so2906032pli.0 for ; Thu, 10 Nov 2022 15:33:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; 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=PROYh+vTmTgEiIsBGuEZww2g8tULNYQ/XeHnFEjMOdU=; b=pUE2GBZJIxmEig/xw6ykKhJnaG0g/rjNzWcWqFtIWfoh+FKp7/Bc6D2pAYsSPaQ01K FRHli9HPosFP2NsRbOXkOCAY62jAtFQvtmCYXVndcHHRszyFLJh9Ghbo/lSWJ6fYr5FI DGyzykcI12sKL/YCnbDtRFhrR65gUPNlSqR99y3NamQfT6SCXOnPPHn1OV/uDunxSO2L pm+p/99IF2RWJEPBrRmtMc32gs1UXxbWG1V/VjEzMUhhriy9533WOZtb2DvVedhG/rZg r3P/n4Hs6l9FRC7jHnjFpomR57Pobg+8rbg+KCdsX68da9+DoOHLVkC0jYTxX4Qaqm5D tNyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=PROYh+vTmTgEiIsBGuEZww2g8tULNYQ/XeHnFEjMOdU=; b=VbhZ0q+3vRuTRoWeIUt2KZf7EMrBfT8rPLVbGtG1t9x0nXb7BvFE/oJkl/aLkVOkO/ MQSc7LyQrA8+P6yI+dqZZytqNk/WBw/ggEuKIRC/db4HfFhrbkDMsW0kiR2meCXF0me/ Z3RkQ/LNdi7MxPeHg8/fBDTyQchr8R7u0nxqWhprg1Uc3rzLtQjjle5MTpxz54DfiAnr IeyWQW53Pu998sOv1LCz90c4Ovs8LBqKMA6Uy2vDh0e1IKPc09gruHg+xiCbCdeOb+j0 slIOR/iFjbvRMtoRb/tXkNNRContOVFI8uaL7dB0GyBUs9kbY8P9r45yCE15+LByvJTY ioSQ== X-Gm-Message-State: ANoB5plHMaAPR+W7XAiRwZNa4R1SZ2+MZbVQ5acgvxoW0BIkqCflYD9C t8QdRp52vOYzLkQz4p47ULljXA== X-Google-Smtp-Source: AA0mqf7t0QH3auopHMahsF6NXE0juudI2S9Q9TlNJlpMiMLdlkEJpbKG55MZqhVHKOOykxiCd3RpwQ== X-Received: by 2002:a17:902:6b87:b0:186:880c:167e with SMTP id p7-20020a1709026b8700b00186880c167emr48697plk.7.1668123184891; Thu, 10 Nov 2022 15:33:04 -0800 (PST) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id o14-20020a17090a55ce00b0020ad7678ba0sm350270pjm.3.2022.11.10.15.33.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Nov 2022 15:33:04 -0800 (PST) Date: Thu, 10 Nov 2022 15:33:01 -0800 From: Stephen Hemminger To: Luc Pelletier Cc: grive@u256.net, dev@dpdk.org, Konstantin Ananyev , stable@dpdk.org Subject: Re: [PATCH v2] failsafe: fix segfault on hotplug event Message-ID: <20221110153301.23512948@hermes.local> In-Reply-To: <20221110174241.16061-1-lucp.at.work@gmail.com> References: <20221110163410.12734-1-lucp.at.work@gmail.com> <20221110174241.16061-1-lucp.at.work@gmail.com> 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 Thu, 10 Nov 2022 12:42:43 -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 failsafe PMD code was changed to update the > function pointers in the rte_eth_fp_ops array when a hotplug event > occurs. Have it in both places might be breaking other drivers as well. Shouldn't there be a ethdev function when changing rx/tx burst. Also, changing a variable used by another thread needs to be using __atomic_store and __atomic_load to guarantee that CPU or compiler will no that it changed.