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 BAAC2A0C44; Wed, 9 Jun 2021 01:04:05 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 988E2410F5; Wed, 9 Jun 2021 01:04:00 +0200 (CEST) Received: from mail-lj1-f182.google.com (mail-lj1-f182.google.com [209.85.208.182]) by mails.dpdk.org (Postfix) with ESMTP id 67438410F4 for ; Wed, 9 Jun 2021 01:03:59 +0200 (CEST) Received: by mail-lj1-f182.google.com with SMTP id bn21so29204346ljb.1 for ; Tue, 08 Jun 2021 16:03:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=F+R7ezqJN7Wo2w0p/sjnh0RRA1lZS6V5irNXrfsZ/Y4=; b=r9MZbZUJOOXlLVW6z+etEyYkuxjCD2OO5tgJcUBLJT3RgoWspEEWI0HhoxtruUdd4C wOflArFi9aZxZHw4E2raOeBLaxj/CbgtKTdCz5P+cjT9TLgqcxn3VXDwxr2EmB1k8Wmp 48q68TN6wCHdwJJLVHRJ4sa3Cc7Ft3MPldXs8CfqSBHSDiabdl1tCL3poXifpD7gHp09 5SPfnsbPTsWjgP1QOtpdjmPE8bvLlOF5HmDQtRNR+oCpR3aPAuLqNEtAJPxgE91mRzYP BjbCthQ8Y9PUs628HVT/2AKwva/n8M7QSOXobFemU+NT++y9qrbHx81XxYN6xA3FUHz+ rRzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=F+R7ezqJN7Wo2w0p/sjnh0RRA1lZS6V5irNXrfsZ/Y4=; b=d+ZTFN02jh23nkxyLW9XZbBUkiJoJdGj1te49dpXz0aAlm9utGMrKwkvlNaQxKzjvI 0lK7pBamvmW0hkitAfpr98IR23FzwyjFkZQDhdvdE+KPozy6VWnl+U2ATmDk+FLbOPMQ HlxKY9wynGcUjl8XnIf6vBePeZqQIi43LaUyPT1Tnr/FlALyiy31UKxG4zX27709tZe/ nRkfg7qY2VFCn2pAoZ23I2lmHoAQy6LfkB3KXMW6V23vrdKoYzE9Ql3GejWe3metavML hc30uUhFHh5WA7Mkf1jcRxwBUEUlY1PwE9I1zZ4vhsu0/WBGlzMhtFqX1aGTB14BPXoF midQ== X-Gm-Message-State: AOAM531jF3ZcbAhVXT4Zj8XpX/H49/nez5NQQS+qwgLvdkIvPaxc2y5v AiSt0luSuUgsD/L7pr/0YvI= X-Google-Smtp-Source: ABdhPJxE1QcfaLKD4XOYp/5t06E7DtDRBHF5YWLzuuIdaMj/OhzJAqYjBIqU+z6kh8fVeYVGQp5Mlg== X-Received: by 2002:a05:651c:1185:: with SMTP id w5mr19969383ljo.379.1623193439039; Tue, 08 Jun 2021 16:03:59 -0700 (PDT) Received: from sovereign (broadband-37-110-65-23.ip.moscow.rt.ru. [37.110.65.23]) by smtp.gmail.com with ESMTPSA id h24sm133457lfp.60.2021.06.08.16.03.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Jun 2021 16:03:58 -0700 (PDT) Date: Wed, 9 Jun 2021 02:03:57 +0300 From: Dmitry Kozlyuk To: Narcisa Ana Maria Vasile Cc: dev@dpdk.org, thomas@monjalon.net, khot@microsoft.com, navasile@microsoft.com, dmitrym@microsoft.com, roretzla@microsoft.com, talshn@nvidia.com, ocardona@microsoft.com, bruce.richardson@intel.com, david.marchand@redhat.com, pallavi.kadam@intel.com Message-ID: <20210609020357.2b31dfb4@sovereign> In-Reply-To: <1622850274-6946-5-git-send-email-navasile@linux.microsoft.com> References: <1622849908-5710-1-git-send-email-navasile@linux.microsoft.com> <1622850274-6946-1-git-send-email-navasile@linux.microsoft.com> <1622850274-6946-5-git-send-email-navasile@linux.microsoft.com> X-Mailer: Claws Mail 3.17.6 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v9 04/10] eal: implement functions for thread affinity management 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 Sender: "dev" 2021-06-04 16:44 (UTC-0700), Narcisa Ana Maria Vasile: [...] > diff --git a/lib/eal/windows/rte_thread.c b/lib/eal/windows/rte_thread.c > index 6ea1dc2a05..9e74a538c2 100644 > --- a/lib/eal/windows/rte_thread.c > +++ b/lib/eal/windows/rte_thread.c > @@ -7,7 +7,8 @@ > #include > #include > #include > -#include > + > +#include "eal_windows.h" > > struct eal_tls_key { > DWORD thread_index; > @@ -77,6 +78,130 @@ rte_thread_equal(rte_thread_t t1, rte_thread_t t2) > return t1.opaque_id == t2.opaque_id; > } > > +static int > +rte_convert_cpuset_to_affinity(const rte_cpuset_t *cpuset, > + PGROUP_AFFINITY affinity) > +{ > + int ret = 0; > + PGROUP_AFFINITY cpu_affinity = NULL; > + > + memset(affinity, 0, sizeof(GROUP_AFFINITY)); > + affinity->Group = (USHORT)-1; > + > + /* Check that all cpus of the set belong to the same processor group and > + * accumulate thread affinity to be applied. > + */ > + for (unsigned int cpu_idx = 0; cpu_idx < CPU_SETSIZE; cpu_idx++) { > + if (!CPU_ISSET(cpu_idx, cpuset)) > + continue; > + > + cpu_affinity = eal_get_cpu_affinity(cpu_idx); > + > + if (affinity->Group == (USHORT)-1) { > + affinity->Group = cpu_affinity->Group; > + } else if (affinity->Group != cpu_affinity->Group) { > + ret = EINVAL; > + goto cleanup; > + } > + > + affinity->Mask |= cpu_affinity->Mask; > + } > + > + if (affinity->Mask == 0) { > + ret = EINVAL; > + goto cleanup; > + } > + > +cleanup: > + return ret; > +} For v5 I asked a question that possibly got lost among other comments. Repeating the question for convenience: Just to be clear: is it a kernel limitation that a thread can only run on cores of one processor group, or do we impose it so that API is atomic (transactional), i.e. because one of multiple SetThreadGroupAffinity() calls may fail and leave thread partially affinitized?