Re: [PATCH RFC 01/14] x86/asm: add iosubmit_cmds512() based on movdir64b CPU instruction

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

 



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.

> +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?



[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux PCI]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux