Re: [Question] Alignment requirement for readX() and writeX()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jul 30, 2021 at 10:24:53PM +0200, Arnd Bergmann wrote:
> On Fri, Jul 30, 2021 at 7:31 PM Boqun Feng <boqun.feng@xxxxxxxxx> wrote:
> > On Fri, Jul 30, 2021 at 06:58:30PM +0200, Arnd Bergmann wrote:
> >
> > If we want to check, I'd expect we do the checks inside
> > readX()/writeX(), for example, readl() could be implemented as:
> >
> >         #define readl(c)                                        \
> >         ({                                                      \
> >                 u32 __v;                                        \
> >                                                                 \
> >                 /* alignment checking */                        \
> >                 BUG_ON(c & (sizeof(__v) - 1));                  \
> >                 __v = readl_relaxed(c);                         \
> >                 __iormb(__v);                                   \
> >                 __v;                                            \
> >         })
> >
> > It's a runtime check, so if anyone hates it I can understand ;-)
> 
> Right, I really don't think that adds any value, this just replaces one
> oops message with a more different oops message, while adding
> some overhead.
> 

Agreed. I wasn't planning to propose this kind of checks for C code.
Just want to understand better on the alignment requirement of these
APIs. Thanks  ;-)

Regards,
Boqun

>         Arnd



[Index of Archives]     [Linux Kernel]     [Kernel Newbies]     [x86 Platform Driver]     [Netdev]     [Linux Wireless]     [Netfilter]     [Bugtraq]     [Linux Filesystems]     [Yosemite Discussion]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux