lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090814222039.0cc29713@lxorguk.ukuu.org.uk>
Date:	Fri, 14 Aug 2009 22:20:39 +0100
From:	Alan Cox <alan@...rguk.ukuu.org.uk>
To:	David VomLehn <dvomlehn@...co.com>
Cc:	linux-kernel@...r.kernel.org, akpm@...ux-foundation.org,
	greg@...ah.com
Subject: Re: [PATCH 1/2] Use kfifo to buffer USB generic serial writes

> The first part of patch uses the kfifo infrastructure to implement a write
> FIFO that accurately returns the amount of space available in the buffer. The
> second makes a minor change to kfifo_put() and __kfifo_put() to add the "const"
> attribute to their input buffer pointers.

Nice, fixes the bug, uses the proper infrastructure and comes out as
loads less code and far easier to read


> +	/* TODO: Much of the time there won't be a write pending and won't be
> +	 * any data ahead of the current chunk. In those cases, we could save
> +	 * a copy by putting the data directly into the URB transfer buffer.
> +	 * This adds some complexity, is it worth it for serial I/O? */
> +	count = kfifo_put(port->write_fifo, buf, count);

If your device has a single transmit URB and isn't doing 2-3MBit the
answer will be no - its in cache anyway and the real hit will be the
writeout for the USB controller to DMA it.


> +		spin_lock_irqsave(&port->write_fifo_lock, flags);
> +		chars = __kfifo_len(port->write_fifo);
> +		spin_unlock_irqrestore(&port->write_fifo_lock, flags);

Any reason for not using kfifo_len() ?

Alan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