[PATCH REPOST] libata: remove ata_sff_data_xfer_noirq()

2018-07-11 Thread Sebastian Andrzej Siewior
ata_sff_data_xfer_noirq() is invoked via the ->sff_data_xfer hook. The
latter is invoked by ata_pio_sector(), atapi_send_cdb() and
__atapi_pio_bytes() which in turn is invoked by ata_sff_hsm_move().
The latter function requires that the "ap->lock" lock is held which
needs to be taken with disabled interrupts.

There is no need have to have ata_sff_data_xfer_noirq() which invokes
ata_sff_data_xfer32() with disabled interrupts because at this point the
interrupts are already disabled.
Remove the function and its references to it and replace all callers
with ata_sff_data_xfer32().

Signed-off-by: Sebastian Andrzej Siewior 
---
 Documentation/driver-api/libata.rst |  3 +--
 drivers/ata/libata-sff.c| 30 -
 drivers/ata/pata_cmd640.c   |  2 +-
 drivers/ata/pata_icside.c   |  2 +-
 drivers/ata/pata_imx.c  |  2 +-
 drivers/ata/pata_legacy.c   |  6 +++---
 drivers/ata/pata_palmld.c   |  2 +-
 drivers/ata/pata_pcmcia.c   |  2 +-
 drivers/ata/pata_platform.c |  2 +-
 drivers/ata/pata_via.c  |  2 +-
 include/linux/libata.h  |  2 --
 11 files changed, 11 insertions(+), 44 deletions(-)

diff --git a/Documentation/driver-api/libata.rst 
b/Documentation/driver-api/libata.rst
index 4adc056f7635..70e180e6b93d 100644
--- a/Documentation/driver-api/libata.rst
+++ b/Documentation/driver-api/libata.rst
@@ -118,8 +118,7 @@ PIO data read/write
 All bmdma-style drivers must implement this hook. This is the low-level
 operation that actually copies the data bytes during a PIO data
 transfer. Typically the driver will choose one of
-:c:func:`ata_sff_data_xfer_noirq`, :c:func:`ata_sff_data_xfer`, or
-:c:func:`ata_sff_data_xfer32`.
+:c:func:`ata_sff_data_xfer`, or :c:func:`ata_sff_data_xfer32`.
 
 ATA command execute
 ~~~
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index cc2f2e35f4c2..c5ea0fc635e5 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -657,36 +657,6 @@ unsigned int ata_sff_data_xfer32(struct ata_queued_cmd 
*qc, unsigned char *buf,
 }
 EXPORT_SYMBOL_GPL(ata_sff_data_xfer32);
 
