linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sebastian Ott <sebott@linux.ibm.com>
To: Lukas Wunner <lukas@wunner.de>
Cc: Bjorn Helgaas <helgaas@kernel.org>,
	linux-pci@vger.kernel.org, Sinan Kaya <okaya@kernel.org>,
	Mika Westerberg <mika.westerberg@linux.intel.com>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Len Brown <lenb@kernel.org>, Scott Murray <scott@spiteful.org>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Paul Mackerras <paulus@samba.org>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Gavin Shan <gwshan@linux.vnet.ibm.com>,
	Sebastian Ott <sebott@linux.vnet.ibm.com>,
	Gerald Schaefer <gerald.schaefer@de.ibm.com>,
	Corentin Chary <corentin.chary@gmail.com>,
	Darren Hart <dvhart@infradead.org>,
	Andy Shevchenko <andy@infradead.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-acpi@vger.kernel.org, linux-s390@vger.kernel.org,
	platform-driver-x86@vger.kernel.org,
	acpi4asus-user@lists.sourceforge.net,
	linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH 8/9] PCI: hotplug: Embed hotplug_slot
Date: Mon, 3 Sep 2018 19:54:49 +0200 (CEST)	[thread overview]
Message-ID: <alpine.LFD.2.21.1809031953000.1716@schleppi> (raw)
In-Reply-To: <9918fbca94bcfc03d1560b191d138d3e6664cc86.1534686485.git.lukas@wunner.de>

On Sun, 19 Aug 2018, Lukas Wunner wrote:
> When the PCI hotplug core and its first user, cpqphp, were introduced in
> February 2002 with historic commit a8a2069f432c, cpqphp allocated a slot
> struct for its internal use plus a hotplug_slot struct to be registered
> with the hotplug core and linked the two with pointers:
> https://git.kernel.org/tglx/history/c/a8a2069f432c
> 
> Nowadays, the predominant pattern in the tree is to embed ("subclass")
> such structures in one another and cast to the containing struct with
> container_of().  But it wasn't until July 2002 that container_of() was
> introduced with historic commit ec4f214232cf:
> https://git.kernel.org/tglx/history/c/ec4f214232cf
> 
> pnv_php, introduced in 2016, did the right thing and embedded struct
> hotplug_slot in its internal struct pnv_php_slot, but all other drivers
> cargo-culted cpqphp's design and linked separate structs with pointers.
> 
> Embedding structs is preferrable to linking them with pointers because
> it requires fewer allocations, thereby reducing overhead and simplifying
> error paths.  Casting an embedded struct to the containing struct
> becomes a cheap subtraction rather than a dereference.  And having fewer
> pointers reduces the risk of them pointing nowhere either accidentally
> or due to an attack.
> 
> Convert all drivers to embed struct hotplug_slot in their internal slot
> struct.  The "private" pointer in struct hotplug_slot thereby becomes
> unused, so drop it.
> 
> Signed-off-by: Lukas Wunner <lukas@wunner.de>
> Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
> Cc: Len Brown <lenb@kernel.org>
> Cc: Scott Murray <scott@spiteful.org>
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Gavin Shan <gwshan@linux.vnet.ibm.com>
> Cc: Sebastian Ott <sebott@linux.vnet.ibm.com>
> Cc: Gerald Schaefer <gerald.schaefer@de.ibm.com>
> Cc: Corentin Chary <corentin.chary@gmail.com>
> Cc: Darren Hart <dvhart@infradead.org>
> Cc: Andy Shevchenko <andy@infradead.org>

for s390_pci_hpc.c:
Acked-by: Sebastian Ott <sebott@linux.ibm.com>

  parent reply	other threads:[~2018-09-03 17:54 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-19 14:29 [PATCH 0/9] PCI hotplug diet Lukas Wunner
2018-08-19 14:29 ` [PATCH 1/9] PCI: Simplify disconnected marking Lukas Wunner
2018-08-19 21:56   ` Sinan Kaya
2018-08-19 14:29 ` [PATCH 7/9] PCI: hotplug: Drop hotplug_slot_info Lukas Wunner
2018-08-20  8:14   ` Rafael J. Wysocki
2018-08-21  0:41   ` Tyrel Datwyler
2018-09-03 17:52   ` Sebastian Ott
2018-08-19 14:29 ` [PATCH 3/9] PCI: pciehp: Drop hotplug_slot_ops wrappers Lukas Wunner
2018-08-19 22:01   ` Sinan Kaya
2018-08-19 14:29 ` [PATCH 8/9] PCI: hotplug: Embed hotplug_slot Lukas Wunner
2018-08-20  8:17   ` Rafael J. Wysocki
2018-08-21  0:43   ` Tyrel Datwyler
2018-09-03 17:54   ` Sebastian Ott [this message]
2018-08-19 14:29 ` [PATCH 6/9] PCI: hotplug: Constify hotplug_slot_ops Lukas Wunner
2018-08-20  8:10   ` Rafael J. Wysocki
2018-08-21  0:38   ` Tyrel Datwyler
2018-08-19 14:29 ` [PATCH 4/9] PCI: pciehp: Unify controller and slot structs Lukas Wunner
2018-08-19 21:59   ` Sinan Kaya
2018-08-20  9:09     ` Lukas Wunner
2018-08-20 17:34       ` Sinan Kaya
2018-09-05 22:30         ` Bjorn Helgaas
2018-09-06  7:38           ` Lukas Wunner
2018-09-06 18:54             ` Bjorn Helgaas
2018-09-17 22:37             ` Bjorn Helgaas
2018-09-18 19:46               ` Lukas Wunner
2018-09-18 19:46                 ` Lukas Wunner
2018-08-19 14:29 ` [PATCH 9/9] PCI: hotplug: Document TODOs Lukas Wunner
2018-08-19 14:29 ` [PATCH 2/9] PCI: pciehp: Drop unnecessary includes Lukas Wunner
2018-08-19 14:29 ` [PATCH 5/9] PCI: pciehp: Reshuffle controller struct for clarity Lukas Wunner
2018-08-30  8:50 ` [PATCH 0/9] PCI hotplug diet Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LFD.2.21.1809031953000.1716@schleppi \
    --to=sebott@linux.ibm.com \
    --cc=acpi4asus-user@lists.sourceforge.net \
    --cc=andy@infradead.org \
    --cc=benh@kernel.crashing.org \
    --cc=corentin.chary@gmail.com \
    --cc=dvhart@infradead.org \
    --cc=gerald.schaefer@de.ibm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=gwshan@linux.vnet.ibm.com \
    --cc=helgaas@kernel.org \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=lukas@wunner.de \
    --cc=mika.westerberg@linux.intel.com \
    --cc=mpe@ellerman.id.au \
    --cc=okaya@kernel.org \
    --cc=paulus@samba.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=scott@spiteful.org \
    --cc=sebott@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).