code:
.. SPDX-License-Identifier: GPL-2.0

==============================
How To Write Linux PCI Drivers
==============================

:Authors: - Martin Mares <mj@ucw.cz>
          - Grant Grundler <grundler@parisc-linux.org>

The world of PCI is vast and full of (mostly unpleasant) surprises.
Since each CPU architecture implements different chip-sets and PCI devices
have different requirements (erm, "features"), the result is the PCI support
in the Linux kernel is not as trivial as one would wish. This short paper
tries to introduce all potential driver authors to Linux APIs for
PCI device drivers.

A more complete resource is the third edition of "Linux Device Drivers"
by Jonathan Corbet, Alessandro Rubini, and Greg Kroah-Hartman.
LDD3 is available for free (under Creative Commons License) from:
https://lwn.net/Kernel/LDD3/.

However, keep in mind that all documents are subject to "bit rot".
Refer to the source code if things are not working as described here.

Please send questions/comments/patches about Linux PCI API to the
"Linux PCI" <linux-pci@atrey.karlin.mff.cuni.cz> mailing list.

Structure of PCI drivers
========================
PCI drivers "discover" PCI devices in a system via pci_register_driver().
Actually, it's the other way around. When the PCI generic code discovers
a new device, the driver with a matching "description" will be notified.
Details on this below.

pci_register_driver() leaves most of the probing for devices to
the PCI layer and supports online insertion/removal of devices [thus
supporting hot-pluggable PCI, CardBus, and Express-Card in a single driver].
pci_register_driver() call requires passing in a table of function
pointers and thus dictates the high level structure of a driver.

Once the driver knows about a PCI device and takes ownership, the
driver generally needs to perform the following initialization:

  - Enable the device
  - Request MMIO/IOP resources
  - Set the DMA mask size (for both coherent and streaming DMA)
  - Allocate and initialize shared control data (pci_allocate_coherent())
  - Access device configuration space (if needed)
  - Register IRQ handler (request_irq())
  - Initialize non-PCI (i.e. LAN/SCSI/etc parts of the chip)
  - Enable DMA/processing engines

When done using the device, and perhaps the module needs to be unloaded,
the driver needs to take the follow steps:

  - Disable the device from generating IRQs
  - Release the IRQ (free_irq())
  - Stop all DMA activity
  - Release DMA buffers (both streaming and coherent)
  - Unregister from other subsystems (e.g. scsi or netdev)
  - Release MMIO/IOP resources
  - Disable the device

Most of these topics are covered in the following sections.
For the rest look at LDD3 or <linux/pci.h> .

If the PCI subsystem is not configured (CONFIG_PCI is not set), most of
the PCI functions described below are defined as inline functions either
completely empty or just returning an appropriate error codes to avoid
lots of ifdefs in the drivers.

pci_register_driver() call
==========================

PCI device drivers call ``pci_register_driver()`` during their
initialization with a pointer to a structure describing the driver
(``struct pci_driver``):

.. kernel-doc:: include/linux/pci.h
   :functions: pci_driver

The ID table is an array of ``struct pci_device_id`` entries ending with an
all-zero entry.  Definitions with static const are generally preferred.

.. kernel-doc:: include/linux/mod_devicetable.h
   :functions: pci_device_id

Most drivers only need ``PCI_DEVICE()`` or ``PCI_DEVICE_CLASS()`` to set up
a pci_device_id table.

New PCI IDs may be added to a device driver pci_ids table at runtime
as shown below::

  echo "vendor device subvendor subdevice class class_mask driver_data" > \
  /sys/bus/pci/drivers/{driver}/new_id

All fields are passed in as hexadecimal values (no leading 0x).
The vendor and device fields are mandatory, the others are optional. Users
need pass only as many optional fields as necessary:

  - subvendor and subdevice fields default to PCI_ANY_ID (FFFFFFFF)
  - class and classmask fields default to 0
  - driver_data defaults to 0UL.
  - override_only field defaults to 0.

Note that driver_data must match the value used by any of the pci_device_id
entries defined in the driver. This makes the driver_data field mandatory
if all the pci_device_id entries have a non-zero driver_data value.

Once added, the driver probe routine will be invoked for any unclaimed
PCI devices listed in its (newly updated) pci_ids list.

When the driver exits, it just calls pci_unregister_driver() and the PCI layer
automatically calls the remove hook for all devices handled by the driver.

"Attributes" for driver functions/data
--------------------------------------

Please mark the initialization and cleanup functions where appropriate
(the corresponding macros are defined in <linux/init.h>):

	======		=================================================
	__init		Initialization code. Thrown away after the driver
			initializes.
	__exit		Exit code. Ignored for non-modular drivers.
	======		=================================================

Tips on when/where to use the above attributes:
	- The module_init()/module_exit() functions (and all
	  initialization functions called _only_ from these)
	  should be marked __init/__exit.

	- Do not mark the struct pci_driver.

	- Do NOT mark a function if you are not sure which mark to use.
	  Better to not mark the function than mark the function wrong.

How to find PCI devices manually
================================

PCI drivers should have a really good reason for not using the
pci_register_driver() interface to search for PCI devices.
The main reason PCI devices are controlled by multiple drivers
is because one PCI device implements several different HW services.
E.g. combined serial/parallel port/floppy controller.

A manual search may be performed using the following constructs:

Searching by vendor and device ID::

	struct pci_dev *dev = NULL;
	while (dev = pci_get_device(VENDOR_ID, DEVICE_ID, dev))
		configure_device(dev);

Searching by class ID (iterate in a similar way)::

	pci_get_class(CLASS_ID, dev)

Searching by both vendor/device and subsystem vendor/device ID::

	pci_get_subsys(VENDOR_ID,DEVICE_ID, SUBSYS_VENDOR_ID, SUBSYS_DEVICE_ID, dev).

You can use the constant PCI_ANY_ID as a wildcard replacement for
VENDOR_ID or DEVICE_ID.  This allows searching for any device from a
specific vendor, for example.

These functions are hotplug-safe. They increment the reference count on
the pci_dev that they return. You must eventually (possibly at module unload)
decrement the reference count on these devices by calling pci_dev_put().

Device Initialization Steps
===========================

As noted in the introduction, most PCI drivers need the following steps
for device initialization:

  - Enable the device
  - Request MMIO/IOP resources
  - Set the DMA mask size (for both coherent and streaming DMA)
  - Allocate and initialize shared control data (pci_allocate_coherent())
  - Access device configuration space (if needed)
  - Register IRQ handler (request_irq())
  - Initialize non-PCI (i.e. LAN/SCSI/etc parts of the chip)
  - Enable DMA/processing engines.

The driver can access PCI config space registers at any time.
(Well, almost. When running BIST, config space can go away...but
that will just result in a PCI Bus Master Abort and config reads
will return garbage).

Enable the PCI device
---------------------
Before touching any device registers, the driver needs to enable
the PCI device by calling pci_enable_device(). This will:

  - wake up the device if it was in suspended state,
  - allocate I/O and memory regions of the device (if BIOS did not),
  - allocate an IRQ (if BIOS did not).

.. note::
   pci_enable_device() can fail! Check the return value.

.. warning::
   OS BUG: we don't check resource allocations before enabling those
   resources. The sequence would make more sense if we called
   pci_request_resources() before calling pci_enable_device().
   Currently, the device drivers can't detect the bug when two
   devices have been allocated the same range. This is not a common
   problem and unlikely to get fixed soon.

   This has been discussed before but not changed as of 2.6.19:
   https://lore.kernel.org/r/20060302180025.GC28895@flint.arm.linux.org.uk/

pci_set_master() will enable DMA by setting the bus master bit
in the PCI_COMMAND register. It also fixes the latency timer value if
it's set to something bogus by the BIOS.  pci_clear_master() will
disable DMA by clearing the bus master bit.

If the PCI device can use the PCI Memory-Write-Invalidate transaction,
call pci_set_mwi().  This enables the PCI_COMMAND bit for Mem-Wr-Inval
and also ensures that the cache line size register is set correctly.
Check the return value of pci_set_mwi() as not all architectures
or chip-sets may support Memory-Write-Invalidate.  Alternatively,
if Mem-Wr-Inval would be nice to have but is not required, call
pci_try_set_mwi() to have the system do its best effort at enabling
Mem-Wr-Inval.

Request MMIO/IOP resources
--------------------------
Memory (MMIO), and I/O port addresses should NOT be read directly
from the PCI device config space. Use the values in the pci_dev structure
as the PCI "bus address" might have been remapped to a "host physical"
address by the arch/chip-set specific kernel support.

See Documentation/driver-api/io-mapping.rst for how to access device registers
or device memory.

The device driver needs to call pci_request_region() to verify
no other device is already using the same address resource.
Conversely, drivers should call pci_release_region() AFTER
calling pci_disable_device().
The idea is to prevent two devices colliding on the same address range.

.. tip::
   See OS BUG comment above. Currently (2.6.19), The driver can only
   determine MMIO and IO Port resource availability _after_ calling
   pci_enable_device().

Generic flavors of pci_request_region() are request_mem_region()
(for MMIO ranges) and request_region() (for IO Port ranges).
Use these for address resources that are not described by "normal" PCI
BARs.

Also see pci_request_selected_regions() below.

Set the DMA mask size
---------------------
.. note::
   If anything below doesn't make sense, please refer to
   Documentation/core-api/dma-api.rst. This section is just a reminder that
   drivers need to indicate DMA capabilities of the device and is not
   an authoritative source for DMA interfaces.

While all drivers should explicitly indicate the DMA capability
(e.g. 32 or 64 bit) of the PCI bus master, devices with more than
32-bit bus master capability for streaming data need the driver
to "register" this capability by calling dma_set_mask() with
appropriate parameters.  In general this allows more efficient DMA
on systems where System RAM exists above 4G _physical_ address.

Drivers for all PCI-X and PCIe compliant devices must call
dma_set_mask() as they are 64-bit DMA devices.

Similarly, drivers must also "register" this capability if the device
can directly address "coherent memory" in System RAM above 4G physical
address by calling dma_set_coherent_mask().
Again, this includes drivers for all PCI-X and PCIe compliant devices.
Many 64-bit "PCI" devices (before PCI-X) and some PCI-X devices are
64-bit DMA capable for payload ("streaming") data but not control
("coherent") data.

