Re: [PATCH v2 02/10] block: add helpers for accessing a bio_vec page

2015-05-08 Thread Dan Williams
On Wed, May 6, 2015 at 1:05 PM, Dan Williams  wrote:
> In preparation for converting struct bio_vec to carry a __pfn_t instead
> of struct page.
>
> This change is prompted by the desire to add in-kernel DMA support
> (O_DIRECT, hierarchical storage, RDMA, etc) for persistent memory which
> lacks struct page coverage.
>
> Alternatives:
>
> 1/ Provide struct page coverage for persistent memory in DRAM.  The
>expectation is that persistent memory capacities make this untenable
>in the long term.
>
> 2/ Provide struct page coverage for persistent memory with persistent
>memory.  While persistent memory may have near DRAM performance
>characteristics it may not have the same write-endurance of DRAM.
>Given the update frequency of struct page objects it may not be
>suitable for persistent memory.
>
> 3/ Dynamically allocate struct page.  This appears to be on the order
>of the complexity of converting code paths to use __pfn_t references
>instead of struct page, and the amount of setup required to establish
>a valid struct page reference is mostly wasted when the only usage in
>the block stack is to perform a page_to_pfn() conversion for
>dma-mapping.  Instances of kmap() / kmap_atomic() usage appear to be
>the only occasions in the block stack where struct page is
>non-trivially used.  A new kmap_atomic_pfn_t() is proposed to handle
>those cases.
>
> Generated with the following semantic patch:
>
> // bv_page.cocci: convert usage of ->bv_page to use set/get helpers
> // usage: make coccicheck COCCI=bv_page.cocci MODE=patch

Now that it looks like this patchset can move forward, what do about
this one?  Run the Coccinelle script late in the merge window to catch
all the new bv_page usages targeted for 4.2-rc1?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 02/10] block: add helpers for accessing a bio_vec page

2015-05-08 Thread Dan Williams
On Wed, May 6, 2015 at 1:05 PM, Dan Williams dan.j.willi...@intel.com wrote:
 In preparation for converting struct bio_vec to carry a __pfn_t instead
 of struct page.

 This change is prompted by the desire to add in-kernel DMA support
 (O_DIRECT, hierarchical storage, RDMA, etc) for persistent memory which
 lacks struct page coverage.

 Alternatives:

 1/ Provide struct page coverage for persistent memory in DRAM.  The
expectation is that persistent memory capacities make this untenable
in the long term.

 2/ Provide struct page coverage for persistent memory with persistent
memory.  While persistent memory may have near DRAM performance
characteristics it may not have the same write-endurance of DRAM.
Given the update frequency of struct page objects it may not be
suitable for persistent memory.

 3/ Dynamically allocate struct page.  This appears to be on the order
of the complexity of converting code paths to use __pfn_t references
instead of struct page, and the amount of setup required to establish
a valid struct page reference is mostly wasted when the only usage in
the block stack is to perform a page_to_pfn() conversion for
dma-mapping.  Instances of kmap() / kmap_atomic() usage appear to be
the only occasions in the block stack where struct page is
non-trivially used.  A new kmap_atomic_pfn_t() is proposed to handle
those cases.

 Generated with the following semantic patch:

 // bv_page.cocci: convert usage of -bv_page to use set/get helpers
 // usage: make coccicheck COCCI=bv_page.cocci MODE=patch

Now that it looks like this patchset can move forward, what do about
this one?  Run the Coccinelle script late in the merge window to catch
all the new bv_page usages targeted for 4.2-rc1?
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 02/10] block: add helpers for accessing a bio_vec page

2015-05-06 Thread Dan Williams
In preparation for converting struct bio_vec to carry a __pfn_t instead
of struct page.

This change is prompted by the desire to add in-kernel DMA support
(O_DIRECT, hierarchical storage, RDMA, etc) for persistent memory which
lacks struct page coverage.

Alternatives:

1/ Provide struct page coverage for persistent memory in DRAM.  The
   expectation is that persistent memory capacities make this untenable
   in the long term.

