lkml.org 
[lkml]   [2019]   [Nov]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH RFC 01/14] x86/asm: add iosubmit_cmds512() based on movdir64b CPU instruction
From
Date


On 11/20/19 2:50 PM, Hansen, Dave wrote:
> On 11/20/19 1:23 PM, Dave Jiang wrote:
>> +static inline void __iowrite512(void __iomem *__dst, const void *src)
>> +{
>> + volatile struct { char _[64]; } *dst = __dst;
>
> This _looks_ like gibberish. I know it's not, but it is subtle enough
> that it really needs specific comments.

I'll add comments explaining.

>
>> +static inline void iosubmit_cmds512(void __iomem *dst, const void *src,
>> + size_t count)
>> +{
>> + const u8 *from = src;
>> + const u8 *end = from + count * 64;
>> +
>> + if (!cpu_has_write512())
>> + return;
>> +
>> + while (from < end) {
>> + __iowrite512(dst, from);
>> + from += 64;
>> + }
>> +}
>
> Won't this silently just drop things if the CPU doesn't have movdir64b
> support?
>
> It seems like this shouldn't be called at all if
> !cpu_has_write512(), but wouldn't something like this be mroe appropriate?
>
> if (!cpu_has_write512()) {
> WARN_ON_ONCE(1);
> return;
> }
>
> Is the caller just supposed to infer that "dst" was never overwritten?
>

Thanks. I'll add the WARN().

\
 
 \ /
  Last update: 2019-11-21 00:47    [from the cache]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and my Meterkast|Read the blog