Setup shared control data
-------------------------
Once the DMA masks are set, the driver can allocate "coherent" (a.k.a. shared)
memory.  See Documentation/core-api/dma-api.rst for a full description of
the DMA APIs. This section is just a reminder that it needs to be done
before enabling DMA on the device.

Initialize device registers
---------------------------
Some drivers will need specific "capability" fields programmed
or other "vendor specific" register initialized or reset.
E.g. clearing pending interrupts.

Register IRQ handler
--------------------
While calling request_irq() is the last step described here,
this is often just another intermediate step to initialize a device.
This step can often be deferred until the device is opened for use.

All interrupt handlers for IRQ lines should be registered with IRQF_SHARED
and use the devid to map IRQs to devices (remember that all PCI IRQ lines
can be shared).

request_irq() will associate an interrupt handler and device handle
with an interrupt number. Historically interrupt numbers represent
IRQ lines which run from the PCI device to the Interrupt controller.
With MSI and MSI-X (more below) the interrupt number is a CPU "vector".

request_irq() also enables the interrupt. Make sure the device is
quiesced and does not have any interrupts pending before registering
the interrupt handler.

MSI and MSI-X are PCI capabilities. Both are "Message Signaled Interrupts"
which deliver interrupts to the CPU via a DMA write to a Local APIC.
The fundamental difference between MSI and MSI-X is how multiple
"vectors" get allocated. MSI requires contiguous blocks of vectors
while MSI-X can allocate several individual ones.

MSI capability can be enabled by calling pci_alloc_irq_vectors() with the
PCI_IRQ_MSI and/or PCI_IRQ_MSIX flags before calling request_irq(). This
causes the PCI support to program CPU vector data into the PCI device
capability registers. Many architectures, chip-sets, or BIOSes do NOT
support MSI or MSI-X and a call to pci_alloc_irq_vectors with just
the PCI_IRQ_MSI and PCI_IRQ_MSIX flags will fail, so try to always
specify PCI_IRQ_LEGACY as well.

Drivers that have different interrupt handlers for MSI/MSI-X and
legacy INTx should chose the right one based on the msi_enabled
and msix_enabled flags in the pci_dev structure after calling
pci_alloc_irq_vectors.

There are (at least) two really good reasons for using MSI:

1) MSI is an exclusive interrupt vector by definition.
   This means the interrupt handler doesn't have to verify
   its device caused the interrupt.

2) MSI avoids DMA/IRQ race conditions. DMA to host memory is guaranteed
   to be visible to the host CPU(s) when the MSI is delivered. This
   is important for both data coherency and avoiding stale control data.
   This guarantee allows the driver to omit MMIO reads to flush
   the DMA stream.

See drivers/infiniband/hw/mthca/ or drivers/net/tg3.c for examples
of MSI/MSI-X usage.

PCI device shutdown
===================

When a PCI device driver is being unloaded, most of the following
steps need to be performed:

  - Disable the device from generating IRQs
  - Release the IRQ (free_irq())
  - Stop all DMA activity
  - Release DMA buffers (both streaming and coherent)
  - Unregister from other subsystems (e.g. scsi or netdev)
  - Disable device from responding to MMIO/IO Port addresses
  - Release MMIO/IO Port resource(s)

Stop IRQs on the device
-----------------------
How to do this is chip/device specific. If it's not done, it opens
the possibility of a "screaming interrupt" if (and only if)
the IRQ is shared with another device.

When the shared IRQ handler is "unhooked", the remaining devices
using the same IRQ line will still need the IRQ enabled. Thus if the
"unhooked" device asserts IRQ line, the system will respond assuming
it was one of the remaining devices asserted the IRQ line. Since none
of the other devices will handle the IRQ, the system will "hang" until
it decides the IRQ isn't going to get handled and masks the IRQ (100,000
iterations later). Once the shared IRQ is masked, the remaining devices
will stop functioning properly. Not a nice situation.

This is another reason to use MSI or MSI-X if it's available.
MSI and MSI-X are defined to be exclusive interrupts and thus
are not susceptible to the "screaming interrupt" problem.

Release the IRQ
---------------
Once the device is quiesced (no more IRQs), one can call free_irq().
This function will return control once any pending IRQs are handled,
"unhook" the drivers IRQ handler from that IRQ, and finally release
the IRQ if no one else is using it.

Stop all DMA activity
---------------------
It's extremely important to stop all DMA operations BEFORE attempting
to deallocate DMA control data. Failure to do so can result in memory
corruption, hangs, and on some chip-sets a hard crash.

Stopping DMA after stopping the IRQs can avoid races where the
IRQ handler might restart DMA engines.

While this step sounds obvious and trivial, several "mature" drivers
didn't get this step right in the past.

Release DMA buffers
-------------------
Once DMA is stopped, clean up streaming DMA first.
I.e. unmap data buffers and return buffers to "upstream"
owners if there is one.

Then clean up "coherent" buffers which contain the control data.

See Documentation/core-api/dma-api.rst for details on unmapping interfaces.

Unregister from other subsystems
--------------------------------
Most low level PCI device drivers support some other subsystem
like USB, ALSA, SCSI, NetDev, Infiniband, etc. Make sure your
driver isn't losing resources from that other subsystem.
If this happens, typically the symptom is an Oops (panic) when
the subsystem attempts to call into a driver that has been unloaded.

Disable Device from responding to MMIO/IO Port addresses
--------------------------------------------------------
io_unmap() MMIO or IO Port resources and then call pci_disable_device().
This is the symmetric opposite of pci_enable_device().
Do not access device registers after calling pci_disable_device().

Release MMIO/IO Port Resource(s)
--------------------------------
Call pci_release_region() to mark the MMIO or IO Port range as available.
Failure to do so usually results in the inability to reload the driver.

How to access PCI config space
==============================

You can use `pci_(read|write)_config_(byte|word|dword)` to access the config
space of a device represented by `struct pci_dev *`. All these functions return
0 when successful or an error code (`PCIBIOS_...`) which can be translated to a
text string by pcibios_strerror. Most drivers expect that accesses to valid PCI
devices don't fail.

If you don't have a struct pci_dev available, you can call
`pci_bus_(read|write)_config_(byte|word|dword)` to access a given device
and function on that bus.

If you access fields in the standard portion of the config header, please
use symbolic names of locations and bits declared in <linux/pci.h>.

If you need to access Extended PCI Capability registers, just call
pci_find_capability() for the particular capability and it will find the
corresponding register block for you.

Other interesting functions
===========================

=============================	================================================
pci_get_domain_bus_and_slot()	Find pci_dev corresponding to given domain,
				bus and slot and number. If the device is
				found, its reference count is increased.
pci_set_power_state()		Set PCI Power Management state (0=D0 ... 3=D3)
pci_find_capability()		Find specified capability in device's capability
				list.
pci_resource_start()		Returns bus start address for a given PCI region
pci_resource_end()		Returns bus end address for a given PCI region
pci_resource_len()		Returns the byte length of a PCI region
pci_set_drvdata()		Set private driver data pointer for a pci_dev
pci_get_drvdata()		Return private driver data pointer for a pci_dev
pci_set_mwi()			Enable Memory-Write-Invalidate transactions.
pci_clear_mwi()			Disable Memory-Write-Invalidate transactions.
=============================	================================================

Miscellaneous hints
===================

When displaying PCI device names to the user (for example when a driver wants
to tell the user what card has it found), please use pci_name(pci_dev).

Always refer to the PCI devices by a pointer to the pci_dev structure.
All PCI layer functions use this identification and it's the only
reasonable one. Don't use bus/slot/function numbers except for very
special purposes -- on systems with multiple primary buses their semantics
can be pretty complex.

Don't try to turn on Fast Back to Back writes in your driver.  All devices
on the bus need to be capable of doing it, so this is something which needs
to be handled by platform and generic code, not individual drivers.

Vendor and device identifications
=================================

Do not add new device or vendor IDs to include/linux/pci_ids.h unless they
are shared across multiple drivers.  You can add private definitions in
your driver if they're helpful, or just use plain hex constants.

The device IDs are arbitrary hex numbers (vendor controlled) and normally used
only in a single location, the pci_device_id table.

Please DO submit new vendor/device IDs to https://pci-ids.ucw.cz/.
There's a mirror of the pci.ids file at https://github.com/pciutils/pciids.

Obsolete functions
==================

There are several functions which you might come across when trying to
port an old driver to the new PCI interface.  They are no longer present
in the kernel as they aren't compatible with hotplug or PCI domains or
having sane locking.

=================	===========================================
pci_find_device()	Superseded by pci_get_device()
pci_find_subsys()	Superseded by pci_get_subsys()
pci_find_slot()		Superseded by pci_get_domain_bus_and_slot()
pci_get_slot()		Superseded by pci_get_domain_bus_and_slot()
=================	===========================================

The alternative is the traditional PCI device driver that walks PCI
device lists. This is still possible but discouraged.

MMIO Space and "Write Posting"
==============================

Converting a driver from using I/O Port space to using MMIO space
often requires some additional changes. Specifically, "write posting"
needs to be handled. Many drivers (e.g. tg3, acenic, sym53c8xx_2)
already do this. I/O Port space guarantees write transactions reach the PCI
device before the CPU can continue. Writes to MMIO space allow the CPU
to continue before the transaction reaches the PCI device. HW weenies
call this "Write Posting" because the write completion is "posted" to
the CPU before the transaction has reached its destination.

Thus, timing sensitive code should add readl() where the CPU is
expected to wait before doing other work.  The classic "bit banging"
sequence works fine for I/O Port space::

       for (i = 8; --i; val >>= 1) {
               outb(val & 1, ioport_reg);      /* write bit */
               udelay(10);
       }

The same sequence for MMIO space should be::

       for (i = 8; --i; val >>= 1) {
               writeb(val & 1, mmio_reg);      /* write bit */
               readb(safe_mmio_reg);           /* flush posted write */
               udelay(10);
       }

It is important that "safe_mmio_reg" not have any side effects that
interferes with the correct operation of the device.

