Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp1667497rdb; Sat, 3 Feb 2024 17:30:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IHOfVdpxhb2xlqF6SDJZSTXhuqoYIC9mDw1FZMHUQP9WiV+0+QAbd87JHrnCHFnaF1wc0wd X-Received: by 2002:a05:6808:2f05:b0:3bf:ce96:ff06 with SMTP id gu5-20020a0568082f0500b003bfce96ff06mr3200911oib.25.1707010222330; Sat, 03 Feb 2024 17:30:22 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707010222; cv=pass; d=google.com; s=arc-20160816; b=aIeFeoIW8izfId5yCT9BUnx5OZJEH+GvkJRR39rfoTDpxxfr11wv4GPb2lJRpXb6SR UwvHJfQM5dj3QnnuLeQ7QVa1zVJinadt247p1ZIL0Yy66Vv5KPYwcXLTCyGJVuvlVH7F xSnlUmQHSqhDwluR1IBCZ8e6HpU1PXmxT+/Lk8QdchJ7JYLvEe9EXC6rw8TcMNL3fj2t yaW4Q1/3Q0GVMcqh+6hYSyMTOvkL2lkK8NfYOB8bCUypeyOW7tfrWt7O2bOkV3ANZomG wlCiPq8OOp0fza+1edvwAU36jncvS3nr0KRi3PWzQcRUyTo0hWCUVOQN6wJ2AuGFAZz6 7KrQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:message-id:date:references:in-reply-to:subject:cc:to :from:dkim-signature; bh=vSP40m4qKj6iM73AfXeK1YdeVeoBTlnGdsxWo02Fbwg=; fh=ydpGi1jkHBMtlViH+/iT1rmB4CH7NdLA0iMEg6d35u0=; b=aSrIk6XqPAlNJWbwl9/lpTHJq/sJe3uFmIE/q48ASE/TpM4sQAvviU+D8K1qFp2R8V LoZyeIAD5gD/vqngiTW43yLIbJdf9wUleMhZKbfsuTgz2D8cwNl8mft8hrON42HqC/B3 ornh9oIzJH2dc50Hji6N7mjvn30npSlufDlBOtaVyPgDp6MOq6lcBsknyUycsFS1UZ6i n7rgRYvzejIa+8a4/W5KVgWHRjnSl2cUfTUtb2smdOOz8HxVWevmBom7vrn61jGwuhYz aFweAyTBg3xDSmI57VbaVhg+/lFyJzX1t1zekh2KC0vNBSsk0vJ0J0tjgYRM9wvRc8n1 vaEA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=fX5K+xx8; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-51365-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51365-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=1; AJvYcCWrMTYQMEezJpQnOHM9VEGsBCvEj9u3rWmQYhFX/99PcT7gD+LvGl3AyrUcsq5DXQY9aN0+9QRD2ffy1nfsFVlppV8+5VypS1NwfyB1Nw== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id c12-20020a05622a024c00b0042c18b71fabsi1365093qtx.713.2024.02.03.17.30.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Feb 2024 17:30:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-51365-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=fX5K+xx8; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-51365-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51365-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 6F84A1C22CE8 for ; Sun, 4 Feb 2024 01:30:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 267EB1385; Sun, 4 Feb 2024 01:30:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="fX5K+xx8" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3F64CEDC for ; Sun, 4 Feb 2024 01:30:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.15 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707010209; cv=none; b=WhwWraZ8rwResbpi2wI6c7+axhjYtgIjjt9xN+p0gKyIXh6QMywGL3d5Yb5mObTKyvr5Slnh4CdiEWNWqbnPUlVXNVejJZWjaUX7BjjmLqX8N7mSzgUVSKrwg8EFd5KvpAErXflnXpeziJ54kZwb77Zvn0LyHnso4vwNSjvIhaM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707010209; c=relaxed/simple; bh=3JVEZJWbJzYZmG+Q8G50nJcI6E/VXWktEo2IRFBK2Go=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=AROsy1XmmdgP5OIOtPTGvWfwU1FigZvDwKaLc033opv2vY2wdkPcb6JjBnH/x1qiBCjUVfisUFCFYEQtUeRwkKzWErHPcy4pV2ugiTTvySPInQFshvwBl4PmJkG65BZXdRknrxUvZi+Jx3+7M8Ju4Zb7j9zK1aXhfmuoWF48DcA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=fX5K+xx8; arc=none smtp.client-ip=192.198.163.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1707010207; x=1738546207; h=from:to:cc:subject:in-reply-to:references:date: message-id:mime-version; bh=3JVEZJWbJzYZmG+Q8G50nJcI6E/VXWktEo2IRFBK2Go=; b=fX5K+xx80OW2SiNBdb9yDB9kfuTVb6jXhnfC8oAfyCYPIEplAudvRoxT eKopFZC47mhTtOb998G4z4gChcnfqjLIGWIDkXDkQjo1qtz4qJlvI/kSM unYcq+eCgrh3tfOWAv0DWRxzW9Cg71x7L+YD2liFU2LB7+3NRzXl6YJg4 PC9R+/rGAqn7oEG/FsSgdYAcS6ZtG+gNyq44sX2sS6pG2gXjQwqw1l2oH hoyAtSY5Hu/L+8Ep7EG2jfrjuFRu9jakzX7EbpbQdm5rrjQwc++p9bjJd zuo+HMAM4pWzavPj0hdLj9OSb9q+8MP0So3w3P4ElgqF9nTfM7kFQH8TN g==; X-IronPort-AV: E=McAfee;i="6600,9927,10973"; a="513781" X-IronPort-AV: E=Sophos;i="6.05,241,1701158400"; d="scan'208";a="513781" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Feb 2024 17:30:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10973"; a="908950588" X-IronPort-AV: E=Sophos;i="6.05,241,1701158400"; d="scan'208";a="908950588" Received: from yhuang6-desk2.sh.intel.com (HELO yhuang6-desk2.ccr.corp.intel.com) ([10.238.208.55]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Feb 2024 17:30:02 -0800 From: "Huang, Ying" To: Valentin Schneider Cc: Pierre Gondois , linux-kernel@vger.kernel.org, Shrikanth Hegde , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira Subject: Re: [PATCH v2 1/3] sched/topology: Annotate RCU pointers properly In-Reply-To: (Valentin Schneider's message of "Fri, 02 Feb 2024 18:35:35 +0100") References: <20240115143427.1820628-1-pierre.gondois@arm.com> <20240115143427.1820628-2-pierre.gondois@arm.com> <8734uy137o.fsf@yhuang6-desk2.ccr.corp.intel.com> Date: Sun, 04 Feb 2024 09:28:06 +0800 Message-ID: <87il359fx5.fsf@yhuang6-desk2.ccr.corp.intel.com> User-Agent: Gnus/5.13 (Gnus v5.13) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ascii Valentin Schneider writes: > On 16/01/24 09:23, Huang, Ying wrote: >> Pierre Gondois writes: >> >>> Cleanup RCU-related spare errors by annotating RCU pointers. >>> >>> sched_domains_numa_distance: >>> error: incompatible types in comparison expression >>> (different address spaces): >>> int [noderef] __rcu * >>> int * >>> >>> sched_domains_numa_masks: >>> error: incompatible types in comparison expression >>> (different address spaces): >>> struct cpumask **[noderef] __rcu * >>> struct cpumask *** >>> >>> The cast to (void *) adds the following sparse warning: >>> warning: cast removes address space '__rcu' of expression >>> but this should be normal. >>> >>> Fixes: 0fb3978b0aac ("sched/numa: Fix NUMA topology for systems with CPU-less nodes") >>> Signed-off-by: Pierre Gondois >>> --- >>> kernel/sched/topology.c | 12 ++++++------ >>> 1 file changed, 6 insertions(+), 6 deletions(-) >>> >>> diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c >>> index 10d1391e7416..2a2da9b33e31 100644 >>> --- a/kernel/sched/topology.c >>> +++ b/kernel/sched/topology.c >>> @@ -1542,8 +1542,8 @@ static int sched_domains_numa_levels; >>> static int sched_domains_curr_level; >>> >>> int sched_max_numa_distance; >>> -static int *sched_domains_numa_distance; >>> -static struct cpumask ***sched_domains_numa_masks; >>> +static int __rcu *sched_domains_numa_distance; >>> +static struct cpumask ** __rcu *sched_domains_numa_masks; >>> #endif >>> >>> /* >>> @@ -1988,8 +1988,8 @@ void sched_init_numa(int offline_node) >>> >>> static void sched_reset_numa(void) >>> { >>> - int nr_levels, *distances; >>> - struct cpumask ***masks; >>> + int nr_levels, __rcu *distances; >>> + struct cpumask ** __rcu *masks; >> >> No. distances and masks are not accessed via RCU in the function. >> Instead, they should be assigned like below, >> >> distances = rcu_dereference_raw(sched_domains_numa_distance); >> >> Because sched_domains_numa_distance is protected by cpu_hotplug_lock, >> but the lock is static. Some comments are deserved. >> >> Anyway, please read RCU document before making the change. >> > > IIUC, something like so could also do? > > distances = rcu_dereference_check(sched_domains_numa_distance, lockdep_is_cpus_held()); Yes. You are right. We should do that. -- Best Regards, Huang, Ying