Received: by 2002:a19:771d:0:0:0:0:0 with SMTP id s29csp1251004lfc; Wed, 1 Jun 2022 13:06:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJySY4W3G/HnFoOmUNiYKUEtjjbDnaCxDLoMfczkJ1v2s1jdO5lFLByj5GuStJfT/uASRtPW X-Received: by 2002:a05:6a00:1506:b0:518:bcdd:6a33 with SMTP id q6-20020a056a00150600b00518bcdd6a33mr1185650pfu.27.1654113971501; Wed, 01 Jun 2022 13:06:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654113971; cv=none; d=google.com; s=arc-20160816; b=q1/f+p4dHIVDyzAOXhGzvdJnIewP6a1+06ymneRXpMrarcorwRiGa4TqRmm1L3rGkx PJybLfy4rt0pzs0TfOyWlGiLc/rJ+bx1fTkFHpdrTeoYDVjroNNXe5GrJPD5AJl/39H2 SpBsstVxA7ln18MvMIOaOjD1db8YmpRk1cRXkgRx80Sf5YrTy94+YtC6WSjfdjR8owW7 XED1rELktVEyvemJ017iue3EBRSmotKMOqwOoHthAX54xhdwO3zjRtDQbGzugiy1tXzG 0DfpfNoefuQuaMkv42kcezb5j/aILlpFZA4NWZj455lwPFaN+5jGOfVnRWVPvs2UF2AX VCYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:reply-to:dkim-signature; bh=ZdJmymFf2YAiMmnGWERaLkVy5zEh8JzP2qaAQeVYdW8=; b=LDK54ye0zo+YAydu7yqajBOTcIex9CfKRG6iBYbYrx9l5V42uFeL9zUTR3ZDqeuwWX KGFD6ASdVvdCcxksDXz/SGxpiux16G90wJSShbHC69cZ759teTybSnmxaSc0V5wXD71i uj5MYc8PxkdO6TR4oqmpizKtkLL758yo/T8oCR09eMILwi3FQwa7bDESck3/S7w14tqj q4jtDcWk0EC4DMq2+62fF1l0Y+obKCmjo9vGo1jkfn+V0ZJqvJQ4TUCO91fApcE4PGsK rCwrePWeMuJ3v7esVWc1cUuc/HvB5jL6tMcVtvyqTP0RnSzFfboVPm1nFgnGtpw/XlZI oc0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=O1Qq7ZHb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id b11-20020a63d80b000000b003ab9d95852bsi3490595pgh.260.2022.06.01.13.06.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 13:06:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=O1Qq7ZHb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7F1C1C34; Wed, 1 Jun 2022 12:22:19 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237663AbiFADiz (ORCPT + 99 others); Tue, 31 May 2022 23:38:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231940AbiFADiw (ORCPT ); Tue, 31 May 2022 23:38:52 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 85B5456228 for ; Tue, 31 May 2022 20:38:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654054730; h=from:from:reply-to: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=ZdJmymFf2YAiMmnGWERaLkVy5zEh8JzP2qaAQeVYdW8=; b=O1Qq7ZHbWGN5oSgiontQZtiSX/VVYrSWLfSK76wlhJ/WKR4GjPqZQalM8ocJpkXTNELqk+ ahR0JtNGQd0EBsOo2dkGa5oZYfmo9MnoOwLbu9UnhzC7+jttzNfa6E/y+6BSRuHtkHPcpD vfgTPo47LDYaFYz+dGhVvmoRgr1hly8= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-641-q6fYUvoyNNaHwJnVxqBdUg-1; Tue, 31 May 2022 23:38:42 -0400 X-MC-Unique: q6fYUvoyNNaHwJnVxqBdUg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1A293803D5B; Wed, 1 Jun 2022 03:38:42 +0000 (UTC) Received: from [10.72.12.91] (ovpn-12-91.pek2.redhat.com [10.72.12.91]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B6C8140CF8ED; Wed, 1 Jun 2022 03:38:36 +0000 (UTC) Reply-To: Gavin Shan Subject: Re: [PATCH v3 11/16] arch_topology: Check for non-negative value rather than -1 for IDs validity To: Sudeep Holla , linux-kernel@vger.kernel.org Cc: Atish Patra , Atish Patra , Vincent Guittot , Morten Rasmussen , Dietmar Eggemann , Qing Wang , linux-arm-kernel@lists.infradead.org, linux-riscv@lists.infradead.org, Rob Herring , Andy Shevchenko References: <20220525081416.3306043-1-sudeep.holla@arm.com> <20220525081416.3306043-2-sudeep.holla@arm.com> <20220525081416.3306043-3-sudeep.holla@arm.com> <20220525081416.3306043-4-sudeep.holla@arm.com> <20220525081416.3306043-5-sudeep.holla@arm.com> <20220525081416.3306043-6-sudeep.holla@arm.com> <20220525081416.3306043-7-sudeep.holla@arm.com> <20220525081416.3306043-8-sudeep.holla@arm.com> <20220525081416.3306043-9-sudeep.holla@arm.com> <20220525081416.3306043-10-sudeep.holla@arm.com> <20220525081416.3306043-11-sudeep.holla@arm.com> <20220525081416.3306043-12-sudeep.holla@arm.com> From: Gavin Shan Message-ID: <59764f2b-60c8-3f0c-8159-3103f606494c@redhat.com> Date: Wed, 1 Jun 2022 11:38:33 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.0 MIME-Version: 1.0 In-Reply-To: <20220525081416.3306043-12-sudeep.holla@arm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/25/22 4:14 PM, Sudeep Holla wrote: > Instead of just comparing the cpu topology IDs with -1 to check their > validity, improve that by checking for a valid non-negative value. > > Suggested-by: Andy Shevchenko > Signed-off-by: Sudeep Holla > --- > drivers/base/arch_topology.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > Reviewed-by: Gavin Shan > diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c > index 59dc2c80c439..f73a5e669e42 100644 > --- a/drivers/base/arch_topology.c > +++ b/drivers/base/arch_topology.c > @@ -637,7 +637,7 @@ static int __init parse_dt_topology(void) > * only mark cores described in the DT as possible. > */ > for_each_possible_cpu(cpu) > - if (cpu_topology[cpu].package_id == -1) > + if (cpu_topology[cpu].package_id < 0) > ret = -EINVAL; > > out_map: > @@ -709,7 +709,7 @@ void update_siblings_masks(unsigned int cpuid) > if (cpuid_topo->cluster_id != cpu_topo->cluster_id) > continue; > > - if (cpuid_topo->cluster_id != -1) { > + if (cpuid_topo->cluster_id >= 0) { > cpumask_set_cpu(cpu, &cpuid_topo->cluster_sibling); > cpumask_set_cpu(cpuid, &cpu_topo->cluster_sibling); > } >