lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <124DA88F-854D-41B0-9A3C-84AE37D4DD24@intel.com>
Date:   Tue, 19 Dec 2017 23:37:31 +0000
From:   "Dilger, Andreas" <andreas.dilger@...el.com>
To:     NeilBrown <neilb@...e.com>
CC:     "Drokin, Oleg" <oleg.drokin@...el.com>,
        James Simmons <jsimmons@...radead.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        lkml <linux-kernel@...r.kernel.org>,
        lustre <lustre-devel@...ts.lustre.org>
Subject: Re: [PATCH 2/2] staging: lustre: disable preempt while sampling
 processor id.

On Dec 18, 2017, at 16:01, NeilBrown <neilb@...e.com> wrote:
> 
> Calling smp_processor_id() without disabling preemption
> triggers a warning (if CONFIG_DEBUG_PREEMPT).
> I think the result of cfs_cpt_current() is only used as a hint for
> load balancing, rather than as a precise and stable indicator of
> the current CPU.  So it doesn't need to be called with
> preemption disabled.
> 
> So disable preemption inside cfs_cpt_current() to silence the warning.
> 
> Signed-off-by: NeilBrown <neilb@...e.com>

Reviewed-by: Andreas Dilger <andreas.dilger@...el.com>

> ---
> .../staging/lustre/lnet/libcfs/linux/linux-cpu.c   |   13 +++++++------
> 1 file changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c b/drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c
> index d30650f8dcb4..ca8518b8a3e0 100644
> --- a/drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c
> +++ b/drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c
> @@ -517,19 +517,20 @@ EXPORT_SYMBOL(cfs_cpt_spread_node);
> int
> cfs_cpt_current(struct cfs_cpt_table *cptab, int remap)
> {
> -	int cpu = smp_processor_id();
> -	int cpt = cptab->ctb_cpu2cpt[cpu];
> +	int cpu;
> +	int cpt;
> 
> -	if (cpt < 0) {
> -		if (!remap)
> -			return cpt;
> +	preempt_disable();
> +	cpu = smp_processor_id();
> +	cpt = cptab->ctb_cpu2cpt[cpu];
> 
> +	if (cpt < 0 && remap) {
> 		/* don't return negative value for safety of upper layer,
> 		 * instead we shadow the unknown cpu to a valid partition ID
> 		 */
> 		cpt = cpu % cptab->ctb_nparts;
> 	}
> -
> +	preempt_enable();
> 	return cpt;
> }
> EXPORT_SYMBOL(cfs_cpt_current);
> 
> 

Cheers, Andreas
--
Andreas Dilger
Lustre Principal Architect
Intel Corporation







Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