Another case to watch out for is when resetting a PCI device. Use PCI
Configuration space reads to flush the writel(). This will gracefully
handle the PCI master abort on all platforms if the PCI device is
expected to not respond to a readl().  Most x86 platforms will allow
MMIO reads to master abort (a.k.a. "Soft Fail") and return garbage
(e.g. ~0). But many RISC platforms will crash (a.k.a."Hard Fail").


code:
.. SPDX-License-Identifier: GPL-2.0
.. include:: <isonum.txt>

===========================================================
The PCI Express Advanced Error Reporting Driver Guide HOWTO
===========================================================

:Authors: - T. Long Nguyen <tom.l.nguyen@intel.com>
          - Yanmin Zhang <yanmin.zhang@intel.com>

:Copyright: |copy| 2006 Intel Corporation

Overview
===========

About this guide
----------------

This guide describes the basics of the PCI Express Advanced Error
Reporting (AER) driver and provides information on how to use it, as
well as how to enable the drivers of endpoint devices to conform with
PCI Express AER driver.

What is the PCI Express AER Driver?
-----------------------------------

PCI Express error signaling can occur on the PCI Express link itself
or on behalf of transactions initiated on the link. PCI Express
defines two error reporting paradigms: the baseline capability and
the Advanced Error Reporting capability. The baseline capability is
required of all PCI Express components providing a minimum defined
set of error reporting requirements. Advanced Error Reporting
capability is implemented with a PCI Express advanced error reporting
extended capability structure providing more robust error reporting.

The PCI Express AER driver provides the infrastructure to support PCI
Express Advanced Error Reporting capability. The PCI Express AER
driver provides three basic functions:

  - Gathers the comprehensive error information if errors occurred.
  - Reports error to the users.
  - Performs error recovery actions.

AER driver only attaches root ports which support PCI-Express AER
capability.

User Guide
==========

Include the PCI Express AER Root Driver into the Linux Kernel
-------------------------------------------------------------

The PCI Express AER Root driver is a Root Port service driver attached
to the PCI Express Port Bus driver. If a user wants to use it, the driver
has to be compiled. Option CONFIG_PCIEAER supports this capability. It
depends on CONFIG_PCIEPORTBUS, so pls. set CONFIG_PCIEPORTBUS=y and
CONFIG_PCIEAER = y.

Load PCI Express AER Root Driver
--------------------------------

Some systems have AER support in firmware. Enabling Linux AER support at
the same time the firmware handles AER may result in unpredictable
behavior. Therefore, Linux does not handle AER events unless the firmware
grants AER control to the OS via the ACPI _OSC method. See the PCI FW 3.0
Specification for details regarding _OSC usage.

AER error output
----------------

When a PCIe AER error is captured, an error message will be output to
console. If it's a correctable error, it is output as a warning.
Otherwise, it is printed as an error. So users could choose different
log level to filter out correctable error messages.

Below shows an example::

  0000:50:00.0: PCIe Bus Error: severity=Uncorrected (Fatal), type=Transaction Layer, id=0500(Requester ID)
  0000:50:00.0:   device [8086:0329] error status/mask=00100000/00000000
  0000:50:00.0:    [20] Unsupported Request    (First)
  0000:50:00.0:   TLP Header: 04000001 00200a03 05010000 00050100

In the example, 'Requester ID' means the ID of the device who sends
the error message to root port. Pls. refer to pci express specs for
other fields.

AER Statistics / Counters
-------------------------

When PCIe AER errors are captured, the counters / statistics are also exposed
in the form of sysfs attributes which are documented at
Documentation/ABI/testing/sysfs-bus-pci-devices-aer_stats

Developer Guide
===============

To enable AER aware support requires a software driver to configure
the AER capability structure within its device and to provide callbacks.

To support AER better, developers need understand how AER does work
firstly.

PCI Express errors are classified into two types: correctable errors
and uncorrectable errors. This classification is based on the impacts
of those errors, which may result in degraded performance or function
failure.

Correctable errors pose no impacts on the functionality of the
interface. The PCI Express protocol can recover without any software
intervention or any loss of data. These errors are detected and
corrected by hardware. Unlike correctable errors, uncorrectable
errors impact functionality of the interface. Uncorrectable errors
can cause a particular transaction or a particular PCI Express link
to be unreliable. Depending on those error conditions, uncorrectable
errors are further classified into non-fatal errors and fatal errors.
Non-fatal errors cause the particular transaction to be unreliable,
but the PCI Express link itself is fully functional. Fatal errors, on
the other hand, cause the link to be unreliable.

When AER is enabled, a PCI Express device will automatically send an
error message to the PCIe root port above it when the device captures
an error. The Root Port, upon receiving an error reporting message,
internally processes and logs the error message in its PCI Express
capability structure. Error information being logged includes storing
the error reporting agent's requestor ID into the Error Source
Identification Registers and setting the error bits of the Root Error
Status Register accordingly. If AER error reporting is enabled in Root
Error Command Register, the Root Port generates an interrupt if an
error is detected.

Note that the errors as described above are related to the PCI Express
hierarchy and links. These errors do not include any device specific
errors because device specific errors will still get sent directly to
the device driver.

Configure the AER capability structure
--------------------------------------

AER aware drivers of PCI Express component need change the device
control registers to enable AER. They also could change AER registers,
including mask and severity registers. Helper function
pci_enable_pcie_error_reporting could be used to enable AER. See
section 3.3.

Provide callbacks
-----------------

callback reset_link to reset pci express link
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This callback is used to reset the pci express physical link when a
fatal error happens. The root port aer service driver provides a
default reset_link function, but different upstream ports might
have different specifications to reset pci express link, so all
upstream ports should provide their own reset_link functions.

Section 3.2.2.2 provides more detailed info on when to call
reset_link.

PCI error-recovery callbacks
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The PCI Express AER Root driver uses error callbacks to coordinate
with downstream device drivers associated with a hierarchy in question
when performing error recovery actions.

Data struct pci_driver has a pointer, err_handler, to point to
pci_error_handlers who consists of a couple of callback function
pointers. AER driver follows the rules defined in
pci-error-recovery.txt except pci express specific parts (e.g.
reset_link). Pls. refer to pci-error-recovery.txt for detailed
definitions of the callbacks.

Below sections specify when to call the error callback functions.

Correctable errors
~~~~~~~~~~~~~~~~~~

Correctable errors pose no impacts on the functionality of
the interface. The PCI Express protocol can recover without any
software intervention or any loss of data. These errors do not
require any recovery actions. The AER driver clears the device's
correctable error status register accordingly and logs these errors.

Non-correctable (non-fatal and fatal) errors
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

If an error message indicates a non-fatal error, performing link reset
at upstream is not required. The AER driver calls error_detected(dev,
pci_channel_io_normal) to all drivers associated within a hierarchy in
question. for example::

  EndPoint<==>DownstreamPort B<==>UpstreamPort A<==>RootPort

If Upstream port A captures an AER error, the hierarchy consists of
Downstream port B and EndPoint.

A driver may return PCI_ERS_RESULT_CAN_RECOVER,
PCI_ERS_RESULT_DISCONNECT, or PCI_ERS_RESULT_NEED_RESET, depending on
whether it can recover or the AER driver calls mmio_enabled as next.

If an error message indicates a fatal error, kernel will broadcast
error_detected(dev, pci_channel_io_frozen) to all drivers within
a hierarchy in question. Then, performing link reset at upstream is
necessary. As different kinds of devices might use different approaches
to reset link, AER port service driver is required to provide the
function to reset link via callback parameter of pcie_do_recovery()
function. If reset_link is not NULL, recovery function will use it
to reset the link. If error_detected returns PCI_ERS_RESULT_CAN_RECOVER
and reset_link returns PCI_ERS_RESULT_RECOVERED, the error handling goes
to mmio_enabled.

helper functions
----------------
::

  int pci_enable_pcie_error_reporting(struct pci_dev *dev);

pci_enable_pcie_error_reporting enables the device to send error
messages to root port when an error is detected. Note that devices
don't enable the error reporting by default, so device drivers need
call this function to enable it.

::

  int pci_disable_pcie_error_reporting(struct pci_dev *dev);

pci_disable_pcie_error_reporting disables the device to send error
messages to root port when an error is detected.