2/ Provide struct page coverage for persistent memory with persistent
   memory.  While persistent memory may have near DRAM performance
   characteristics it may not have the same write-endurance of DRAM.
   Given the update frequency of struct page objects it may not be
   suitable for persistent memory.

3/ Dynamically allocate struct page.  This appears to be on the order
   of the complexity of converting code paths to use __pfn_t references
   instead of struct page, and the amount of setup required to establish
   a valid struct page reference is mostly wasted when the only usage in
   the block stack is to perform a page_to_pfn() conversion for
   dma-mapping.  Instances of kmap() / kmap_atomic() usage appear to be
   the only occasions in the block stack where struct page is
   non-trivially used.  A new kmap_atomic_pfn_t() is proposed to handle
   those cases.

Generated with the following semantic patch:

// bv_page.cocci: convert usage of ->bv_page to use set/get helpers
// usage: make coccicheck COCCI=bv_page.cocci MODE=patch

virtual patch
virtual report
virtual org

@@
struct bio_vec bvec;
expression E;
type T;
@@

- bvec.bv_page = (T)E
+ bvec_set_page(, E)

@@
struct bio_vec *bvec;
expression E;
type T;
@@

- bvec->bv_page = (T)E
+ bvec_set_page(bvec, E)

@@
struct bio_vec bvec;
type T;
@@

- (T)bvec.bv_page
+ bvec_page()

@@
struct bio_vec *bvec;
type T;
@@

- (T)bvec->bv_page
+ bvec_page(bvec)

@@
struct bio *bio;
expression E;
expression F;
type T;
@@

- bio->bi_io_vec[F].bv_page = (T)E
+ bvec_set_page(>bi_io_vec[F], E)

@@
struct bio *bio;
expression E;
type T;
@@

- bio->bi_io_vec->bv_page = (T)E
+ bvec_set_page(bio->bi_io_vec, E)

@@
struct cached_dev *dc;
expression E;
type T;
@@

- dc->sb_bio.bi_io_vec->bv_page = (T)E
+ bvec_set_page(dc->sb_bio.bi_io_vec, E)

@@
struct cache *ca;
expression E;
expression F;
type T;
@@

- ca->sb_bio.bi_io_vec[F].bv_page = (T)E
+ bvec_set_page(>sb_bio.bi_io_vec[F], E)

@@
struct cache *ca;
expression F;
@@

- ca->sb_bio.bi_io_vec[F].bv_page
+ bvec_page(>sb_bio.bi_io_vec[F])

@@
struct cache *ca;
expression E;
expression F;
type T;
@@

- ca->sb_bio.bi_inline_vecs[F].bv_page = (T)E
+ bvec_set_page(>sb_bio.bi_inline_vecs[F], E)

@@
struct cache *ca;
expression F;
@@

- ca->sb_bio.bi_inline_vecs[F].bv_page
+ bvec_page(>sb_bio.bi_inline_vecs[F])


@@
struct cache *ca;
expression E;
type T;
@@

- ca->sb_bio.bi_io_vec->bv_page = (T)E
+ bvec_set_page(ca->sb_bio.bi_io_vec, E)

@@
struct bio *bio;
expression F;
@@

- bio->bi_io_vec[F].bv_page
+ bvec_page(>bi_io_vec[F])

@@
struct bio bio;
expression F;
@@

- bio.bi_io_vec[F].bv_page
+ bvec_page(_io_vec[F])

@@
struct bio *bio;
@@

- bio->bi_io_vec->bv_page
+ bvec_page(bio->bi_io_vec)

@@
struct cached_dev *dc;
@@

- dc->sb_bio.bi_io_vec->bv_page
+ bvec_page(>sb_bio->bi_io_vec)


@@
struct bio bio;
@@

- bio.bi_io_vec->bv_page
+ bvec_page(bio.bi_io_vec)

@@
struct bio_integrity_payload *bip;
expression E;
type T;
@@

- bip->bip_vec->bv_page = (T)E
+ bvec_set_page(bip->bip_vec, E)

@@
struct bio_integrity_payload *bip;
@@

