public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] xfs: avoid IO issues unaligned memory allocation
@ 2019-08-21  8:38 Dave Chinner
  2019-08-21  8:38 ` [PATCH 1/3] xfs: add kmem allocation trace points Dave Chinner
                   ` (2 more replies)
  0 siblings, 3 replies; 46+ messages in thread
From: Dave Chinner @ 2019-08-21  8:38 UTC (permalink / raw)
  To: linux-xfs

Hi folks,

These patches fix the issue reported by Vishal on 5.3-rc1 with pmem,
reproduced on brd, and previously seen with xenblk.

The core issue is that when memory allocation debugging is turned
on, heap memory is no longer naturally aligned and that means
we attach memory with large memory regions with random alignment to
bios. Some block drivers only support 512 byte aligned memory
buffers, and these then silently break when fed an unaligned
buffers.

This happens silently because nothing in the block or driver layers
actually validates that memory buffers containing kernel memory
are correctly aligned. Buffers may be bounced in the drivers if
they are unaligned, but not all driver support this, hence the
breakage.

This patchset added memory allocation tracing, 512 byte aligned
allocation support via kmem_alloc_io(), and a re-implementation of
bio_add_page() to add memory buffer alignment verification. The last
patch causes unaligned allocations to fail fast, noisily and safely,
such that any developer running KASAN will immediately notice if
XFS attaches an unaligned mmemory buffer to a bio....

Cheers,

Dave.



^ permalink raw reply	[flat|nested] 46+ messages in thread
* [PATCH v2] xfs: use aligned buffers for IO
@ 2019-08-26  1:40 Dave Chinner
  2019-08-26  1:40 ` [PATCH 1/3] xfs: add kmem allocation trace points Dave Chinner
  0 siblings, 1 reply; 46+ messages in thread
From: Dave Chinner @ 2019-08-26  1:40 UTC (permalink / raw)
  To: linux-xfs

Hi folks,

This is an updated version of the patchset originally posted here:

https://lore.kernel.org/linux-xfs/20190821083820.11725-1-david@fromorbit.com/T/#t

It intends to avoid th eproblems of IO being silently corrupted
by drivers when kernel memory debugging options are turned on due
to changes in heap allocated object alignment. Full description is
in the link above.

Changes in V2
- dropped xfs_add_bio_page() validation wrapper. Contentious,
  Christoph will look to adding it into the generic block layer
  code.
- added xfs_buftarg_dma_alignment() to grab the alignment from the
  current device we are allocating a buffer for.
- feed the correct alignment for the underlying device into
  kmem_alloc_io() to minimise the occurrence of failed alignment for
  devices that support fine-grained alignment.
- kmem_alloc_io() supports alignment up to page size and will warn if
  any alignment greater than a page is requested. Devices that
  require larger than page alignment should not exist.

Cheers,

Dave.



^ permalink raw reply	[flat|nested] 46+ messages in thread

end of thread, other threads:[~2019-08-26 12:21 UTC | newest]

Thread overview: 46+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-21  8:38 [PATCH 0/3] xfs: avoid IO issues unaligned memory allocation Dave Chinner
2019-08-21  8:38 ` [PATCH 1/3] xfs: add kmem allocation trace points Dave Chinner
2019-08-21 13:34   ` Brian Foster
2019-08-21 23:20   ` Christoph Hellwig
2019-08-21  8:38 ` [PATCH 2/3] xfs: add kmem_alloc_io() Dave Chinner
2019-08-21 13:35   ` Brian Foster
2019-08-21 15:08     ` Darrick J. Wong
2019-08-21 21:24       ` Dave Chinner
2019-08-21 15:23     ` Eric Sandeen
2019-08-21 21:14     ` Dave Chinner
2019-08-22 13:40       ` Brian Foster
2019-08-22 22:39         ` Dave Chinner
2019-08-23 12:10           ` Brian Foster
2019-08-21 23:24   ` Christoph Hellwig
2019-08-22  0:31     ` Dave Chinner
2019-08-22  7:59       ` Christoph Hellwig
2019-08-22  8:51         ` Peter Zijlstra
2019-08-22  9:10           ` Peter Zijlstra
2019-08-22 10:14             ` Dave Chinner
2019-08-22 11:14               ` Vlastimil Babka
2019-08-22 12:07                 ` Dave Chinner
2019-08-22 12:19                   ` Vlastimil Babka
2019-08-22 13:17                     ` Dave Chinner
2019-08-22 14:26                       ` Vlastimil Babka
2019-08-26 12:21                         ` Michal Hocko
2019-08-21  8:38 ` [PATCH 3/3] xfs: alignment check bio buffers Dave Chinner
2019-08-21 13:39   ` Brian Foster
2019-08-21 21:39     ` Dave Chinner
2019-08-22 13:47       ` Brian Foster
2019-08-22 23:03         ` Dave Chinner
2019-08-23 12:33           ` Brian Foster
2019-08-21 23:30     ` Christoph Hellwig
2019-08-22  0:44       ` Dave Chinner
2019-08-21 23:29   ` Christoph Hellwig
2019-08-22  0:37     ` Dave Chinner
2019-08-22  8:03       ` Christoph Hellwig
2019-08-22 10:17         ` Dave Chinner
2019-08-22  2:50     ` Ming Lei
2019-08-22  4:49       ` Dave Chinner
2019-08-22  7:23         ` Ming Lei
2019-08-22  8:08         ` Christoph Hellwig
2019-08-22 10:20           ` Ming Lei
2019-08-23  0:14             ` Christoph Hellwig
2019-08-23  1:19               ` Ming Lei
  -- strict thread matches above, loose matches on Subject: below --
2019-08-26  1:40 [PATCH v2] xfs: use aligned buffers for IO Dave Chinner
2019-08-26  1:40 ` [PATCH 1/3] xfs: add kmem allocation trace points Dave Chinner
2019-08-26  7:47   ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox