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 E5C4241EC3 for ; Fri, 17 Mar 2023 22:20:51 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E0C4342FD8; Fri, 17 Mar 2023 22:20:51 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id C901842F98; Fri, 17 Mar 2023 22:20:50 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id ECE3F2057676; Fri, 17 Mar 2023 14:20:49 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com ECE3F2057676 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1679088049; bh=m4f4jgErczVXYFr/mTrhr7YcZEbqEh+Kcepi3KDTpRY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=aK9ovXkNbgnQaRG5ZMEQVOMCvScIRITFP37tgFTQCfp6KdEXxvhbeX62mwhq6to4c nbRAyOFU21D0czo0X7U43Hg0XKzenO+HIkLGDe90tah5p9Xj65FWGP0/Y9MzKUcUSi 4YEgEn3ckfOFUEbe2yYMsOqt1PGUfzaB8tHiuqSk= Date: Fri, 17 Mar 2023 14:20:49 -0700 From: Tyler Retzlaff To: David Marchand Cc: dev@dpdk.org, thomas@monjalon.net, stephen@networkplumber.org, stable@dpdk.org, Dodji Seketeli Subject: Re: [PATCH v5 2/2] eal: fix failure path race setting new thread affinity Message-ID: <20230317212049.GA26815@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> References: <1677782682-27200-1-git-send-email-roretzla@linux.microsoft.com> <1678925224-2706-1-git-send-email-roretzla@linux.microsoft.com> <1678925224-2706-3-git-send-email-roretzla@linux.microsoft.com> <20230317144931.GA29683@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) 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 Fri, Mar 17, 2023 at 07:51:25PM +0100, David Marchand wrote: > On Fri, Mar 17, 2023 at 3:50 PM Tyler Retzlaff > wrote: > > > > -struct thread_routine_ctx { > > > > +struct thread_start_context { > > > > rte_thread_func thread_func; > > > > - void *routine_args; > > > > + void *thread_args; > > > > + const rte_thread_attr_t *thread_attr; > > > > + pthread_mutex_t wrapper_mutex; > > > > + pthread_cond_t wrapper_cond; > > > > + int wrapper_ret; > > > > + volatile int wrapper_done; > > > > > > One question. > > > > > > I see that wrapper_done is accessed under wrapper_mutex. > > > Is volatile needed? > > > > I'm not entirely certain. i'm being cautious since i can conceive of the > > load in the loop being optimized as a single load by the compiler. but > > again i'm not sure, i always like to learn if someone knows better. > > After an interesting discussion with Dodji on C99 and side effects > (5.1.2.3/2 and 5.1.2.3/3), I am a bit more convinced that we don't > need this volatile. Thanks for the references, based on the reading i agree we can drop the volatile. > > > > > > > > > > (nit: a boolean is probably enough too) > > > > I have no issue with it being a _Bool if you want to adjust it for that > > i certainly don't object. ordinarily i would use _Bool but a lot of dpdk > > code seems to prefer int so that's why i chose it. if we use the macro > > bool then we should include stdbool.h directly into this translation > > unit. > > > > > > > > I was thinking of squashing below diff: > > > > Yeah, no objection. you can decide if you want to keep the volatile or > > not and add the stdbool.h include. > > > > Thanks for reviewing, appreciate it. > > This is a fix but this v5 had an additional change in affinity setting > (switching to rte_thread_set_affinity()). > To be on the safe side wrt backport, I'll also revert to calling > rte_thread_set_affinity_by_id as this is what was being used before. > And this removes the need for patch 1. Is it worth merging the const patch but not backporting? I'm not fussed either way. > > Sending a v6 soon, so that it goes through the CI before rc3. Yes, great. Thanks David! > > > -- > David Marchand