- bip->bip_vec->bv_page
+ bvec_page(bip->bip_vec)

@@
struct bio_integrity_payload bip;
@@

- bip.bip_vec->bv_page
+ bvec_page(bip.bip_vec)

Cc: Jens Axboe 
Cc: Matthew Wilcox 
Cc: Ross Zwisler 
Cc: Neil Brown 
Cc: Alasdair Kergon 
Cc: Mike Snitzer 
Cc: Chris Mason 
Cc: Boaz Harrosh 
Cc: Theodore Ts'o 
Cc: Jan Kara 
Cc: Julia Lawall 
Cc: Martin K. Petersen 
Signed-off-by: Dan Williams 
---
 arch/powerpc/sysdev/axonram.c   |2 +
 block/bio-integrity.c   |8 ++--
 block/bio.c |   40 +++---
 block/blk-core.c|4 +-
 block/blk-integrity.c   |3 +-
 block/blk-lib.c |2 +
 block/blk-merge.c   |7 ++--
 block/bounce.c  |   24 ++---
 drivers/block/aoe/aoecmd.c  |8 ++--
 drivers/block/brd.c |2 +
 drivers/block/drbd/drbd_bitmap.c|5 ++-
 drivers/block/drbd/drbd_main.c  |6 ++-
 drivers/block/drbd/drbd_receiver.c  |4 +-
 drivers/block/drbd/drbd_worker.c|3 +-
 drivers/block/floppy.c  |6 ++-
 drivers/block/loop.c|   13 ---
 drivers/block/nbd.c |8 ++--
 drivers/block/nvme-core.c   |2 +
 drivers/block/pktcdvd.c |   11 +++---
 

[PATCH v2 02/10] block: add helpers for accessing a bio_vec page

2015-05-06 Thread Dan Williams
In preparation for converting struct bio_vec to carry a __pfn_t instead
of struct page.

This change is prompted by the desire to add in-kernel DMA support
(O_DIRECT, hierarchical storage, RDMA, etc) for persistent memory which
lacks struct page coverage.

Alternatives:

1/ Provide struct page coverage for persistent memory in DRAM.  The
   expectation is that persistent memory capacities make this untenable
   in the long term.

2/ Provide struct page coverage for persistent memory with persistent
   memory.  While persistent memory may have near DRAM performance
   characteristics it may not have the same write-endurance of DRAM.
   Given the update frequency of struct page objects it may not be
   suitable for persistent memory.

3/ Dynamically allocate struct page.  This appears to be on the order
   of the complexity of converting code paths to use __pfn_t references
   instead of struct page, and the amount of setup required to establish
   a valid struct page reference is mostly wasted when the only usage in
   the block stack is to perform a page_to_pfn() conversion for
   dma-mapping.  Instances of kmap() / kmap_atomic() usage appear to be
   the only occasions in the block stack where struct page is
   non-trivially used.  A new kmap_atomic_pfn_t() is proposed to handle
   those cases.

Generated with the following semantic patch:

// bv_page.cocci: convert usage of -bv_page to use set/get helpers
// usage: make coccicheck COCCI=bv_page.cocci MODE=patch

virtual patch
virtual report
virtual org

@@
struct bio_vec bvec;
expression E;
type T;
@@

- bvec.bv_page = (T)E
+ bvec_set_page(bvec, E)

@@
struct bio_vec *bvec;
expression E;
type T;
@@

- bvec-bv_page = (T)E
+ bvec_set_page(bvec, E)

@@
struct bio_vec bvec;
type T;
@@

- (T)bvec.bv_page
+ bvec_page(bvec)

@@
struct bio_vec *bvec;
type T;
@@

- (T)bvec-bv_page
+ bvec_page(bvec)

@@
struct bio *bio;
expression E;
expression F;
type T;
@@

- bio-bi_io_vec[F].bv_page = (T)E
+ bvec_set_page(bio-bi_io_vec[F], E)

@@
struct bio *bio;
expression E;
type T;
@@

- bio-bi_io_vec-bv_page = (T)E
+ bvec_set_page(bio-bi_io_vec, E)

