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 300B6A0542; Wed, 5 Oct 2022 15:06:49 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CA38140694; Wed, 5 Oct 2022 15:06:48 +0200 (CEST) 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 B51FC40143 for ; Wed, 5 Oct 2022 15:06:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664975206; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hB3EwINV4/lnnMgsaO+yF/lAY1MV/JIkD2C+TrrR0ek=; b=Fsr3cEHs3sCxGu1FWTD6J93xHGhc4e43BTYFm9zfAf/Ou+reIhr5wC6ToHeqZrwwPqVEE5 ANZCI1p3eIHC+EKj7S7dT5aHj8jbXpaSCSxkXD//84BxGKlkZGabEnivFbfNiXvTKbhvi2 HFyiX+vpWH+pPMnBFrLqIrPLc6bQj3c= Received: from mail-pj1-f70.google.com (mail-pj1-f70.google.com [209.85.216.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-632-D2hKAfJTM0SwsAwSxfPNPw-1; Wed, 05 Oct 2022 09:06:44 -0400 X-MC-Unique: D2hKAfJTM0SwsAwSxfPNPw-1 Received: by mail-pj1-f70.google.com with SMTP id l23-20020a17090a071700b0020a8232ddb1so894744pjl.8 for ; Wed, 05 Oct 2022 06:06:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date; bh=hB3EwINV4/lnnMgsaO+yF/lAY1MV/JIkD2C+TrrR0ek=; b=VxwCRVASv23yNA1HF4c/4uMjVfTSGi0KCF2uaD5HYKnmtzGNBq9POoaoGk7ep4gP/V dfxPbeA2u8hMkBRCfciVHE7OGCLWti1DNoBcFJId7cGwDTE+LOd1AheaFSj8oOxfw4uC 9gTAGEjsvoRev2AOOUNDzI3Ag4OArg6M8V5ra/oGHnSteOWwfDZPqK7GUimq0jtbZRoy AaNZ0+uPBKuvzExoh58OuRpy24xsqdgZfa8cfYsL/wAPIiHWI1xiLh94gH7uhT2v1BaB UEzaOO4rKtEDOM+uVvgRZAIGf7n1BFtXRy9gbRs3Mfbv+paslhtFpJ+nnOcHW71eGHDl WEUg== X-Gm-Message-State: ACrzQf2AfdrHa1OVbwxtGgy9XnPG4SL3rjYYl+MBsvWSRF8Zxnq/qLwi 90uJU3IrB9UK/bKloTSqZgj/non0ZKbmCGA8m5GAmnkABZWb5iG/foE6I09LttJgxBqJTTk7AIM nihO0y1wyWl66PRtMhq0= X-Received: by 2002:a62:c584:0:b0:558:2095:e5ed with SMTP id j126-20020a62c584000000b005582095e5edmr32709555pfg.64.1664975203736; Wed, 05 Oct 2022 06:06:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7PHoqudFbK/JMq0LGkfFzgZWqVyQXzTGsDAwU5gVjq3D/Rl3AoKgdCktTLFfls0AxOT20FyX/nZwHHopzu8CU= X-Received: by 2002:a62:c584:0:b0:558:2095:e5ed with SMTP id j126-20020a62c584000000b005582095e5edmr32709531pfg.64.1664975203407; Wed, 05 Oct 2022 06:06:43 -0700 (PDT) MIME-Version: 1.0 References: <20220711105747.3295201-1-harry.van.haaren@intel.com> <20220711131825.3373195-1-harry.van.haaren@intel.com> <20220711131825.3373195-2-harry.van.haaren@intel.com> In-Reply-To: <20220711131825.3373195-2-harry.van.haaren@intel.com> From: David Marchand Date: Wed, 5 Oct 2022 15:06:31 +0200 Message-ID: Subject: Re: [PATCH v3 2/2] service: fix potential stats race-condition on MT services To: Harry van Haaren Cc: dev@dpdk.org, =?UTF-8?Q?Mattias_R=C3=B6nnblom?= , Honnappa Nagarahalli , =?UTF-8?Q?Morten_Br=C3=B8rup?= , Bruce Richardson X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 Mon, Jul 11, 2022 at 3:18 PM Harry van Haaren wrote: > > This commit fixes a potential racey-add that could occur if > multiple service-lcores were executing the same MT-safe service > at the same time, with service statistics collection enabled. > > Because multiple threads can run and execute the service, the > stats values can have multiple writer threads, resulting in the > requirement of using atomic addition for correctness. > > Note that when a MT unsafe service is executed, a spinlock is > held, so the stats increments are protected. This fact is used > to avoid executing atomic add instructions when not required. > Regular reads and increments are used, and only the store is > specified as atomic, reducing perf impact on e.g. x86 arch. > > This patch causes a 1.25x increase in cycle-cost for polling a > MT safe service when statistics are enabled. No change was seen > for MT unsafe services, or when statistics are disabled. Fixes: 21698354c832 ("service: introduce service cores concept") I did not mark for backport since the commitlog indicates a performance imp= act. You can still ask for backport by pinging LTS maintainers. > > Reported-by: Mattias R=C3=B6nnblom > Suggested-by: Honnappa Nagarahalli > Suggested-by: Morten Br=C3=B8rup > Suggested-by: Bruce Richardson > Signed-off-by: Harry van Haaren Series applied, thanks. --=20 David Marchand