-/**
- * ata_sff_data_xfer_noirq - Transfer data by PIO
- * @qc: queued command
- * @buf: data buffer
- * @buflen: buffer length
- * @rw: read/write
- *
- * Transfer data from/to the device data register by PIO. Do the
- * transfer with interrupts disabled.
- *
- * LOCKING:
- * Inherited from caller.
- *
- * RETURNS:
- * Bytes consumed.
- */
-unsigned int ata_sff_data_xfer_noirq(struct ata_queued_cmd *qc, unsigned char 
*buf,
-unsigned int buflen, int rw)
-{
-   unsigned long flags;
-   unsigned int consumed;
-
-   local_irq_save(flags);
-   consumed = ata_sff_data_xfer32(qc, buf, buflen, rw);
-   local_irq_restore(flags);
-
-   return consumed;
-}
-EXPORT_SYMBOL_GPL(ata_sff_data_xfer_noirq);
-
 /**
  * ata_pio_sector - Transfer a sector of data.
  * @qc: Command on going
diff --git a/drivers/ata/pata_cmd640.c b/drivers/ata/pata_cmd640.c
index c47caa807fa9..e3532eda7b05 100644
--- a/drivers/ata/pata_cmd640.c
+++ b/drivers/ata/pata_cmd640.c
@@ -178,7 +178,7 @@ static struct scsi_host_template cmd640_sht = {
 static struct ata_port_operations cmd640_port_ops = {
.inherits   = _sff_port_ops,
/* In theory xfer_noirq is not needed once we kill the prefetcher */
-   .sff_data_xfer  = ata_sff_data_xfer_noirq,
+   .sff_data_xfer  = ata_sff_data_xfer32,
.sff_irq_check  = cmd640_sff_irq_check,
.qc_issue   = cmd640_qc_issue,
.cable_detect   = ata_cable_40wire,
diff --git a/drivers/ata/pata_icside.c b/drivers/ata/pata_icside.c
index 188f2f2eb21f..c272f2cbb47c 100644
--- a/drivers/ata/pata_icside.c
+++ b/drivers/ata/pata_icside.c
@@ -324,7 +324,7 @@ static struct ata_port_operations pata_icside_port_ops = {
.inherits   = _bmdma_port_ops,
/* no need to build any PRD tables for DMA */
.qc_prep= ata_noop_qc_prep,
-   .sff_data_xfer  = ata_sff_data_xfer_noirq,
+   .sff_data_xfer  = ata_sff_data_xfer32,
.bmdma_setup= pata_icside_bmdma_setup,
.bmdma_start= pata_icside_bmdma_start,
.bmdma_stop = pata_icside_bmdma_stop,
diff --git a/drivers/ata/pata_imx.c b/drivers/ata/pata_imx.c
index d4caa23f5a88..108101325efd 100644
--- a/drivers/ata/pata_imx.c
+++ b/drivers/ata/pata_imx.c
@@ -102,7 +102,7 @@ static struct scsi_host_template pata_imx_sht = {
 
 static struct ata_port_operations pata_imx_port_ops = {
.inherits   = _sff_port_ops,
-   .sff_data_xfer  = ata_sff_data_xfer_noirq,
+   .sff_data_xfer  = ata_sff_data_xfer32,
.cable_detect   = ata_cable_unknown,
.set_piomode= pata_imx_set_piomode,
 };
diff

Re: [PATCH] libata: remove ata_sff_data_xfer_noirq()

2018-05-24 Thread Sebastian Andrzej Siewior
On 2018-05-07 17:52:16 [+0200], To Tejun Heo wrote:
> On 2018-05-07 08:49:08 [-0700], Tejun Heo wrote:
> > Hello, Sebastian.
Hi Tejun,

> > On Fri, May 04, 2018 at 05:06:20PM +0200, Sebastian Andrzej Siewior wrote:
> > > ata_sff_data_xfer_noirq() is invoked via the ->sff_data_xfer hook. The
> > > latter is invoked by ata_pio_sector(), atapi_send_cdb() and
> > > __atapi_pio_bytes() which in turn is invoked by ata_sff_hsm_move().
> > > The latter function requires that the "ap->lock" lock is held which
> > > needs to be taken with disabled interrupts.
> > > 
> > > There is no need have to have ata_sff_data_xfer_noirq() which invokes
> > > ata_sff_data_xfer32() with disabled interrupts because at this point the
> > > interrupts are already disabled.
> > > Remove the function and its references to it and replace all callers
> > > with ata_sff_data_xfer32().
> > 
> > Can you please add irq disabled assert to ata_sff_data_xfer*()?
> 
> Why irq-disabled assert? Can we use lockdep_assert_held() instead?
That irq-disabled assert won't work on RT as expected that is why I
intend to remove the local_irq_save() (which is not needed). If we could
avoid the irq-disabled assert or use a lock instead, then it wouldn't
trigger another error on RT.

> > Thanks.

Sebastian
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] libata: remove ata_sff_data_xfer_noirq()

2018-05-07 Thread Sebastian Andrzej Siewior
On 2018-05-07 08:49:08 [-0700], Tejun Heo wrote:
> Hello, Sebastian.
> 
> On Fri, May 04, 2018 at 05:06:20PM +0200, Sebastian Andrzej Siewior wrote:
> > ata_sff_data_xfer_noirq() is invoked via the ->sff_data_xfer hook. The
> > latter is invoked by ata_pio_sector(), atapi_send_cdb() and
> > __atapi_pio_bytes() which in turn is invoked by ata_sff_hsm_move().
> > The latter function requires that the "ap->lock" lock is held which
> > needs to be taken with disabled interrupts.
> > 
> > There is no need have to have ata_sff_data_xfer_noirq() which invokes
> > ata_sff_data_xfer32() with disabled interrupts because at this point the
> > interrupts are already disabled.
> > Remove the function and its references to it and replace all callers
> > with ata_sff_data_xfer32().
> 
> Can you please add irq disabled assert to ata_sff_data_xfer*()?

Why irq-disabled assert? Can we use lockdep_assert_held() instead?

> Thanks.

Sebastian
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] libata: remove ata_sff_data_xfer_noirq()

2018-05-04 Thread Sebastian Andrzej Siewior
ata_sff_data_xfer_noirq() is invoked via the ->sff_data_xfer hook. The
latter is invoked by ata_pio_sector(), atapi_send_cdb() and
__atapi_pio_bytes() which in turn is invoked by ata_sff_hsm_move().
The latter function requires that the "ap->lock" lock is held which
needs to be taken with disabled interrupts.