::

  int pci_aer_clear_nonfatal_status(struct pci_dev *dev);`

pci_aer_clear_nonfatal_status clears non-fatal errors in the uncorrectable
error status register.

Frequent Asked Questions
------------------------

Q:
  What happens if a PCI Express device driver does not provide an
  error recovery handler (pci_driver->err_handler is equal to NULL)?

A:
  The devices attached with the driver won't be recovered. If the
  error is fatal, kernel will print out warning messages. Please refer
  to section 3 for more information.

Q:
  What happens if an upstream port service driver does not provide
  callback reset_link?

A:
  Fatal error recovery will fail if the errors are reported by the
  upstream ports who are attached by the service driver.

Q:
  How does this infrastructure deal with driver that is not PCI
  Express aware?

A:
  This infrastructure calls the error callback functions of the
  driver when an error happens. But if the driver is not aware of
  PCI Express, the device might not report its own errors to root
  port.

Q:
  What modifications will that driver need to make it compatible
  with the PCI Express AER Root driver?

A:
  It could call the helper functions to enable AER in devices and
  cleanup uncorrectable status register. Pls. refer to section 3.3.

Software error injection
========================

Debugging PCIe AER error recovery code is quite difficult because it
is hard to trigger real hardware errors. Software based error
injection can be used to fake various kinds of PCIe errors.

First you should enable PCIe AER software error injection in kernel
configuration, that is, following item should be in your .config.

CONFIG_PCIEAER_INJECT=y or CONFIG_PCIEAER_INJECT=m

After reboot with new kernel or insert the module, a device file named
/dev/aer_inject should be created.

Then, you need a user space tool named aer-inject, which can be gotten
from:

    https://git.kernel.org/cgit/linux/kernel/git/gong.chen/aer-inject.git/

More information about aer-inject can be found in the document comes
with its source code.

repo_name: angery/linux


code:
.. SPDX-License-Identifier: GPL-2.0
.. include:: <isonum.txt>

===========================================
The PCI Express Port Bus Driver Guide HOWTO
===========================================

:Author: Tom L Nguyen tom.l.nguyen@intel.com 11/03/2004
:Copyright: |copy| 2004 Intel Corporation

About this guide
================

This guide describes the basics of the PCI Express Port Bus driver
and provides information on how to enable the service drivers to
register/unregister with the PCI Express Port Bus Driver.

What is the PCI Express Port Bus Driver
=======================================

A PCI Express Port is a logical PCI-PCI Bridge structure. There
are two types of PCI Express Port: the Root Port and the Switch
Port. The Root Port originates a PCI Express link from a PCI Express
Root Complex and the Switch Port connects PCI Express links to
internal logical PCI buses. The Switch Port, which has its secondary
bus representing the switch's internal routing logic, is called the
switch's Upstream Port. The switch's Downstream Port is bridging from
switch's internal routing bus to a bus representing the downstream
PCI Express link from the PCI Express Switch.

A PCI Express Port can provide up to four distinct functions,
referred to in this document as services, depending on its port type.
PCI Express Port's services include native hotplug support (HP),
power management event support (PME), advanced error reporting
support (AER), and virtual channel support (VC). These services may
be handled by a single complex driver or be individually distributed
and handled by corresponding service drivers.

Why use the PCI Express Port Bus Driver?
========================================

In existing Linux kernels, the Linux Device Driver Model allows a
physical device to be handled by only a single driver. The PCI
Express Port is a PCI-PCI Bridge device with multiple distinct
services. To maintain a clean and simple solution each service
may have its own software service driver. In this case several
service drivers will compete for a single PCI-PCI Bridge device.
For example, if the PCI Express Root Port native hotplug service
driver is loaded first, it claims a PCI-PCI Bridge Root Port. The
kernel therefore does not load other service drivers for that Root
Port. In other words, it is impossible to have multiple service
drivers load and run on a PCI-PCI Bridge device simultaneously
using the current driver model.

To enable multiple service drivers running simultaneously requires
having a PCI Express Port Bus driver, which manages all populated
PCI Express Ports and distributes all provided service requests
to the corresponding service drivers as required. Some key
advantages of using the PCI Express Port Bus driver are listed below:

  - Allow multiple service drivers to run simultaneously on
    a PCI-PCI Bridge Port device.

  - Allow service drivers implemented in an independent
    staged approach.

  - Allow one service driver to run on multiple PCI-PCI Bridge
    Port devices.

  - Manage and distribute resources of a PCI-PCI Bridge Port
    device to requested service drivers.

Configuring the PCI Express Port Bus Driver vs. Service Drivers
===============================================================

Including the PCI Express Port Bus Driver Support into the Kernel
-----------------------------------------------------------------

Including the PCI Express Port Bus driver depends on whether the PCI
Express support is included in the kernel config. The kernel will
automatically include the PCI Express Port Bus driver as a kernel
driver when the PCI Express support is enabled in the kernel.

Enabling Service Driver Support
-------------------------------

PCI device drivers are implemented based on Linux Device Driver Model.
All service drivers are PCI device drivers. As discussed above, it is
impossible to load any service driver once the kernel has loaded the
PCI Express Port Bus Driver. To meet the PCI Express Port Bus Driver
Model requires some minimal changes on existing service drivers that
imposes no impact on the functionality of existing service drivers.

A service driver is required to use the two APIs shown below to
register its service with the PCI Express Port Bus driver (see
section 5.2.1 & 5.2.2). It is important that a service driver
initializes the pcie_port_service_driver data structure, included in
header file /include/linux/pcieport_if.h, before calling these APIs.
Failure to do so will result an identity mismatch, which prevents
the PCI Express Port Bus driver from loading a service driver.

pcie_port_service_register
~~~~~~~~~~~~~~~~~~~~~~~~~~
::

  int pcie_port_service_register(struct pcie_port_service_driver *new)

This API replaces the Linux Driver Model's pci_register_driver API. A
service driver should always calls pcie_port_service_register at
module init. Note that after service driver being loaded, calls
such as pci_enable_device(dev) and pci_set_master(dev) are no longer
necessary since these calls are executed by the PCI Port Bus driver.

pcie_port_service_unregister
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
::

  void pcie_port_service_unregister(struct pcie_port_service_driver *new)

pcie_port_service_unregister replaces the Linux Driver Model's
pci_unregister_driver. It's always called by service driver when a
module exits.

Sample Code
~~~~~~~~~~~

Below is sample service driver code to initialize the port service
driver data structure.
::

  static struct pcie_port_service_id service_id[] = { {
    .vendor = PCI_ANY_ID,
    .device = PCI_ANY_ID,
    .port_type = PCIE_RC_PORT,
    .service_type = PCIE_PORT_SERVICE_AER,
    }, { /* end: all zeroes */ }
  };

  static struct pcie_port_service_driver root_aerdrv = {
    .name		= (char *)device_name,
    .id_table	= &service_id[0],

    .probe		= aerdrv_load,
    .remove		= aerdrv_unload,

    .suspend	= aerdrv_suspend,
    .resume		= aerdrv_resume,
  };

Below is a sample code for registering/unregistering a service
driver.
::

  static int __init aerdrv_service_init(void)
  {
    int retval = 0;

    retval = pcie_port_service_register(&root_aerdrv);
    if (!retval) {
      /*
      * FIX ME
      */
    }
    return retval;
  }

  static void __exit aerdrv_service_exit(void)
  {
    pcie_port_service_unregister(&root_aerdrv);
  }

  module_init(aerdrv_service_init);
  module_exit(aerdrv_service_exit);

Possible Resource Conflicts
===========================

Since all service drivers of a PCI-PCI Bridge Port device are
allowed to run simultaneously, below lists a few of possible resource
conflicts with proposed solutions.

MSI and MSI-X Vector Resource
-----------------------------

Once MSI or MSI-X interrupts are enabled on a device, it stays in this
mode until they are disabled again.  Since service drivers of the same
PCI-PCI Bridge port share the same physical device, if an individual
service driver enables or disables MSI/MSI-X mode it may result
unpredictable behavior.

To avoid this situation all service drivers are not permitted to
switch interrupt mode on its device. The PCI Express Port Bus driver
is responsible for determining the interrupt mode and this should be
transparent to service drivers. Service drivers need to know only
the vector IRQ assigned to the field irq of struct pcie_device, which
is passed in when the PCI Express Port Bus driver probes each service
driver. Service drivers should use (struct pcie_device*)dev->irq to
call request_irq/free_irq. In addition, the interrupt mode is stored
in the field interrupt_mode of struct pcie_device.

PCI Memory/IO Mapped Regions
----------------------------

Service drivers for PCI Express Power Management (PME), Advanced
Error Reporting (AER), Hot-Plug (HP) and Virtual Channel (VC) access
PCI configuration space on the PCI Express port. In all cases the
registers accessed are independent of each other. This patch assumes
that all service drivers will be well behaved and not overwrite
other service driver's configuration settings.

PCI Config Registers
--------------------

Each service driver runs its PCI config operations on its own
capability structure except the PCI Express capability structure, in
which Root Control register and Device Control register are shared
between PME and AER. This patch assumes that all service drivers
will be well behaved and not overwrite other service driver's
configuration settings.


code:
.. SPDX-License-Identifier: GPL-2.0

============================================
Accessing PCI device resources through sysfs
============================================

sysfs, usually mounted at /sys, provides access to PCI resources on platforms
that support it.  For example, a given bus might look like this::

     /sys/devices/pci0000:17
     |-- 0000:17:00.0
     |   |-- class
     |   |-- config
     |   |-- device
     |   |-- enable
     |   |-- irq
     |   |-- local_cpus
     |   |-- remove
     |   |-- resource
     |   |-- resource0
     |   |-- resource1
     |   |-- resource2
     |   |-- revision
     |   |-- rom
     |   |-- subsystem_device
     |   |-- subsystem_vendor
     |   `-- vendor
     `-- ...

The topmost element describes the PCI domain and bus number.  In this case,
the domain number is 0000 and the bus number is 17 (both values are in hex).
This bus contains a single function device in slot 0.  The domain and bus
numbers are reproduced for convenience.  Under the device directory are several
files, each with their own function.

       =================== =====================================================
       file		   function
       =================== =====================================================
       class		   PCI class (ascii, ro)
       config		   PCI config space (binary, rw)
       device		   PCI device (ascii, ro)
       enable	           Whether the device is enabled (ascii, rw)
       irq		   IRQ number (ascii, ro)
       local_cpus	   nearby CPU mask (cpumask, ro)
       remove		   remove device from kernel's list (ascii, wo)
       resource		   PCI resource host addresses (ascii, ro)
       resource0..N	   PCI resource N, if present (binary, mmap, rw\ [1]_)
       resource0_wc..N_wc  PCI WC map resource N, if prefetchable (binary, mmap)
       revision		   PCI revision (ascii, ro)
       rom		   PCI ROM resource, if present (binary, ro)
       subsystem_device	   PCI subsystem device (ascii, ro)
       subsystem_vendor	   PCI subsystem vendor (ascii, ro)
       vendor		   PCI vendor (ascii, ro)
       =================== =====================================================

::

  ro - read only file
  rw - file is readable and writable
  wo - write only file
  mmap - file is mmapable
  ascii - file contains ascii text
  binary - file contains binary data
  cpumask - file contains a cpumask type

.. [1] rw for IORESOURCE_IO (I/O port) regions only

The read only files are informational, writes to them will be ignored, with
the exception of the 'rom' file.  Writable files can be used to perform
actions on the device (e.g. changing config space, detaching a device).
mmapable files are available via an mmap of the file at offset 0 and can be
used to do actual device programming from userspace.  Note that some platforms
don't support mmapping of certain resources, so be sure to check the return
value from any attempted mmap.  The most notable of these are I/O port
resources, which also provide read/write access.

The 'enable' file provides a counter that indicates how many times the device
has been enabled.  If the 'enable' file currently returns '4', and a '1' is
echoed into it, it will then return '5'.  Echoing a '0' into it will decrease
the count.  Even when it returns to 0, though, some of the initialisation
may not be reversed.

The 'rom' file is special in that it provides read-only access to the device's
ROM file, if available.  It's disabled by default, however, so applications
should write the string "1" to the file to enable it before attempting a read
call, and disable it following the access by writing "0" to the file.  Note
that the device must be enabled for a rom read to return data successfully.
In the event a driver is not bound to the device, it can be enabled using the
'enable' file, documented above.

The 'remove' file is used to remove the PCI device, by writing a non-zero
integer to the file.  This does not involve any kind of hot-plug functionality,
e.g. powering off the device.  The device is removed from the kernel's list of
PCI devices, the sysfs directory for it is removed, and the device will be
removed from any drivers attached to it. Removal of PCI root buses is
disallowed.

Accessing legacy resources through sysfs
----------------------------------------

Legacy I/O port and ISA memory resources are also provided in sysfs if the
underlying platform supports them.  They're located in the PCI class hierarchy,
e.g.::

	/sys/class/pci_bus/0000:17/
	|-- bridge -> ../../../devices/pci0000:17
	|-- cpuaffinity
	|-- legacy_io
	`-- legacy_mem

