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: <1535665860.5995.78.camel@intel.com>
Date:   Thu, 30 Aug 2018 21:51:01 +0000
From:   "Verma, Vishal L" <vishal.l.verma@...el.com>
To:     "Williams, Dan J" <dan.j.williams@...el.com>,
        "ross.zwisler@...ux.intel.com" <ross.zwisler@...ux.intel.com>,
        "oceanhehy@...il.com" <oceanhehy@...il.com>,
        "Jiang, Dave" <dave.jiang@...el.com>
CC:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-nvdimm@...ts.01.org" <linux-nvdimm@...ts.01.org>,
        "hehy1@...ovo.com" <hehy1@...ovo.com>
Subject: Re: [PATCH] libnvdimm, region_devs: stop NDD_ALIASING bit test if
 one test pass


On Sun, 2018-08-19 at 00:01 -0400, Ocean He wrote:
> From: Ocean He <hehy1@...ovo.com>
> 
> There is no need to finish entire loop to execute NDD_ALIASING bit
> test
> against every nvdimm->flags. In practice, all the nd_mapping->nvdimm
> have the same flags.
> 
> Because the check of alias is "if (alias)" but not 
> "if (alias == nd_region->ndr_mappings)", there is no function change
> while
> just save a few cycles.  
> 
> Signed-off-by: Ocean He <hehy1@...ovo.com>
> ---
> A test to check if all the nd_mapping->nvdimm have the same flags,
> using 
> Lenovo ThinkSystem SR630 and 4.18-rc6.
> 
> # ipmctl show -dimm
> 
> DimmID  Capacity        HealthState     ActionRequired  LockState    
>    FWVersion
> 0x0021  125.7
> GiB       Healthy         0               Disabled        01.00.00.48
> 88
> 0x0121  125.7
> GiB       Healthy         0               Disabled        01.00.00.48
> 88
> 0x1021  125.7
> GiB       Healthy         0               Disabled        01.00.00.48
> 88
> 0x1121  125.7
> GiB       Healthy         0               Disabled        01.00.00.48
> 88
> 
> # ipmctl create -f -goal -socket 0x0 PersistentMemoryType=AppDirect
> 
> # ipmctl create -f -goal -socket 0x1 PersistentMemoryType=AppDirect
> 
> # reboot, to make goal configuration take effect.
> 
> # ndctl create-namespace -r region0 -s 100m -t pmem -m fsdax
> 
> # ndctl create-namespace -r region1 -s 100m -t pmem -m fsdax
> 
> # reboot and find all the nd_mapping->nvdimm have the same flags.
> 
>  drivers/nvdimm/region_devs.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/nvdimm/region_devs.c
> b/drivers/nvdimm/region_devs.c
> index ec3543b..fc3bc1c 100644
> --- a/drivers/nvdimm/region_devs.c
> +++ b/drivers/nvdimm/region_devs.c
> @@ -234,8 +234,10 @@ int nd_region_to_nstype(struct nd_region
> *nd_region)
>  			struct nd_mapping *nd_mapping = &nd_region-
> >mapping[i];
>  			struct nvdimm *nvdimm = nd_mapping->nvdimm;
>  
> -			if (test_bit(NDD_ALIASING, &nvdimm->flags))
> +			if (test_bit(NDD_ALIASING, &nvdimm->flags))
> {
>  				alias++;
> +				break;

I think we can go a step further, and instead of the 'break' followed
by a check for the 'alias' variable, in the loop, just return
ND_DEVICE_NAMESPACE_PMEM if the NDD_ALIASING bit is found for any
mapping. Outside the loop, simply return ND_DEVICE_NAMESPACE_IO. That
makes it much cleaner and now we can get rid of 'alias' entirely.

> +			}
>  		}
>  		if (alias)
>  			return ND_DEVICE_NAMESPACE_PMEM;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