There is no need have to have ata_sff_data_xfer_noirq() which invokes
ata_sff_data_xfer32() with disabled interrupts because at this point the
interrupts are already disabled.
Remove the function and its references to it and replace all callers
with ata_sff_data_xfer32().

Signed-off-by: Sebastian Andrzej Siewior <bige...@linutronix.de>
---
 Documentation/driver-api/libata.rst |  3 +--
 drivers/ata/libata-sff.c| 30 -
 drivers/ata/pata_cmd640.c   |  2 +-
 drivers/ata/pata_icside.c   |  2 +-
 drivers/ata/pata_imx.c  |  2 +-
 drivers/ata/pata_legacy.c   |  6 +++---
 drivers/ata/pata_palmld.c   |  2 +-
 drivers/ata/pata_pcmcia.c   |  2 +-
 drivers/ata/pata_platform.c |  2 +-
 drivers/ata/pata_via.c  |  2 +-
 include/linux/libata.h  |  2 --
 11 files changed, 11 insertions(+), 44 deletions(-)

diff --git a/Documentation/driver-api/libata.rst 
b/Documentation/driver-api/libata.rst
index 4adc056f7635..70e180e6b93d 100644
--- a/Documentation/driver-api/libata.rst
+++ b/Documentation/driver-api/libata.rst
@@ -118,8 +118,7 @@ PIO data read/write
 All bmdma-style drivers must implement this hook. This is the low-level
 operation that actually copies the data bytes during a PIO data
 transfer. Typically the driver will choose one of
-:c:func:`ata_sff_data_xfer_noirq`, :c:func:`ata_sff_data_xfer`, or
-:c:func:`ata_sff_data_xfer32`.
+:c:func:`ata_sff_data_xfer`, or :c:func:`ata_sff_data_xfer32`.
 
 ATA command execute
 ~~~
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index cc2f2e35f4c2..c5ea0fc635e5 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -657,36 +657,6 @@ unsigned int ata_sff_data_xfer32(struct ata_queued_cmd 
*qc, unsigned char *buf,
 }
 EXPORT_SYMBOL_GPL(ata_sff_data_xfer32);
 
