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 EA9C541DAB; Wed, 1 Mar 2023 15:53:47 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BC4CA4114A; Wed, 1 Mar 2023 15:53:47 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 2493B4113C for ; Wed, 1 Mar 2023 15:53:46 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677682425; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AVn6aAzn5SuRaMXKpCf9iswxv86ts52MVJVfbQzxEDk=; b=KVofRZaejDjyZ8iP8JNErGtXmOC5Pic1AnjZWHKvFQpnNRRXvu1/4yVbpBPVutuLOh9uZT j9cs9R8QfsILRlA1ojZ600VzEb0Ikn7SnsQ+YWUhfflnP4UPd0VHEjqLFyp6jypemMQMFO D4G5XkGyY9soUqLtIkcHfd8vj6FmHuk= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-564-ul8h4emAOe66oh-h8Wzjaw-1; Wed, 01 Mar 2023 09:53:44 -0500 X-MC-Unique: ul8h4emAOe66oh-h8Wzjaw-1 Received: by mail-wm1-f72.google.com with SMTP id t1-20020a7bc3c1000000b003dfe223de49so8439404wmj.5 for ; Wed, 01 Mar 2023 06:53:44 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677682423; h=content-transfer-encoding:in-reply-to:subject:from:references:to :content-language:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=AVn6aAzn5SuRaMXKpCf9iswxv86ts52MVJVfbQzxEDk=; b=NDRnsnzXoDFNCy4biB51nRI+RsuvbYM0xoOWxrmesd7yTp0Jk0Csh23bsbCBnSgfoi 1fomzZW1zaY9omUwVZhIQ/OCXWRR+5GWxL1JOF0M7VvLnJCbHAXLgfj0Kh4YjiA3HE5r mSQmfafnaYb52UmPFYK6PFcFNAYTy3HIBmBByrCKcs/QCI/NQ/YLlM0+0JWHTFzeT0+c jX1qs8ZUMDZ7QP2DiFCZNSJb9XT2HPfUzkn0QocDFiwgI2U3zKO3Gin4dMlS5bJ41VgO LD0DL5ymigsAC9TS7/yXxGX1lW6Jnb4kb0Iyn7w3rWEFC6yh41fS9GW5QUargs6lNUih vuxw== X-Gm-Message-State: AO0yUKVmFspe4lNXPlc2Xs0MrItFWxyece2RH13Ofynr/t9ucwNr5eGw U6slHvKTRDW0BsLjNwcmkl5xqOr+lKJdKiS5u/8ZTBCyfeQYuaTMzmsDNMNUqKNXyrMykKIGrL7 kIh4= X-Received: by 2002:a5d:4cc7:0:b0:2bf:94ea:67ca with SMTP id c7-20020a5d4cc7000000b002bf94ea67camr5358778wrt.25.1677682423303; Wed, 01 Mar 2023 06:53:43 -0800 (PST) X-Google-Smtp-Source: AK7set8GdN3Q3q995v7s1C71+H2yfXpj3HFy3TxdK27fqCfYAD4Y6YfDZaBtqsA2Ps0IZ8uuBcsdgg== X-Received: by 2002:a5d:4cc7:0:b0:2bf:94ea:67ca with SMTP id c7-20020a5d4cc7000000b002bf94ea67camr5358766wrt.25.1677682422983; Wed, 01 Mar 2023 06:53:42 -0800 (PST) Received: from [192.168.0.36] ([78.16.250.81]) by smtp.gmail.com with ESMTPSA id i20-20020a5d5234000000b002c5493a17efsm12986956wra.25.2023.03.01.06.53.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 01 Mar 2023 06:53:42 -0800 (PST) Message-ID: Date: Wed, 1 Mar 2023 14:53:41 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 To: Ke Zhang , qi.z.zhang@intel.com, qiming.yang@intel.com, dev@dpdk.org References: <20230208083005.290571-1-ke1x.zhang@intel.com> <20230213071648.326123-1-ke1x.zhang@intel.com> From: Kevin Traynor Subject: Re: [PATCH v2] net/ice: fix ice dcf control thread crash In-Reply-To: <20230213071648.326123-1-ke1x.zhang@intel.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed 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 13/02/2023 07:16, Ke Zhang wrote: > The control thread accesses the hardware resources after the > resources were released, resulting in a segment error. > > This commit fixes the bug by exiting thread before resource released. > Please add the "Fixes: xyz" tag for the commit that introduced this bug so the fix can be backported to the appropriate stable branches. > Signed-off-by: Ke Zhang > --- > v2: add pthread_exit() for windows > --- > drivers/net/ice/ice_dcf.c | 4 ++++ > lib/eal/windows/include/pthread.h | 5 +++++ > 2 files changed, 9 insertions(+) > > diff --git a/drivers/net/ice/ice_dcf.c b/drivers/net/ice/ice_dcf.c > index 1c3d22ae0f..e58908caf5 100644 > --- a/drivers/net/ice/ice_dcf.c > +++ b/drivers/net/ice/ice_dcf.c > @@ -543,6 +543,8 @@ ice_dcf_handle_vsi_update_event(struct ice_dcf_hw *hw) > ice_dcf_disable_irq0(hw); > > for (;;) { > + if (hw->vc_event_msg_cb == NULL) > + pthread_exit(NULL); > if (ice_dcf_get_vf_resource(hw) == 0 && > ice_dcf_get_vf_vsi_map(hw) >= 0) { > err = 0; > @@ -760,6 +762,8 @@ ice_dcf_uninit_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw) > rte_intr_callback_unregister(intr_handle, > ice_dcf_dev_interrupt_handler, hw); > > + hw->vc_event_msg_cb = NULL; > + > ice_dcf_mode_disable(hw); > iavf_shutdown_adminq(&hw->avf); > > diff --git a/lib/eal/windows/include/pthread.h b/lib/eal/windows/include/pthread.h > index 27fd2cca52..f0068ebd73 100644 > --- a/lib/eal/windows/include/pthread.h > +++ b/lib/eal/windows/include/pthread.h > @@ -149,6 +149,11 @@ pthread_detach(__rte_unused pthread_t thread) > return 0; > } > > +static inline void > +pthread_exit(__rte_unused void *__retval) > +{ > +} > + > static inline int > pthread_join(__rte_unused pthread_t thread, > __rte_unused void **value_ptr)