The legacy_io file is a read/write file that can be used by applications to
do legacy port I/O.  The application should open the file, seek to the desired
port (e.g. 0x3e8) and do a read or a write of 1, 2 or 4 bytes.  The legacy_mem
file should be mmapped with an offset corresponding to the memory offset
desired, e.g. 0xa0000 for the VGA frame buffer.  The application can then
simply dereference the returned pointer (after checking for errors of course)
to access legacy memory space.

Supporting PCI access on new platforms
--------------------------------------

In order to support PCI resource mapping as described above, Linux platform
code should ideally define ARCH_GENERIC_PCI_MMAP_RESOURCE and use the generic
implementation of that functionality. To support the historical interface of
mmap() through files in /proc/bus/pci, platforms may also set HAVE_PCI_MMAP.

Alternatively, platforms which set HAVE_PCI_MMAP may provide their own
implementation of pci_mmap_resource_range() instead of defining
ARCH_GENERIC_PCI_MMAP_RESOURCE.

Platforms which support write-combining maps of PCI resources must define
arch_can_pci_mmap_wc() which shall evaluate to non-zero at runtime when
write-combining is permitted. Platforms which support maps of I/O resources
define arch_can_pci_mmap_io() similarly.

Legacy resources are protected by the HAVE_PCI_LEGACY define.  Platforms
wishing to support legacy functionality should define it and provide
pci_legacy_read, pci_legacy_write and pci_mmap_legacy_page_range functions.


code:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Creator: fig2dev Version 3.2 Patchlevel 5e -->

<!-- CreationDate: Wed Dec  9 17:28:20 2015 -->

<!-- Magnification: 3.000 -->

<svg
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:cc="http://creativecommons.org/ns#"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:svg="http://www.w3.org/2000/svg"
   xmlns="http://www.w3.org/2000/svg"
   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
   width="9.1in"
   height="8.9in"
   viewBox="-66 -66 10932 10707"
   id="svg2"
   version="1.1"
   inkscape:version="0.48.4 r9939"
   sodipodi:docname="BigTreeClassicRCU.fig">
  <metadata
     id="metadata106">
    <rdf:RDF>
      <cc:Work
         rdf:about="">
        <dc:format>image/svg+xml</dc:format>
        <dc:type
           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
        <dc:title></dc:title>
      </cc:Work>
    </rdf:RDF>
  </metadata>
  <defs
     id="defs104">
    <marker
       inkscape:stockid="Arrow1Mend"
       orient="auto"
       refY="0.0"
       refX="0.0"
       id="Arrow1Mend"
       style="overflow:visible;">
      <path
         id="path3864"
         d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
         style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;"
         transform="scale(0.4) rotate(180) translate(10,0)" />
    </marker>
  </defs>
  <sodipodi:namedview
     pagecolor="#ffffff"
     bordercolor="#666666"
     borderopacity="1"
     objecttolerance="10"
     gridtolerance="10"
     guidetolerance="10"
     inkscape:pageopacity="0"
     inkscape:pageshadow="2"
     inkscape:window-width="973"
     inkscape:window-height="1137"
     id="namedview102"
     showgrid="false"
     inkscape:zoom="0.9743589"
     inkscape:cx="409.50003"
     inkscape:cy="400.49997"
     inkscape:window-x="915"
     inkscape:window-y="24"
     inkscape:window-maximized="0"
     inkscape:current-layer="g4" />
  <g
     style="stroke-width:.025in; fill:none"
     id="g4">
    <!-- Line: box -->
    <rect
       x="0"
       y="0"
       width="10800"
       height="5625"
       rx="0"
       style="stroke:#000000;stroke-width:45; stroke-linejoin:miter; stroke-linecap:butt; fill:#ffff00; "
       id="rect6" />
    <!-- Line: box -->
    <rect
       x="1125"
       y="3600"
       width="2700"
       height="1350"
       rx="0"
       style="stroke:#000000;stroke-width:45; stroke-linejoin:miter; stroke-linecap:butt; fill:#ffbfbf; "
       id="rect8" />
    <!-- Line: box -->
    <rect
       x="3825"
       y="900"
       width="2700"
       height="1350"
       rx="0"
       style="stroke:#000000;stroke-width:45; stroke-linejoin:miter; stroke-linecap:butt; fill:#ffbfbf; "
       id="rect10" />
    <!-- Line: box -->
    <rect
       x="6525"
       y="3600"
       width="2700"
       height="1350"
       rx="0"
       style="stroke:#000000;stroke-width:45; stroke-linejoin:miter; stroke-linecap:butt; fill:#ffbfbf; "
       id="rect12" />
    <!-- Line -->
    <polyline
       points="3375,6525 3375,5046 "
       style="stroke:#00d1d1;stroke-width:44.9934641;stroke-linejoin:miter;stroke-linecap:butt;stroke-miterlimit:4;stroke-dasharray:none;marker-end:url(#Arrow1Mend)"
       id="polyline14" />
    <!-- Arrowhead on XXXpoint 3375 6525 - 3375 4860-->
    <!-- Circle -->
    <circle
       cx="7425"
       cy="6075"
       r="114"
       style="fill:#000000;stroke:#000000;stroke-width:21;"
       id="circle18" />
    <!-- Circle -->
    <circle
       cx="7875"
       cy="6075"
       r="114"
       style="fill:#000000;stroke:#000000;stroke-width:21;"
       id="circle20" />
    <!-- Circle -->
    <circle
       cx="8325"
       cy="6075"
       r="114"
       style="fill:#000000;stroke:#000000;stroke-width:21;"
       id="circle22" />
    <!-- Circle -->
    <circle
       cx="2025"
       cy="6075"
       r="114"
       style="fill:#000000;stroke:#000000;stroke-width:21;"
       id="circle24" />
    <!-- Circle -->
    <circle
       cx="2475"
       cy="6075"
       r="114"
       style="fill:#000000;stroke:#000000;stroke-width:21;"
       id="circle26" />
    <!-- Circle -->
    <circle
       cx="2925"
       cy="6075"
       r="114"
       style="fill:#000000;stroke:#000000;stroke-width:21;"
       id="circle28" />
    <!-- Circle -->
    <circle
       cx="4725"
       cy="4275"
       r="114"
       style="fill:#000000;stroke:#000000;stroke-width:21;"
       id="circle30" />
    <!-- Circle -->
    <circle
       cx="5175"
       cy="4275"
       r="114"
       style="fill:#000000;stroke:#000000;stroke-width:21;"
       id="circle32" />
    <!-- Circle -->
    <circle
       cx="5625"
       cy="4275"
       r="114"
       style="fill:#000000;stroke:#000000;stroke-width:21;"
       id="circle34" />
    <!-- Line: box -->
    <rect
       x="2025"
       y="6525"
       width="2700"
       height="1800"
       rx="0"
       style="stroke:#000000;stroke-width:45; stroke-linejoin:miter; stroke-linecap:butt; "
       id="rect36" />
    <!-- Line -->
    <polyline
       points="2475,3600 3975,2310 "
       style="stroke:#00d1d1;stroke-width:44.9934641;stroke-linejoin:miter;stroke-linecap:butt;stroke-miterlimit:4;stroke-dasharray:none;marker-end:url(#Arrow1Mend)"
       id="polyline38" />
    <!-- Arrowhead on XXXpoint 2475 3600 - 4116 2190-->
    <!-- Line -->
    <polyline
       points="7875,3600 6372,2310 "
       style="stroke:#00d1d1;stroke-width:44.9934641;stroke-linejoin:miter;stroke-linecap:butt;stroke-miterlimit:4;stroke-dasharray:none;marker-end:url(#Arrow1Mend)"
       id="polyline42" />
    <!-- Arrowhead on XXXpoint 7875 3600 - 6231 2190-->
    <!-- Line -->
    <polyline
       points="6975,8775 6975,5046 "
       style="stroke:#00d1d1;stroke-width:44.9934641;stroke-linejoin:miter;stroke-linecap:butt;stroke-miterlimit:4;stroke-dasharray:none;marker-end:url(#Arrow1Mend)"
       id="polyline46" />
    <!-- Arrowhead on XXXpoint 6975 8775 - 6975 4860-->
    <!-- Line -->
    <polyline
       points="1575,8775 1575,5046 "
       style="stroke:#00d1d1;stroke-width:44.9934641;stroke-linejoin:miter;stroke-linecap:butt;stroke-miterlimit:4;stroke-dasharray:none;marker-end:url(#Arrow1Mend)"
       id="polyline50" />
    <!-- Arrowhead on XXXpoint 1575 8775 - 1575 4860-->
    <!-- Line -->
    <polyline
       points="8775,6525 8775,5046 "
       style="stroke:#00d1d1;stroke-width:44.9934641;stroke-linejoin:miter;stroke-linecap:butt;stroke-miterlimit:4;stroke-dasharray:none;marker-end:url(#Arrow1Mend)"
       id="polyline54" />
    <!-- Arrowhead on XXXpoint 8775 6525 - 8775 4860-->
    <!-- Text -->
    <text
       xml:space="preserve"
       x="1575"
       y="9225"
       fill="#000000"
       font-family="Courier"
       font-style="normal"
       font-weight="bold"
       font-size="288"
       text-anchor="middle"
       id="text58">struct</text>
    <!-- Text -->
    <text
       xml:space="preserve"
       x="1575"
       y="9675"
       fill="#000000"
       font-family="Courier"
       font-style="normal"
       font-weight="bold"
       font-size="288"
       text-anchor="middle"
       id="text60">rcu_data</text>
    <!-- Text -->
    <text
       xml:space="preserve"
       x="1575"
       y="10350"
       fill="#000000"
       font-family="Helvetica"
       font-style="normal"
       font-weight="normal"
       font-size="324"
       text-anchor="middle"
       id="text62">CPU 0</text>
    <!-- Text -->
    <text
       xml:space="preserve"
       x="3375"
       y="6975"
       fill="#000000"
       font-family="Courier"
       font-style="normal"
       font-weight="bold"
       font-size="288"
       text-anchor="middle"
       id="text64">struct</text>
    <!-- Text -->
    <text
       xml:space="preserve"
       x="3375"
       y="7425"
       fill="#000000"
       font-family="Courier"
       font-style="normal"
       font-weight="bold"
       font-size="288"
       text-anchor="middle"
       id="text66">rcu_data</text>
    <!-- Text -->
    <text
       xml:space="preserve"
       x="3375"
       y="8100"
       fill="#000000"
       font-family="Helvetica"
       font-style="normal"
       font-weight="normal"
       font-size="324"
       text-anchor="middle"
       id="text68">CPU 15</text>
    <!-- Text -->
    <text
       xml:space="preserve"
       x="6975"
       y="9225"
       fill="#000000"
       font-family="Courier"
       font-style="normal"
       font-weight="bold"
       font-size="288"
       text-anchor="middle"
       id="text70">struct</text>
    <!-- Text -->
    <text
       xml:space="preserve"
       x="6975"
       y="9675"
       fill="#000000"
       font-family="Courier"
       font-style="normal"
       font-weight="bold"
       font-size="288"
       text-anchor="middle"
       id="text72">rcu_data</text>
    <!-- Text -->
    <text
       xml:space="preserve"
       x="6975"
       y="10350"
       fill="#000000"
       font-family="Helvetica"
       font-style="normal"
       font-weight="normal"
       font-size="324"
       text-anchor="middle"
       id="text74">CPU 1007</text>
    <!-- Text -->
    <text
       xml:space="preserve"
       x="8730"
       y="6930"
       fill="#000000"
       font-family="Courier"
       font-style="normal"
       font-weight="bold"
       font-size="288"
       text-anchor="middle"
       id="text76">struct</text>
    <!-- Text -->
    <text
       xml:space="preserve"
       x="8730"
       y="7380"
       fill="#000000"
       font-family="Courier"
       font-style="normal"
       font-weight="bold"
       font-size="288"
       text-anchor="middle"
       id="text78">rcu_data</text>
    <!-- Text -->
    <text
       xml:space="preserve"
       x="8730"
       y="8055"
       fill="#000000"
       font-family="Helvetica"
       font-style="normal"
       font-weight="normal"
       font-size="324"
       text-anchor="middle"
       id="text80">CPU 1023</text>
    <!-- Text -->
    <text
       xml:space="preserve"
       x="225"
       y="450"
       fill="#000000"
       font-family="Courier"
       font-style="normal"
       font-weight="bold"
       font-size="288"
       text-anchor="start"
       id="text82">struct rcu_state</text>
    <!-- Text -->
    <text
       xml:space="preserve"
       x="2475"
       y="4050"
       fill="#000000"
       font-family="Courier"
       font-style="normal"
       font-weight="bold"
       font-size="288"
       text-anchor="middle"
       id="text84">struct</text>
    <!-- Text -->
    <text
       xml:space="preserve"
       x="2475"
       y="4500"
       fill="#000000"
       font-family="Courier"
       font-style="normal"
       font-weight="bold"
       font-size="288"
       text-anchor="middle"
       id="text86">rcu_node</text>
    <!-- Text -->
    <text
       xml:space="preserve"
       x="7875"
       y="4500"
       fill="#000000"
       font-family="Courier"
       font-style="normal"
       font-weight="bold"
       font-size="288"
       text-anchor="middle"
       id="text88">rcu_node</text>
    <!-- Text -->
    <text
       xml:space="preserve"
       x="7875"
       y="4050"
       fill="#000000"
       font-family="Courier"
       font-style="normal"
       font-weight="bold"
       font-size="288"
       text-anchor="middle"
       id="text90">struct</text>
    <!-- Text -->
    <text
       xml:space="preserve"
       x="5175"
       y="1350"
       fill="#000000"
       font-family="Courier"
       font-style="normal"
       font-weight="bold"
       font-size="288"
       text-anchor="middle"
       id="text92">struct</text>
    <!-- Text -->
    <text
       xml:space="preserve"
       x="5175"
       y="1800"
       fill="#000000"
       font-family="Courier"
       font-style="normal"
       font-weight="bold"
       font-size="288"
       text-anchor="middle"
       id="text94">rcu_node</text>
    <!-- Line: box -->
    <rect
       x="225"
       y="8775"
       width="2700"
       height="1800"
       rx="0"
       style="stroke:#000000;stroke-width:45; stroke-linejoin:miter; stroke-linecap:butt; "
       id="rect96" />
    <!-- Line: box -->
    <rect
       x="5625"
       y="8775"
       width="2700"
       height="1800"
       rx="0"
       style="stroke:#000000;stroke-width:45; stroke-linejoin:miter; stroke-linecap:butt; "
       id="rect98" />
    <!-- Line: box -->
    <rect
       x="7380"
       y="6480"
       width="2700"
       height="1800"
       rx="0"
       style="stroke:#000000;stroke-width:45; stroke-linejoin:miter; stroke-linecap:butt; "
       id="rect100" />
  </g>