-/**
- * ata_sff_data_xfer_noirq - Transfer data by PIO
- * @qc: queued command
- * @buf: data buffer
- * @buflen: buffer length
- * @rw: read/write
- *
- * Transfer data from/to the device data register by PIO. Do the
- * transfer with interrupts disabled.
- *
- * LOCKING:
- * Inherited from caller.
- *
- * RETURNS:
- * Bytes consumed.
- */
-unsigned int ata_sff_data_xfer_noirq(struct ata_queued_cmd *qc, unsigned char 
*buf,
-unsigned int buflen, int rw)
-{
-   unsigned long flags;
-   unsigned int consumed;
-
-   local_irq_save(flags);
-   consumed = ata_sff_data_xfer32(qc, buf, buflen, rw);
-   local_irq_restore(flags);
-
-   return consumed;
-}
-EXPORT_SYMBOL_GPL(ata_sff_data_xfer_noirq);
-
 /**
  * ata_pio_sector - Transfer a sector of data.
  * @qc: Command on going
diff --git a/drivers/ata/pata_cmd640.c b/drivers/ata/pata_cmd640.c
index c47caa807fa9..e3532eda7b05 100644
--- a/drivers/ata/pata_cmd640.c
+++ b/drivers/ata/pata_cmd640.c
@@ -178,7 +178,7 @@ static struct scsi_host_template cmd640_sht = {
 static struct ata_port_operations cmd640_port_ops = {
.inherits   = _sff_port_ops,
/* In theory xfer_noirq is not needed once we kill the prefetcher */
-   .sff_data_xfer  = ata_sff_data_xfer_noirq,
+   .sff_data_xfer  = ata_sff_data_xfer32,
.sff_irq_check  = cmd640_sff_irq_check,
.qc_issue   = cmd640_qc_issue,
.cable_detect   = ata_cable_40wire,
diff --git a/drivers/ata/pata_icside.c b/drivers/ata/pata_icside.c
index 188f2f2eb21f..c272f2cbb47c 100644
--- a/drivers/ata/pata_icside.c
+++ b/drivers/ata/pata_icside.c
@@ -324,7 +324,7 @@ static struct ata_port_operations pata_icside_port_ops = {
.inherits   = _bmdma_port_ops,
/* no need to build any PRD tables for DMA */
.qc_prep= ata_noop_qc_prep,
-   .sff_data_xfer  = ata_sff_data_xfer_noirq,
+   .sff_data_xfer  = ata_sff_data_xfer32,
.bmdma_setup= pata_icside_bmdma_setup,
.bmdma_start= pata_icside_bmdma_start,
.bmdma_stop = pata_icside_bmdma_stop,
diff --git a/drivers/ata/pata_imx.c b/drivers/ata/pata_imx.c
index d4caa23f5a88..108101325efd 100644
--- a/drivers/ata/pata_imx.c
+++ b/drivers/ata/pata_imx.c
@@ -102,7 +102,7 @@ static struct scsi_host_template pata_imx_sht = {
 
 static struct ata_port_operations pata_imx_port_ops = {
.inherits   = _sff_port_ops,
-   .sff_data_xfer  = ata_sff_data_xfer_noirq,
+   .sff_data_xfer  = ata_sff_data_xfer32,
.cable_detect   = ata_cable_unknown,
.set_piomode

[PATCH] Documentation: Update CPU hotplug and move it to core-api

2016-12-22 Thread Sebastian Andrzej Siewior
The current CPU hotplug is outdated. During the update to what we
currently have I rewrote it partly and moved to sphinx format.

Cc: Jonathan Corbet <cor...@lwn.net>
Cc: Mauro Carvalho Chehab <mche...@kernel.org>
Cc: Rusty Russell <ru...@rustcorp.com.au>
Cc: Srivatsa Vaddagiri <va...@in.ibm.com>
Cc: Ashok Raj <ashok@intel.com>
Cc: Joel Schopp <jsch...@austin.ibm.com>
Cc: linux-doc@vger.kernel.org
Signed-off-by: Sebastian Andrzej Siewior <bige...@linutronix.de>
---
 Documentation/core-api/cpu_hotplug.rst | 372 +++
 Documentation/core-api/index.rst   |   1 +
 Documentation/cpu-hotplug.txt  | 452 -
 3 files changed, 373 insertions(+), 452 deletions(-)
 create mode 100644 Documentation/core-api/cpu_hotplug.rst
 delete mode 100644 Documentation/cpu-hotplug.txt

diff --git a/Documentation/core-api/cpu_hotplug.rst 
b/Documentation/core-api/cpu_hotplug.rst
new file mode 100644
index ..4a50ab7817f7
--- /dev/null
+++ b/Documentation/core-api/cpu_hotplug.rst
@@ -0,0 +1,372 @@
+=
+CPU hotplug in the Kernel
+=====
+
+:Date: December, 2016
+:Author: Sebastian Andrzej Siewior <bige...@linutronix.de>,
+  Rusty Russell <ru...@rustcorp.com.au>,
+  Srivatsa Vaddagiri <va...@in.ibm.com>,
+  Ashok Raj <ashok@intel.com>,
+  Joel Schopp <jsch...@austin.ibm.com>
+
+Introduction
+
+
+Modern advances in system architectures have introduced advanced error
+reporting and correction capabilities in processors. There are couple OEMS that
+support NUMA hardware which are hot pluggable as well, where physical node
+insertion and removal require support for CPU hotplug.
+
+Such advances require CPUs available to a kernel to be removed either for
+provisioning reasons, or for RAS purposes to keep an offending CPU off
+system execution path. Hence the need for CPU hotplug support in the
+Linux kernel.
+
+A more novel use of CPU-hotplug support is its use today in suspend resume
+support for SMP. Dual-core and HT support makes even a laptop run SMP kernels
+which didn't support these methods.
+
+
+Command Line Switches
+=
+``maxcpus=n``
+  Restrict boot time CPUs to *n*. Say if you have fourV CPUs, using
+  ``maxcpus=2`` will only boot two. You can choose to bring the
+  other CPUs later online.
+
+``nr_cpus=n``
+  Restrict the total amount CPUs the kernel will support. If the number
+  supplied here is lower than the number of physically available CPUs than
+  those CPUs can not be brought online later.
+
+``additional_cpus=n``
+  Use this to limit hotpluggable CPUs. This option sets
+  ``cpu_possible_mask = cpu_present_mask + additional_cpus``
+
+  This option is limited to the IA64 architecture.
+
+``possible_cpus=n``
+  This option sets ``possible_cpus`` bits in ``cpu_possible_mask``.
+
+  This option is limited to the X86 and S390 architecture.
+
+``cede_offline={"off","on"}``
+  Use this option to disable/enable putting offlined processors to an extended
+  ``H_CEDE`` state on supported pseries platforms. If nothing is specified,
+  ``cede_offline`` is set to "on".
+
+  This option is limited to the PowerPC architecture.
+
+``cpu0_hotplug``
+  Allow to shutdown CPU0.
+
+  This option is limited to the X86 architecture.
+
+CPU maps
+
+
+``cpu_possible_mask``
+  Bitmap of possible CPUs that can ever be available in the
+  system. This is used to allocate some boot time memory for per_cpu variables
+  that aren't designed to grow/shrink as CPUs are made available or removed.
+  Once set during boot time discovery phase, the map is static, i.e no bits
+  are added or removed anytime. Trimming it accurately for your system needs
+  upfront can save some boot time memory.
+
+``cpu_online_mask``
+  Bitmap of all CPUs currently online. Its set in ``__cpu_up()``
+  after a CPU is available for kernel scheduling and ready to receive
+  interrupts from devices. Its cleared when a CPU is brought down using
+  ``__cpu_disable()``, before which all OS services including interrupts are
+  migrated to another target CPU.
+
+``cpu_present_mask``
+  Bitmap of CPUs currently present in the system. Not all
+  of them may be online. When physical hotplug is processed by the relevant
+  subsystem (e.g ACPI) can change and new bit either be added or removed
+  from the map depending on the event is hot-add/hot-remove. There are 
currently
+  no locking rules as of now. Typical usage is to init topology during boot,
+  at which time hotplug is disabled.
+
+You really don't need to manipulate any of the system CPU maps. They should
+be read-only for most use. When setting up per-cpu resources almost always use
+``cpu_possible_mask`` or ``for_each_possible_cpu()`` to iterate. To macro
+``for_each_cpu()`` can be used to iterate over a custom CPU ma

[PATCH 1/2] Documentation/HOWTO: Use a more recent gcc + binutils

2016-11-02 Thread Sebastian Andrzej Siewior
Debian Woody is pre-gcc3.2 and Sarge ships 3.3 gcc. I tried to compile
v4.8.6 on Sarge failed due to binutils:
|arch/x86/entry/entry_32.S: Assembler messages:
|arch/x86/entry/entry_32.S:379: Error: invalid character '"' in operand 1
|arch/x86/entry/entry_32.S:454: Error: too many positional arguments
|arch/x86/entry/entry_32.S:580: Error: too many positional arguments
|arch/x86/boot/bioscall.S:68: Error: `68(%esp)' is not a valid 16 bit 
base/index expression

among other errors. Sarge comes with GNU ld version 2.15 with is not
recent enough. I don't see those errors on Etch which ships version 2.17
and therefore I raise the limit to 2.17.
gcc is a different story. 3.3 It throws a lot of warnings
|include/linux/irq.h:402: warning: parameter has incomplete type
|include/linux/irq.h:403: warning: parameter has incomplete type
|drivers/gpu/drm/i915/i915_gem_gtt.h:312: warning: parameter has incomplete type

during the compile and fails then with
| cc1: error: unrecognized option `-Wno-override-init'

or later with

|lib/lzo/lzo1x_compress.c: In function `lzo1x_1_do_compress':
|lib/lzo/lzo1x_compress.c:132: error: implicit declaration of function 
`__builtin_ctz'

Etch (with gcc v4.1.2) gets to compile the kernel without plenty of
warnings and it also chokes on Wno-override-init but that one could be
easily fixed if we want to keep v4.1 as the minimum.
So I think raising the bar to gcc v4.1 isn't that bad given that the
last release of gcc 4.1 was on February 13, 2007.

Cc: Jonathan Corbet <cor...@lwn.net>
Cc: linux-doc@vger.kernel.org
Cc: Andrew Morton <a...@linux-foundation.org>
Signed-off-by: Sebastian Andrzej Siewior <bige...@linutronix.de>
---
 Documentation/Changes | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/Changes b/Documentation/Changes
index 22797a15dc24..14e65b445707 100644
--- a/Documentation/Changes
+++ b/Documentation/Changes
@@ -29,9 +29,9 @@ you probably needn't concern yourself with isdn4k-utils.
 == ===  

 ProgramMinimal version   Command to check the version
 == ===  

-GNU C  3.2  gcc --version
+GNU C  4.1  gcc --version
 GNU make   3.80 make --version
-binutils   2.12 ld -v
+binutils   2.17 ld -v
 util-linux 2.10ofdformat --version
 module-init-tools  0.9.10   depmod -V
 e2fsprogs  1.41.4   e2fsck -V
-- 
2.10.2

--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html