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: <20100422141611.2599ee67@lxorguk.ukuu.org.uk>
Date:	Thu, 22 Apr 2010 14:16:11 +0100
From:	Alan Cox <alan@...rguk.ukuu.org.uk>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	Alan Cox <alan@...ux.intel.com>, mingo@...e.hu,
	linux-kernel@...r.kernel.org, Sreedhara DS <sreedhara.ds@...el.com>
Subject: Re: [PATCH] IPC driver for Intel Mobile Internet Device (MID)
 platforms

> __packed, please.  (I've requested that this be added to checkpatch,
> but Mr Checkpatch is asleep).

Done


> > +static inline int busy_loop(void) /* Wait till scu status is busy */
> > +{
> > +	u32 status = 0;
> > +	u32 loop_count = 0;
> > +
> > +	status = __raw_readl(IPC_STATUS_REG);
> > +	while (status & 1) {
> > +		udelay(1); /* scu processing time is in few u secods */
> > +		status = __raw_readl(IPC_STATUS_REG);
> > +		loop_count++;
> > +		/* break if scu doesn't reset busy bit after huge retry */
> > +		if (loop_count > 100000)
> > +			return -ETIMEDOUT;

> This function has seven-odd callsites and is waaaaaaaay to fat and slow
> to be inlined.

Looking at the asm I'm not convinced.


> > +	if (id == IPC_CMD_PCNTRL_R) { /* Read rbuf */
> > +		/* Workaround: values are read as 0 without memcpy_fromio */
> > +		memcpy_fromio(cbuf, IPC_READ_BUFFER, 16);
> 
> Should we still be doing this if busy_loop() failed?
> 
> (Lots of dittoes on this question)

Does no harm

> > +}
> 
> I wonder if this function would look better if cbuf had type u16[],

No - we do byte aligned access to it. and cbuf[offset + 1.5] is sadly not
supported by C (although I suspect you can make it work in C++ ;))

> > +	mutex_lock(&ipclock);
> > +	if (ipcdev.pdev == NULL) {
> 
> This check happens a lot.  Can it really happen?

Yes.

> I think mailbox_base could/should have had type `struct
> fw_update_mailbox __iomem *'.  ioremap_nocache() should handle that
> cleanly, and this cast goes away.

Definitely - and the rest them cleans up by magic

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