On 1/4/17, 4:29 AM, "[email protected] on behalf of Nadav Har'El" <[email protected] on behalf of [email protected]> wrote:
> >On Tue, Jan 3, 2017 at 9:33 PM, Timmons C. Player ><[email protected]> wrote: > >If the dynamic memory buffer used for percpu allocations >wasn't congruent to the requested alignment, then the >returned memory wouldn't actually be aligned correctly. >This change forces the bitmap search to start at the proper >alignment. > > > > >Thanks, good catch > > >It appears that the "long align" in dynamic_percpu_buffer was supposed to >provide alignment that would be "enough for anyone" (famous last >words...), but obviously is only enough for 8-byte alignment or less. Did >you see this problem with your own code > using dynamic_percpu, or with existing code? It was with my own code. I needed a 64 byte aligned per-cpu memory area for retrieving KVM’s steal time statistic. > > >I think we should also drop the "union" and the "long align" stuff in >this patch, which no longer serves any useful purpose? > > >In malign and friends we have an assert at the end (just before >returning) that "align" worked, if we had it we would have caught this >bug more easily, i.e., something like > > assert (!(reinterpret_cast<uintptr_t>(ret) & (alignment - 1))); > > >Maybe it's worth adding. > OK. I’ll incorporate your suggestions and update the patch. Timmons Spirent Communications e-mail confidentiality. ------------------------------------------------------------------------ This e-mail contains confidential and / or privileged information belonging to Spirent Communications plc, its affiliates and / or subsidiaries. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution and / or the taking of any action based upon reliance on the contents of this transmission is strictly forbidden. If you have received this message in error please notify the sender by return e-mail and delete it from your system. Spirent Communications plc Northwood Park, Gatwick Road, Crawley, West Sussex, RH10 9XN, United Kingdom. Tel No. +44 (0) 1293 767676 Fax No. +44 (0) 1293 767677 Registered in England Number 470893 Registered at Northwood Park, Gatwick Road, Crawley, West Sussex, RH10 9XN, United Kingdom. Or if within the US, Spirent Communications, 27349 Agoura Road, Calabasas, CA, 91301, USA. Tel No. 1-818-676- 2300 -- You received this message because you are subscribed to the Google Groups "OSv Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