@@
struct cached_dev *dc;
expression E;
type T;
@@

- dc-sb_bio.bi_io_vec-bv_page = (T)E
+ bvec_set_page(dc-sb_bio.bi_io_vec, E)

@@
struct cache *ca;
expression E;
expression F;
type T;
@@

- ca-sb_bio.bi_io_vec[F].bv_page = (T)E
+ bvec_set_page(ca-sb_bio.bi_io_vec[F], E)

@@
struct cache *ca;
expression F;
@@

- ca-sb_bio.bi_io_vec[F].bv_page
+ bvec_page(ca-sb_bio.bi_io_vec[F])

@@
struct cache *ca;
expression E;
expression F;
type T;
@@

- ca-sb_bio.bi_inline_vecs[F].bv_page = (T)E
+ bvec_set_page(ca-sb_bio.bi_inline_vecs[F], E)

@@
struct cache *ca;
expression F;
@@

- ca-sb_bio.bi_inline_vecs[F].bv_page
+ bvec_page(ca-sb_bio.bi_inline_vecs[F])


@@
struct cache *ca;
expression E;
type T;
@@

- ca-sb_bio.bi_io_vec-bv_page = (T)E
+ bvec_set_page(ca-sb_bio.bi_io_vec, E)

@@
struct bio *bio;
expression F;
@@

- bio-bi_io_vec[F].bv_page
+ bvec_page(bio-bi_io_vec[F])

@@
struct bio bio;
expression F;
@@

- bio.bi_io_vec[F].bv_page
+ bvec_page(bio.bi_io_vec[F])

@@
struct bio *bio;
@@

- bio-bi_io_vec-bv_page
+ bvec_page(bio-bi_io_vec)

@@
struct cached_dev *dc;
@@

- dc-sb_bio.bi_io_vec-bv_page
+ bvec_page(dc-sb_bio-bi_io_vec)


@@
struct bio bio;
@@

- bio.bi_io_vec-bv_page
+ bvec_page(bio.bi_io_vec)

@@
struct bio_integrity_payload *bip;
expression E;
type T;
@@

- bip-bip_vec-bv_page = (T)E
+ bvec_set_page(bip-bip_vec, E)

@@
struct bio_integrity_payload *bip;
@@

- bip-bip_vec-bv_page
+ bvec_page(bip-bip_vec)

@@
struct bio_integrity_payload bip;
@@

- bip.bip_vec-bv_page
+ bvec_page(bip.bip_vec)

Cc: Jens Axboe ax...@kernel.dk
Cc: Matthew Wilcox wi...@linux.intel.com
Cc: Ross Zwisler ross.zwis...@linux.intel.com
Cc: Neil Brown ne...@suse.de
Cc: Alasdair Kergon a...@redhat.com
Cc: Mike Snitzer snit...@redhat.com
Cc: Chris Mason c...@fb.com
Cc: Boaz Harrosh b...@plexistor.com
Cc: Theodore Ts'o ty...@mit.edu
Cc: Jan Kara j...@suse.cz
Cc: Julia Lawall julia.law...@lip6.fr
Cc: Martin K. Petersen martin.peter...@oracle.com
Signed-off-by: Dan Williams dan.j.willi...@intel.com
---
 arch/powerpc/sysdev/axonram.c   |2 +
 block/bio-integrity.c   |8 ++--
 block/bio.c |   40 +++---
 block/blk-core.c|4 +-
 block/blk-integrity.c   |3 +-
 block/blk-lib.c |2 +
 block/blk-merge.c   |7 ++--
 block/bounce.c  |   24 ++---
 drivers/block/aoe/aoecmd.c  |8 ++--
 drivers/block/brd.c |2 +
 drivers/block/drbd/drbd_bitmap.c|5 ++-
 drivers/block/drbd/drbd_main.c  |6 ++-
 drivers/block/drbd/drbd_receiver.c  |4 +-
 drivers/block/drbd/drbd_worker.c|3 +-
 drivers/block/floppy.c  |6 ++-