Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1678351
| From | Andrew Morton <akpm@linux-foundation.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] cma: fix calculation of aligned offset |
| Date | 2017-06-30 02:50 +0200 |
| Message-ID | <tXSie-6BV-29@gated-at.bofh.it> (permalink) |
| References | <tXpq2-t5-155@gated-at.bofh.it> <tXOxX-46p-5@gated-at.bofh.it> <tXSie-6BV-31@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Thu, 29 Jun 2017 17:43:18 -0700 Doug Berger <opendmb@gmail.com> wrote:
> On 06/29/2017 01:48 PM, Andrew Morton wrote:
> > On Wed, 28 Jun 2017 10:07:41 -0700 Doug Berger <opendmb@gmail.com> wrote:
> >
> >> The align_offset parameter is used by bitmap_find_next_zero_area_off()
> >> to represent the offset of map's base from the previous alignment
> >> boundary; the function ensures that the returned index, plus the
> >> align_offset, honors the specified align_mask.
> >>
> >> The logic introduced by commit b5be83e308f7 ("mm: cma: align to
> >> physical address, not CMA region position") has the cma driver
> >> calculate the offset to the *next* alignment boundary. In most cases,
> >> the base alignment is greater than that specified when making
> >> allocations, resulting in a zero offset whether we align up or down.
> >> In the example given with the commit, the base alignment (8MB) was
> >> half the requested alignment (16MB) so the math also happened to work
> >> since the offset is 8MB in both directions. However, when requesting
> >> allocations with an alignment greater than twice that of the base,
> >> the returned index would not be correctly aligned.
> >>
> >> Also, the align_order arguments of cma_bitmap_aligned_mask() and
> >> cma_bitmap_aligned_offset() should not be negative so the argument
> >> type was made unsigned.
> >
> > The changelog doesn't describe the user-visible effects of the bug. It
> > should do so please, so that others can decide which kernel(s) need the fix.
> >
> > Since the bug has been there for three years, I'll assume that -stable
> > backporting is not needed.
> >
> I'm afraid I'm confused by what you are asking me to do since it appears
> that you have already signed-off on this patch.
>
> The direct user-visible effect of the bug is that if the user requests a
> CMA allocation that is aligned with a granule that is more than twice
> the base alignment of the CMA region she will receive an allocation that
> does not have that alignment.
>
> As I indicated to Gregory, the follow-on consequences of the address not
> satisfying the required alignment depend on why the alignment was
> requested. In our case it was a system crash, but it could also
> manifest as data corruption on a network interface for example.
>
> In general I would expect it to be unusual for anyone to request an
> allocation alignment that is larger than the CMA base alignment which is
> probably why the bug has been hiding for three years.
>
OK, it sounds like it isn't very critical so I'll remove the cc:stable
and the patch will appear in 4.12 and no earlier kernels.
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] cma: fix calculation of aligned offset Doug Berger <opendmb@gmail.com> - 2017-06-28 20:00 +0200
Re: [PATCH] cma: fix calculation of aligned offset Gregory Fong <gregory.0xf0@gmail.com> - 2017-06-29 08:30 +0200
Re: [PATCH] cma: fix calculation of aligned offset Doug Berger <opendmb@gmail.com> - 2017-06-29 19:00 +0200
Re: [PATCH] cma: fix calculation of aligned offset Andrew Morton <akpm@linux-foundation.org> - 2017-06-29 22:50 +0200
Re: [PATCH] cma: fix calculation of aligned offset Andrew Morton <akpm@linux-foundation.org> - 2017-06-30 02:50 +0200
Re: [PATCH] cma: fix calculation of aligned offset Doug Berger <opendmb@gmail.com> - 2017-06-30 02:50 +0200
csiph-web