</svg>


code:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Creator: fig2dev Version 3.2 Patchlevel 5e -->

<!-- CreationDate: Wed Dec  9 17:29:48 2015 -->

<!-- Magnification: 2.000 -->

<svg
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:cc="http://creativecommons.org/ns#"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:svg="http://www.w3.org/2000/svg"
   xmlns="http://www.w3.org/2000/svg"
   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
   width="7.4000001in"
   height="7.9000001in"
   viewBox="-44 -44 8938 9526.283"
   id="svg2"
   version="1.1"
   inkscape:version="0.92.2pre0 (973e216, 2017-07-25)"
   sodipodi:docname="BigTreePreemptRCUBHdyntickCB.svg">
  <metadata
     id="metadata212">
    <rdf:RDF>
      <cc:Work
         rdf:about="">
        <dc:format>image/svg+xml</dc:format>
        <dc:type
           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
        <dc:title></dc:title>
      </cc:Work>
    </rdf:RDF>
  </metadata>
  <defs
     id="defs210">
    <marker
       inkscape:stockid="Arrow1Mend"
       orient="auto"
       refY="0"
       refX="0"
       id="marker1177"
       style="overflow:visible"
       inkscape:isstock="true">
      <path
         id="path897"
         d="M 0,0 5,-5 -12.5,0 5,5 Z"
         style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1"
         transform="matrix(-0.4,0,0,-0.4,-4,0)"
         inkscape:connector-curvature="0" />
    </marker>
    <marker
       inkscape:stockid="Arrow1Lend"
       orient="auto"
       refY="0"
       refX="0"
       id="Arrow1Lend"
       style="overflow:visible"
       inkscape:isstock="true">
      <path
         id="path891"
         d="M 0,0 5,-5 -12.5,0 5,5 Z"
         style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1"
         transform="matrix(-0.8,0,0,-0.8,-10,0)"
         inkscape:connector-curvature="0" />
    </marker>
    <marker
       inkscape:stockid="Arrow1Mend"
       orient="auto"
       refY="0"
       refX="0"
       id="Arrow1Mend"
       style="overflow:visible">
      <path
         id="path3970"
         d="M 0,0 5,-5 -12.5,0 5,5 Z"
         style="fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt"
         transform="matrix(-0.4,0,0,-0.4,-4,0)"
         inkscape:connector-curvature="0" />
    </marker>
  </defs>
  <sodipodi:namedview
     pagecolor="#ffffff"
     bordercolor="#666666"
     borderopacity="1"
     objecttolerance="10"
     gridtolerance="10"
     guidetolerance="10"
     inkscape:pageopacity="0"
     inkscape:pageshadow="2"
     inkscape:window-width="1920"
     inkscape:window-height="1019"
     id="namedview208"
     showgrid="false"
     inkscape:zoom="1.0195195"
     inkscape:cx="166.25478"
     inkscape:cy="362.18693"
     inkscape:window-x="0"
     inkscape:window-y="0"
     inkscape:window-maximized="1"
     inkscape:current-layer="g4" />
  <g
     style="fill:none;stroke-width:0.025in"
     id="g4"
     transform="translate(0,-2415.6743)">
    <!-- Line: box -->
    <!-- Line: box -->
    <!-- Line: box -->
    <!-- Line: box -->
    <!-- Line: box -->
    <!-- Line: box -->
    <!-- Line -->
    <!-- Arrowhead on XXXpoint 5250 8550 - 5710 6240-->
    <polyline
       points="5714 6518 5704 6272 5598 6494 "
       style="stroke:#00ff00;stroke-width:14;stroke-miterlimit:8"
       id="polyline20"
       transform="matrix(1,0,0,0.95854605,12.340758,1579.9033)" />
    <!-- Line -->
    <!-- Arrowhead on XXXpoint 4050 9750 - 4512 7590-->
    <polyline
       points="4514 7868 4506 7622 4396 7844 "
       style="stroke:#00ff00;stroke-width:14;stroke-miterlimit:8"
       id="polyline24"
       transform="matrix(1,0,0,0.95854605,12.340758,1579.9033)" />
    <!-- Line -->
    <!-- Arrowhead on XXXpoint 1040 9750 - 1502 7590-->
    <polyline
       points="1504 7868 1496 7622 1386 7844 "
       style="stroke:#00ff00;stroke-width:14;stroke-miterlimit:8"
       id="polyline28"
       transform="matrix(1,0,0,0.95854605,12.340758,1579.9033)" />
    <!-- Line -->
    <!-- Arrowhead on XXXpoint 2240 8550 - 2702 6390-->
    <polyline
       points="2704 6668 2696 6422 2586 6644 "
       style="stroke:#00ff00;stroke-width:14;stroke-miterlimit:8"
       id="polyline32"
       transform="matrix(1,0,0,0.95854605,12.340758,1579.9033)" />
    <!-- Line -->
    <!-- Arrowhead on XXXpoint 4050 9600 - 5744 5948-->
    <polyline
       points="5682 6220 5730 5978 5574 6170 "
       style="stroke:#00ff00;stroke-width:14;stroke-miterlimit:8"
       id="polyline36"
       transform="matrix(1,0,0,0.95854605,12.340758,1579.9033)" />
    <!-- Line -->
    <!-- Arrowhead on XXXpoint 1086 9600 - 2780 5948-->
    <polyline
       points="2718 6220 2766 5978 2610 6170 "
       style="stroke:#00ff00;stroke-width:14;stroke-miterlimit:8"
       id="polyline40"
       transform="matrix(1,0,0,0.95854605,12.340758,1579.9033)" />
    <!-- Line: box -->
    <rect
       x="12.340758"
       y="2442.5947"
       width="6300"
       height="7045.3135"
       rx="0"
       style="fill:#ffffff;stroke:#000000;stroke-width:29.37160873;stroke-linecap:butt;stroke-linejoin:miter"
       id="rect42" />
    <!-- Line: box -->
    <rect
       x="312.34076"
       y="3017.7224"
       width="5700"
       height="3594.5476"
       rx="0"
       style="fill:#ffff00;stroke:#000000;stroke-width:29.37160873;stroke-linecap:butt;stroke-linejoin:miter"
       id="rect44" />
    <!-- Line -->
    <polyline
       points="1350,3900 2350,3040 "
       style="stroke:#00d1d1;stroke-width:29.99464035;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;marker-end:url(#Arrow1Mend)"
       id="polyline46"
       transform="matrix(1,0,0,0.95854605,12.340758,1579.9033)" />
    <!-- Arrowhead on XXXpoint 1350 3900 - 2444 2960-->
    <!-- Line -->
    <polyline
       points="4950,3900 3948,3040 "
       style="stroke:#00d1d1;stroke-width:29.99464035;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;marker-end:url(#Arrow1Mend)"
       id="polyline50"
       transform="matrix(1,0,0,0.95854605,12.340758,1579.9033)" />
    <!-- Arrowhead on XXXpoint 4950 3900 - 3854 2960-->
    <!-- Line -->
    <polyline
       points="4050,7050 4050,4864 "
       style="stroke:#00d1d1;stroke-width:29.99464035;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;marker-end:url(#Arrow1Mend)"
       id="polyline54"
       transform="matrix(1,0,0,0.95854605,12.340758,1579.9033)" />
    <!-- Arrowhead on XXXpoint 4050 7050 - 4050 4740-->
    <!-- Line -->
    <polyline
       points="1050,7050 1050,4864 "
       style="stroke:#00d1d1;stroke-width:29.99464035;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;marker-end:url(#Arrow1Mend)"
       id="polyline58"
       transform="matrix(1,0,0,0.95854605,12.340758,1579.9033)" />
    <!-- Arrowhead on XXXpoint 1050 7050 - 1050 4740-->
    <!-- Line -->
    <polyline
       points="2250,5850 2250,4864 "
       style="stroke:#00d1d1;stroke-width:29.99464035;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;marker-end:url(#Arrow1Mend)"
       id="polyline62"
       transform="matrix(1,0,0,0.95854605,12.340758,1579.9033)" />
    <!-- Arrowhead on XXXpoint 2250 5850 - 2250 4740-->
    <!-- Line -->
    <!-- Arrowhead on XXXpoint 2250 8550 - 2250 6690-->
    <!-- Line -->
    <!-- Arrowhead on XXXpoint 1050 9750 - 1050 7890-->
    <!-- Line -->
    <!-- Arrowhead on XXXpoint 4050 9750 - 4050 7890-->
    <!-- Line -->
    <!-- Arrowhead on XXXpoint 5250 8550 - 5250 6690-->
    <!-- Line -->
    <!-- Arrowhead on XXXpoint 6000 6300 - 8146 7986-->
    <!-- Circle -->
    <ellipse
       cx="2862.3408"
       cy="5749.5786"
       style="fill:#000000;stroke:#000000;stroke-width:13.70675087"
       id="circle86"
       rx="76"
       ry="72.849495" />
    <!-- Circle -->
    <ellipse
       cx="3162.3408"
       cy="5749.5786"
       style="fill:#000000;stroke:#000000;stroke-width:13.70675087"
       id="circle88"
       rx="76"
       ry="72.849495" />
    <!-- Circle -->
    <ellipse
       cx="3462.3408"
       cy="5749.5786"
       style="fill:#000000;stroke:#000000;stroke-width:13.70675087"
       id="circle90"
       rx="76"
       ry="72.849495" />
    <!-- Circle -->
    <ellipse
       cx="1362.3407"
       cy="6899.834"
       style="fill:#000000;stroke:#000000;stroke-width:13.70675087"
       id="circle92"
       rx="76"
       ry="72.849495" />
    <!-- Circle -->
    <ellipse
       cx="1662.3407"
       cy="6899.834"
       style="fill:#000000;stroke:#000000;stroke-width:13.70675087"
       id="circle94"
       rx="76"
       ry="72.849495" />
    <!-- Circle -->
    <ellipse
       cx="1962.3407"
       cy="6899.834"
       style="fill:#000000;stroke:#000000;stroke-width:13.70675087"
       id="circle96"
       rx="76"
       ry="72.849495" />
    <!-- Circle -->
    <ellipse
       cx="4362.3408"
       cy="6899.834"
       style="fill:#000000;stroke:#000000;stroke-width:13.70675087"
       id="circle98"
       rx="76"
       ry="72.849495" />
    <!-- Circle -->
    <ellipse
       cx="4662.3408"
       cy="6899.834"
       style="fill:#000000;stroke:#000000;stroke-width:13.70675087"
       id="circle100"
       rx="76"
       ry="72.849495" />
    <!-- Circle -->
    <ellipse
       cx="4962.3408"
       cy="6899.834"
       style="fill:#000000;stroke:#000000;stroke-width:13.70675087"
       id="circle102"
       rx="76"
       ry="72.849495" />
    <!-- Line: box -->
    <rect
       x="6745.3027"
       y="8146.0654"
       width="1500"
       height="862.69141"
       rx="0"
       style="stroke:#000000;stroke-width:29.37160873;stroke-linecap:butt;stroke-linejoin:miter"
       id="rect104" />
    <!-- Line: box -->
    <rect
       x="6745.3027"
       y="9583.8857"
       width="1500"
       height="862.69141"
       rx="0"
       style="stroke:#000000;stroke-width:29.37160873;stroke-linecap:butt;stroke-linejoin:miter"
       id="rect106" />
    <!-- Line -->
    <polyline
       points="8100,8850 8100,9384 "
       style="stroke:#000000;stroke-width:30;stroke-linecap:butt;stroke-linejoin:miter;marker-end:url(#Arrow1Mend)"
       id="polyline108"
       transform="matrix(1,0,0,0.95854605,-604.69715,525.62477)" />
    <!-- Arrowhead on XXXpoint 8100 8850 - 8100 9510-->
    <!-- Line: box -->
    <rect
       x="6745.3027"
       y="11021.704"
       width="1500"
       height="862.69141"
       rx="0"
       style="stroke:#000000;stroke-width:29.37160873;stroke-linecap:butt;stroke-linejoin:miter"
       id="rect112" />
    <!-- Line -->
    <polyline
       points="8100,10350 8100,10884 "
       style="stroke:#000000;stroke-width:30;stroke-linecap:butt;stroke-linejoin:miter;marker-end:url(#Arrow1Mend)"
       id="polyline114"
       transform="matrix(1,0,0,0.95854605,-604.69715,525.62477)" />
    <!-- Arrowhead on XXXpoint 8100 10350 - 8100 11010-->
    <!-- Line: box -->
    <rect
       x="762.34076"
       y="5318.2324"
       width="1800"
       height="862.69141"
       rx="0"
       style="fill:#ffbfbf;stroke:#000000;stroke-width:29.37160873;stroke-linecap:butt;stroke-linejoin:miter"
       id="rect118" />
    <!-- Line: box -->
    <rect
       x="312.34076"
       y="8337.6533"
       width="1500"
       height="862.69141"
       rx="0"
       style="fill:#87cfff;stroke:#000000;stroke-width:29.37160873;stroke-linecap:butt;stroke-linejoin:miter"
       id="rect120" />
    <!-- Line: box -->
    <rect
       x="3762.3408"
       y="5318.2324"
       width="1800"
       height="862.69141"
       rx="0"
       style="fill:#ffbfbf;stroke:#000000;stroke-width:29.37160873;stroke-linecap:butt;stroke-linejoin:miter"
       id="rect122" />
    <!-- Line: box -->
    <rect
       x="4512.3408"
       y="7187.3975"
       width="1500"
       height="862.69141"
       rx="0"
       style="fill:#87cfff;stroke:#000000;stroke-width:29.37160873;stroke-linecap:butt;stroke-linejoin:miter"
       id="rect124" />
    <!-- Line: box -->
    <rect
       x="3312.3408"
       y="8337.6533"
       width="1500"
       height="862.69141"
       rx="0"
       style="fill:#87cfff;stroke:#000000;stroke-width:29.37160873;stroke-linecap:butt;stroke-linejoin:miter"
       id="rect126" />
    <!-- Line: box -->
    <rect
       x="2262.3408"
       y="3592.8503"
       width="1800"
       height="862.69141"
       rx="0"
       style="fill:#ffbfbf;stroke:#000000;stroke-width:29.37160873;stroke-linecap:butt;stroke-linejoin:miter"
       id="rect128" />
    <!-- Line: box -->
    <!-- Line: box -->
    <!-- Line: box -->
    <!-- Line: box -->
    <!-- Line: box -->
    <rect
       x="1512.3407"
       y="7187.3975"
       width="1500"
       height="862.69141"
       rx="0"
       style="fill:#87cfff;stroke:#000000;stroke-width:29.37160873;stroke-linecap:butt;stroke-linejoin:miter"
       id="rect138" />
    <!-- Text -->
    <text
       xml:space="preserve"
       x="7338.3037"
       y="8614.0625"
       font-style="normal"
       font-weight="bold"
       font-size="192"
       id="text140"
       style="font-style:normal;font-weight:bold;font-size:187.978302px;font-family:Courier;text-anchor:middle;fill:#000000;stroke-width:0.02447634in"
       transform="scale(1.0213945,0.97905363)">struct</text>
    <!-- Text -->
    <text
       xml:space="preserve"
       x="7338.3037"
       y="8907.7783"
       font-style="normal"
       font-weight="bold"
       font-size="192"
       id="text142"
       style="font-style:normal;font-weight:bold;font-size:187.978302px;font-family:Courier;text-anchor:middle;fill:#000000;stroke-width:0.02447634in"
       transform="scale(1.0213945,0.97905363)">rcu_head</text>
    <!-- Text -->
    <text
       xml:space="preserve"
       x="7338.3037"
       y="10082.644"
       font-style="normal"
       font-weight="bold"
       font-size="192"
       id="text144"
       style="font-style:normal;font-weight:bold;font-size:187.978302px;font-family:Courier;text-anchor:middle;fill:#000000;stroke-width:0.02447634in"
       transform="scale(1.0213945,0.97905363)">struct</text>
    <!-- Text -->
    <text
       xml:space="preserve"
       x="7338.3037"
       y="10376.36"
       font-style="normal"
       font-weight="bold"
       font-size="192"
       id="text146"
       style="font-style:normal;font-weight:bold;font-size:187.978302px;font-family:Courier;text-anchor:middle;fill:#000000;stroke-width:0.02447634in"
       transform="scale(1.0213945,0.97905363)">rcu_head</text>
    <!-- Text -->
    <text
       xml:space="preserve"
       x="7338.3037"
       y="11551.224"
       font-style="normal"
       font-weight="bold"
       font-size="192"
       id="text148"
       style="font-style:normal;font-weight:bold;font-size:187.978302px;font-family:Courier;text-anchor:middle;fill:#000000;stroke-width:0.02447634in"
       transform="scale(1.0213945,0.97905363)">struct</text>
    <!-- Text -->
    <text
       xml:space="preserve"
       x="7338.3037"
       y="11844.94"
       font-style="normal"
       font-weight="bold"
       font-size="192"
       id="text150"
       style="font-style:normal;font-weight:bold;font-size:187.978302px;font-family:Courier;text-anchor:middle;fill:#000000;stroke-width:0.02447634in"
       transform="scale(1.0213945,0.97905363)">rcu_head</text>
    <!-- Text -->
    <text
       xml:space="preserve"
       x="5886.4043"
       y="2788.5688"
       font-style="normal"
       font-weight="normal"
       font-size="192"
       id="text152"
       style="font-style:normal;font-weight:normal;font-size:187.978302px;font-family:Helvetica;text-anchor:end;fill:#000000;stroke-width:0.02447634in"
       transform="scale(1.0213945,0.97905363)">rcu_state</text>
    <!-- Text -->
    <!-- Text -->
    <text
       xml:space="preserve"
       x="3096.1016"
       y="3963.4336"
       font-style="normal"
       font-weight="bold"
       font-size="192"
       id="text156"
       style="font-style:normal;font-weight:bold;font-size:187.978302px;font-family:Courier;text-anchor:middle;fill:#000000;stroke-width:0.02447634in"
       transform="scale(1.0213945,0.97905363)">struct</text>
    <!-- Text -->
    <text
       xml:space="preserve"
       x="3096.1016"
       y="4257.1494"
       font-style="normal"
       font-weight="bold"
       font-size="192"
       id="text158"
       style="font-style:normal;font-weight:bold;font-size:187.978302px;font-family:Courier;text-anchor:middle;fill:#000000;stroke-width:0.02447634in"
       transform="scale(1.0213945,0.97905363)">rcu_node</text>
    <!-- Text -->
    <text
       xml:space="preserve"
       x="1627.5209"
       y="5725.7305"
       font-style="normal"
       font-weight="bold"
       font-size="192"
       id="text160"
       style="font-style:normal;font-weight:bold;font-size:187.978302px;font-family:Courier;text-anchor:middle;fill:#000000;stroke-width:0.02447634in"
       transform="scale(1.0213945,0.97905363)">struct</text>
    <!-- Text -->
    <text
       xml:space="preserve"
       x="1627.5209"
       y="6019.4463"
       font-style="normal"
       font-weight="bold"
       font-size="192"
       id="text162"
       style="font-style:normal;font-weight:bold;font-size:187.978302px;font-family:Courier;text-anchor:middle;fill:#000000;stroke-width:0.02447634in"
       transform="scale(1.0213945,0.97905363)">rcu_node</text>
    <!-- Text -->
    <text
       xml:space="preserve"
       x="4564.6821"
       y="6019.4463"
       font-style="normal"
       font-weight="bold"
       font-size="192"
       id="text164"
       style="font-style:normal;font-weight:bold;font-size:187.978302px;font-family:Courier;text-anchor:middle;fill:#000000;stroke-width:0.02447634in"
       transform="scale(1.0213945,0.97905363)">rcu_node</text>
    <!-- Text -->
    <text
       xml:space="preserve"
       x="4564.6821"
       y="5725.7305"
       font-style="normal"
       font-weight="bold"
       font-size="192"
       id="text166"
       style="font-style:normal;font-weight:bold;font-size:187.978302px;font-family:Courier;text-anchor:middle;fill:#000000;stroke-width:0.02447634in"
       transform="scale(1.0213945,0.97905363)">struct</text>
    <!-- Text -->
    <text
       xml:space="preserve"
       x="2214.9531"
       y="7634.8848"
       font-style="normal"
       font-weight="bold"
       font-size="192"
       id="text168"
       style="font-style:normal;font-weight:bold;font-size:187.978302px;font-family:Courier;text-anchor:middle;fill:#000000;stroke-width:0.02447634in"
       transform="scale(1.0213945,0.97905363)">struct</text>
    <!-- Text -->
    <text
       xml:space="preserve"
       x="2214.9531"
       y="7928.6011"
       font-style="normal"
       font-weight="bold"
       font-size="192"
       id="text170"
       style="font-style:normal;font-weight:bold;font-size:187.978302px;font-family:Courier;text-anchor:middle;fill:#000000;stroke-width:0.02447634in"
       transform="scale(1.0213945,0.97905363)">rcu_data</text>
    <!-- Text -->
    <text
       xml:space="preserve"
       x="1040.0886"
       y="8809.749"
       font-style="normal"
       font-weight="bold"
       font-size="192"
       id="text172"
       style="font-style:normal;font-weight:bold;font-size:187.978302px;font-family:Courier;text-anchor:middle;fill:#000000;stroke-width:0.02447634in"
       transform="scale(1.0213945,0.97905363)">struct</text>
    <!-- Text -->
    <text
       xml:space="preserve"
       x="1040.0886"
       y="9103.4648"
       font-style="normal"
       font-weight="bold"
       font-size="192"
       id="text174"
       style="font-style:normal;font-weight:bold;font-size:187.978302px;font-family:Courier;text-anchor:middle;fill:#000000;stroke-width:0.02447634in"
       transform="scale(1.0213945,0.97905363)">rcu_data</text>
    <!-- Text -->
    <text
       xml:space="preserve"
       x="5152.1138"
       y="7634.8848"
       font-style="normal"
       font-weight="bold"
       font-size="192"
       id="text176"
       style="font-style:normal;font-weight:bold;font-size:187.978302px;font-family:Courier;text-anchor:middle;fill:#000000;stroke-width:0.02447634in"
       transform="scale(1.0213945,0.97905363)">struct</text>
    <!-- Text -->
    <text
       xml:space="preserve"
       x="5152.1138"
       y="7928.6011"
       font-style="normal"
       font-weight="bold"
       font-size="192"
       id="text178"
       style="font-style:normal;font-weight:bold;font-size:187.978302px;font-family:Courier;text-anchor:middle;fill:#000000;stroke-width:0.02447634in"
       transform="scale(1.0213945,0.97905363)">rcu_data</text>
    <!-- Text -->
    <text
       xml:space="preserve"
       x="3977.2495"
       y="8809.749"
       font-style="normal"
       font-weight="bold"
       font-size="192"
       id="text180"
       style="font-style:normal;font-weight:bold;font-size:187.978302px;font-family:Courier;text-anchor:middle;fill:#000000;stroke-width:0.02447634in"
       transform="scale(1.0213945,0.97905363)">struct</text>
    <!-- Text -->
    <text
       xml:space="preserve"
       x="3977.2495"
       y="9103.4648"
       font-style="normal"
       font-weight="bold"
       font-size="192"
       id="text182"
       style="font-style:normal;font-weight:bold;font-size:187.978302px;font-family:Courier;text-anchor:middle;fill:#000000;stroke-width:0.02447634in"
       transform="scale(1.0213945,0.97905363)">rcu_data</text>
    <!-- Text -->
    <text
       xml:space="preserve"
       x="452.6564"
       y="3376.0012"
       font-style="normal"
       font-weight="bold"
       font-size="192"
       id="text184"
       style="font-style:normal;font-weight:bold;font-size:187.978302px;font-family:Courier;text-anchor:start;fill:#000000;stroke-width:0.02447634in"
       transform="scale(1.0213945,0.97905363)">struct rcu_state</text>
    <!-- Text -->
    <!-- Text -->
    <!-- Text -->
    <!-- Text -->
    <!-- Text -->
    <!-- Text -->
    <!-- Text -->
    <!-- Text -->
    <!-- Text -->
    <!-- Line -->
    <polyline
       points="5250,5850 5250,4864 "
       style="stroke:#00d1d1;stroke-width:29.99464035;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;marker-end:url(#Arrow1Mend)"
       id="polyline204"
       transform="matrix(1,0,0,0.95854605,12.340758,1579.9033)" />
    <!-- Arrowhead on XXXpoint 5250 5850 - 5250 4740-->
    <path
       style="fill:none;stroke:#000000;stroke-width:34.24744034;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#marker1177)"
       d="m 6000.1472,7564.2558 c 1498.5508,0 1498.5508,0 1498.5508,0 v 520.0252"
       id="path886"
       inkscape:connector-curvature="0" />
  </g>
</svg>