[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9504173f-29b5-40a6-3fa8-4bfd498e2e31@intel.com>
Date: Wed, 20 Nov 2019 17:27:37 -0700
From: Dave Jiang <dave.jiang@...el.com>
To: Thomas Gleixner <tglx@...utronix.de>,
"Luck, Tony" <tony.luck@...el.com>
Cc: Borislav Petkov <bp@...en8.de>,
"dmaengine@...r.kernel.org" <dmaengine@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"vkoul@...nel.org" <vkoul@...nel.org>,
"Williams, Dan J" <dan.j.williams@...el.com>,
"Lin, Jing" <jing.lin@...el.com>,
"Raj, Ashok" <ashok.raj@...el.com>,
"Kumar, Sanjay K" <sanjay.k.kumar@...el.com>,
"Dey, Megha" <megha.dey@...el.com>,
"Pan, Jacob jun" <jacob.jun.pan@...el.com>,
"Liu, Yi L" <yi.l.liu@...el.com>,
"axboe@...nel.dk" <axboe@...nel.dk>,
"akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
"mingo@...hat.com" <mingo@...hat.com>,
"Yu, Fenghua" <fenghua.yu@...el.com>,
"hpa@...or.com" <hpa@...or.com>
Subject: Re: [PATCH RFC 01/14] x86/asm: add iosubmit_cmds512() based on
movdir64b CPU instruction
On 11/20/19 5:22 PM, Thomas Gleixner wrote:
> On Wed, 20 Nov 2019, Luck, Tony wrote:
>> On Wed, Nov 20, 2019 at 10:53:39PM +0100, Borislav Petkov wrote:
>>> On Wed, Nov 20, 2019 at 02:23:49PM -0700, Dave Jiang wrote:
>>>> +static inline void iosubmit_cmds512(void __iomem *dst, const void *src,
>>>> + size_t count)
>>>
>>> An iosubmit function which returns void and doesn't tell its callers
>>> whether it succeeded or not? That looks non-optimal to say the least.
>>
>> That's the underlying functionality of the MOVDIR64B instruction. A
>> posted write so no way to know if it succeeded. When using dedicated
>> queues the caller must keep count of how many operations are in flight
>> and not send more than the depth of the queue.
>>
>>> Why isn't there a fallback function which to call when the CPU doesn't
>>> support movdir64b?
>>
>> This particular driver has no option for fallback. Descriptors can
>> only be submitted with MOVDIR64B (to dedicated queues ... in later
>> patch series support for shared queues will be added, but those require
>> ENQCMD or ENQCMDS to submit).
>>
>> The driver bails out at the beginning of the probe routine if the
>> necessary instructions are not supported:
>>
>> + /*
>> + * If the CPU does not support write512, there's no point in
>> + * enumerating the device. We can not utilize it.
>> + */
>> + if (!cpu_has_write512())
>> + return -ENXIO;
>>
>> Though we should always get past that as this PCI device ID shouldn't
>> every appear on a system that doesn't have the support. Device is on
>> the die, not a plug-in card.
>
> Then the condition in the iosubmit function is just prone to silently paper
> over any bug in a driver:
>
>> + if (!cpu_has_write512())
>> + return;
>
> This should at least issue a WARN_ON_ONCE()
Thanks! I'll be adding the WARN_ON_ONCE() for the cap check. Also with
the alignment check Borislav mentioned, I'll add a WARN_ON() for failures.
>
> Thanks,
>
> tglx
>
Powered by blists - more mailing lists