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] [day] [month] [year] [list]
Date:	Mon, 14 Dec 2015 23:11:51 -0800
From:	Dan Williams <dan.j.williams@...el.com>
To:	"linux-nvdimm@...ts.01.org" <linux-nvdimm@...ts.01.org>
Cc:	Ross Zwisler <ross.zwisler@...ux.intel.com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 8/9] tools/testing/libnvdimm: cleanup mock resource lookup

On Mon, Dec 14, 2015 at 6:15 PM, Dan Williams <dan.j.williams@...el.com> wrote:
> Push the locking around get_nfit_res() into get_nfit_res().
>
> Signed-off-by: Dan Williams <dan.j.williams@...el.com>
> ---
>  tools/testing/nvdimm/test/iomap.c |   86 +++++++++++++++++--------------------
>  1 file changed, 39 insertions(+), 47 deletions(-)
>
> diff --git a/tools/testing/nvdimm/test/iomap.c b/tools/testing/nvdimm/test/iomap.c
> index 802d3a173ccf..d9c6c5af67e8 100644
> --- a/tools/testing/nvdimm/test/iomap.c
> +++ b/tools/testing/nvdimm/test/iomap.c
[..]
> @@ -83,55 +89,55 @@ EXPORT_SYMBOL(__wrap_devm_ioremap_nocache);
>  void *__wrap_devm_memremap(struct device *dev, resource_size_t offset,
>                 size_t size, unsigned long flags)
>  {
> -       struct nfit_test_resource *nfit_res;
> +       struct nfit_test_resource *nfit_res = get_nfit_res(offset);
>
> -       rcu_read_lock();
> -       nfit_res = get_nfit_res(offset);
> -       rcu_read_unlock();
>         if (nfit_res)
>                 return nfit_res->buf + offset - nfit_res->res->start;
>         return devm_memremap(dev, offset, size, flags);
>  }
>  EXPORT_SYMBOL(__wrap_devm_memremap);
>
> -void *__wrap_devm_memremap_pages(struct device *dev, struct resource *res)
> +#ifdef PFN_MAP
> +void *__wrap_devm_memremap_pages(struct device *dev, struct resource *res,
> +               struct percpu_ref *ref, struct vmem_altmap *altmap)
>  {
> -       struct nfit_test_resource *nfit_res;
>         resource_size_t offset = res->start;
> +       struct nfit_test_resource *nfit_res = get_nfit_res(offset);
>
> -       rcu_read_lock();
> -       nfit_res = get_nfit_res(offset);
> -       rcu_read_unlock();
>         if (nfit_res)
>                 return nfit_res->buf + offset - nfit_res->res->start;
> -       return devm_memremap_pages(dev, res);
> +       return devm_memremap_pages(dev, res, ref, altmap);
>  }
>  EXPORT_SYMBOL(__wrap_devm_memremap_pages);
>
> -#ifdef PFN_MAP
>  pfn_t __wrap_phys_to_pfn_t(dma_addr_t addr, unsigned long flags)
>  {
> -       struct nfit_test_resource *nfit_res;
> -
> -       rcu_read_lock();
> -       nfit_res = get_nfit_res(offset);
> -       rcu_read_unlock();
> +       struct nfit_test_resource *nfit_res = get_nfit_res(addr);
>
>         if (nfit_res)
>                 flags &= ~PFN_MAP;
> -        return phys_to_pfn_t(addr >> PAGE_SHIFT, flags);
> +        return phys_to_pfn_t(addr, flags);
>  }
>  EXPORT_SYMBOL(__wrap_phys_to_pfn_t);
> +#else
> +/* to be removed post 4.5-rc1 */
> +void *__wrap_devm_memremap_pages(struct device *dev, struct resource *res)
> +{
> +       resource_size_t offset = res->start;
> +       struct nfit_test_resource *nfit_res = get_nfit_res(offset);
> +
> +       if (nfit_res)
> +               return nfit_res->buf + offset - nfit_res->res->start;
> +       return devm_memremap_pages(dev, res);
> +}
> +EXPORT_SYMBOL(__wrap_devm_memremap_pages);
>  #endif

Whoops, the above hunk was meant to be folded into [PATCH 6/9]
libnvdimm, pfn: enable pfn sysfs interface unit testing
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