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 E2422A0542 for ; Fri, 11 Nov 2022 00:33:06 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DB8EF40141; Fri, 11 Nov 2022 00:33:06 +0100 (CET) Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) by mails.dpdk.org (Postfix) with ESMTP id CE35D400EF for ; Fri, 11 Nov 2022 00:33:05 +0100 (CET) Received: by mail-pj1-f52.google.com with SMTP id q1-20020a17090a750100b002139ec1e999so3267531pjk.1 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=EAv/GP8cQux+7MuKBTeDLACHxNOeTB9oaURILsuTIjDSfTU1Zq98v8VBN6027fYLdC sbjm4uDe530+kB8iMKBUuTMExSPomkmJYknTTBh5tBvp18Pi5QKxOqSPNLSYVymx0wJh AE2QzdXx5xjA6bHvb3FAENJCMwQ+ik+SfVnAljGRgdDZztgynXOEYd75QiZyD5RgFom6 +KDC7AUJfsd1xr1F5OeJs7aR2iVEW35JwBGcaMgWJxn2OEzOTvCTR3A/vJhnA41/iDI2 y1BR3mFTdBYA8yVkmGweq3y1YBK7Mk18Qt9b9TaHmr5P7DfOO2qPB/VMAv3OBfIQJLZT t3hA== X-Gm-Message-State: ANoB5pmuF1Zc2C4FKdMvgl8V1+S/VbtfzTSu9kYkAuV5Uppy912WdfNO FwPl/t4HTxF5lhlfskVmnJ9ovQ== 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: 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 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.