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: <1215653563.13950.39.camel@localhost>
Date:	Thu, 10 Jul 2008 11:32:43 +1000
From:	Michael Ellerman <michael@...erman.id.au>
To:	Matthew Wilcox <matthew@....cx>
Cc:	linux-pci@...r.kernel.org, kaneshige.kenji@...fujitsu.com,
	mingo@...e.hu, tglx@...utronix.de, davem@...emloft.net,
	dan.j.williams@...el.com, Martine.Silbermann@...com,
	benh@...nel.crashing.org, linux-kernel@...r.kernel.org,
	Matthew Wilcox <willy@...ux.intel.com>
Subject: Re: [PATCH 1/4] PCI MSI: Store the number of messages in the
	msi_desc

On Mon, 2008-07-07 at 06:04 -0600, Matthew Wilcox wrote:
> On Mon, Jul 07, 2008 at 01:48:32PM +1000, Michael Ellerman wrote:
> > Yeah seriously :)  The _ is part of it, but MSI_ATTRIB is uglier than
> > PCI_CAP_ID_MSI exactly because it's not PCI_CAP_ID_MSI, which exists and
> > is well defined and is used in the rest of the code.
> 
> Here's an improvement over both the status quo and my patch -- simply
> use a single bit called is_msix.

That is cleaner, you get to fix it when they create MSIXX though ;)

> > I didn't say it was a queue, but a Q ;)  But I agree it's not a good
> > name, the spec calls it "multiple message enable", nvec would match the
> > existing code best, or log_nvec.
> 
> I don't see what's wrong with 'multiple'.  log_nvec is clunky, and
> 'multiple' works well as a boolean (since 0 means 1 interrupt).

For me 'multiple' only makes sense as a boolean, but whatever.

> > > > If you're worried about bloating msi_desc, there's several fields in
> > > > there that are per-device not per-desc, so we could do another patch to
> > > > move them into pci_dev or something hanging off it, eg.
> > > > pci_dev->msi_info rather than storing them in every desc.
> 
> Ouch.  I just used pahole and discovered we were using 72 bytes on
> 64-bit.  A swift rearrangement of a u16 gets us back down to 64.

pahole is awesome, nice find.

> Here's the replacement patch:

Perhaps I'm pedantic, but I'd rather it was two patches, one to change
type to is_msix and one to add the multiple flag.

> diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
> index 8c61304..8f7e483 100644
> --- a/drivers/pci/msi.c
> +++ b/drivers/pci/msi.c

> @@ -180,32 +167,31 @@ void read_msi_msg(unsigned int irq, struct msi_msg *msg)
...
>  		struct pci_dev *dev = entry->dev;
>  		int pos = entry->msi_attrib.pos;
> +		u16 msgctl;
> +
> +		pci_read_config_word(dev, msi_control_reg(pos), &msgctl);
> +		msgctl &= ~PCI_MSI_FLAGS_QSIZE;
> +		msgctl |= entry->msi_attrib.multiple << 4;
> +		pci_write_config_word(dev, msi_control_reg(pos), msgctl);

A #define for "<< 4" would be nice. And should we be paranoid about
potentially writing 0b110 or 0b111 which are reserved?

cheers

-- 
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person

Download attachment "signature.asc" of type "application/pgp-signature" (190 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