From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.0 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_2 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55F58C4743F for ; Tue, 8 Jun 2021 23:04:12 +0000 (UTC) Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by mail.kernel.org (Postfix) with ESMTP id EEF7E6135D for ; Tue, 8 Jun 2021 23:04:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EEF7E6135D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dev-bounces@dpdk.org Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C3EF3410FB; Wed, 9 Jun 2021 01:04:04 +0200 (CEST) Received: from mail-lj1-f170.google.com (mail-lj1-f170.google.com [209.85.208.170]) by mails.dpdk.org (Postfix) with ESMTP id BA86A410FB for ; Wed, 9 Jun 2021 01:04:03 +0200 (CEST) Received: by mail-lj1-f170.google.com with SMTP id s22so8759664ljg.5 for ; Tue, 08 Jun 2021 16:04:03 -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=jr1hTjIt6HzjwIIgKKxdh/FDIIPxTsmS7qoCUD3pYFk=; b=jR4LLJjqIzw/3XBa9RUzbwtu0B27auBrLj6F+4CMi+VXtPPopBfTUTieKDBiXrRCZB SNzuEjelg0GJBVBYeQRvjftjuPLyrnbcP72VUvDCPHmhY8soe8pxgKlJPECuUP1IHB/k H/9fdeuFYamBE/2gwUh8os4hxhT60AEKMqdlEyUQEofBprD723Z1nosDrwr//qItQhHC lbZwV+Vds+YjTuc7alMZYmRNeTFul61Jj7QlmK79+sndHbJQH7GQ0/VkAa9y4jZlG+tB tgoLlLfr+Ab5g0PWPhVYSUkLFZjYZl0cIaKOsblndnnzoSAaw13k0BvISAptOsyEpFRf 6RNQ== 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=jr1hTjIt6HzjwIIgKKxdh/FDIIPxTsmS7qoCUD3pYFk=; b=PLpqLG3l/6I2TCMoTHOHGv5Oxk8n9Voa06wsgWH2W3SDDbxxAS0S/2sanUsrKjEp25 MJOP2kW4Dge9UM+TaPBgGslmuYPJvfDFfakcVstIghsNWevX4A60ugFOu6DkLNSy3awm H35EKUxviSbVF++A++oPS1xnhZrH6ywwtZe2Qplu5JryP6qukd7CEpyvkd2kppURI6Ti 3Ujb/iecJDOoOOlBXynskJEvQvhFPeCqLdr9+1o2AAHktQp0GYoUsWQmtfy8sLtpwhYw h6o8FZLWGWUmUNa4dQY19SIWhEgkgQaAi8T6XPzRlR6fwepaFFo8REvN2chNwsoE4w4k 8Q0w== X-Gm-Message-State: AOAM533+4p9U3jDwkO274GIlTIlt6DHF+39CIcTfd8/vr3bPnGTq5t86 r6BDPygz1Nkuj2dhSKjyqZE= X-Google-Smtp-Source: ABdhPJwAPzrZWrcZ9OxqGuLvjbFT/7gvbUR44hgHEt/hiNsmGNDE5PszUbvvuLhOWCrpHRfAK3pJ/w== X-Received: by 2002:a05:651c:1311:: with SMTP id u17mr19778412lja.48.1623193443281; Tue, 08 Jun 2021 16:04:03 -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 m3sm120792lfg.241.2021.06.08.16.04.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Jun 2021 16:04:02 -0700 (PDT) Date: Wed, 9 Jun 2021 02:04:01 +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: <20210609020401.32de8fce@sovereign> In-Reply-To: <1622849908-5710-5-git-send-email-navasile@linux.microsoft.com> References: <1622580952-25169-1-git-send-email-navasile@linux.microsoft.com> <1622849908-5710-1-git-send-email-navasile@linux.microsoft.com> <1622849908-5710-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 v8 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:38 (UTC-0700), Narcisa Ana Maria Vasile: [...] > +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; > + } For v5 I asked a question that possibly got lost among other comments. Repeating it here 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?