linux-block.git
18 months agoMerge patch series "mpi3mr: Few Enhancements and minor fixes"
Martin K. Petersen [Fri, 17 Mar 2023 03:55:19 +0000 (23:55 -0400)]
Merge patch series "mpi3mr: Few Enhancements and minor fixes"

Ranjan Kumar <ranjan.kumar@broadcom.com> says:

Few Enhancements and minor fixes of mpi3mr driver.

Link: https://lore.kernel.org/r/20230316110209.60145-1-ranjan.kumar@broadcom.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: mpi3mr: Update driver version to 8.4.1.0.0
Ranjan Kumar [Thu, 16 Mar 2023 11:02:09 +0000 (16:32 +0530)]
scsi: mpi3mr: Update driver version to 8.4.1.0.0

Update driver version to 8.4.1.0.0.

Signed-off-by: Ranjan Kumar <ranjan.kumar@broadcom.com>
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Link: https://lore.kernel.org/r/20230316110209.60145-9-ranjan.kumar@broadcom.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: mpi3mr: Update copyright year
Ranjan Kumar [Thu, 16 Mar 2023 11:02:08 +0000 (16:32 +0530)]
scsi: mpi3mr: Update copyright year

Update copyright year from 2022 to 2023.

Signed-off-by: Ranjan Kumar <ranjan.kumar@broadcom.com>
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Link: https://lore.kernel.org/r/20230316110209.60145-8-ranjan.kumar@broadcom.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: mpi3mr: Fix W=1 compilation warnings
Ranjan Kumar [Thu, 16 Mar 2023 11:02:07 +0000 (16:32 +0530)]
scsi: mpi3mr: Fix W=1 compilation warnings

Fix W=1 compilation warnings.

Signed-off-by: Ranjan Kumar <ranjan.kumar@broadcom.com>
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Link: https://lore.kernel.org/r/20230316110209.60145-7-ranjan.kumar@broadcom.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: mpi3mr: Update MPI Headers to revision 27
Ranjan Kumar [Thu, 16 Mar 2023 11:02:06 +0000 (16:32 +0530)]
scsi: mpi3mr: Update MPI Headers to revision 27

Update MPI Headers to revision 27.

Signed-off-by: Ranjan Kumar <ranjan.kumar@broadcom.com>
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Link: https://lore.kernel.org/r/20230316110209.60145-6-ranjan.kumar@broadcom.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: mpi3mr: Avoid escalating to higher level reset when target is removed
Ranjan Kumar [Thu, 16 Mar 2023 11:02:05 +0000 (16:32 +0530)]
scsi: mpi3mr: Avoid escalating to higher level reset when target is removed

SCSI error handling has taken place for timed out I/Os on a drive and the
corresponding drive is removed. Stop escalating to higher level of reset by
returning the TUR with "I_T NEXUS LOSS OCCURRED" sense key.

Signed-off-by: Ranjan Kumar <ranjan.kumar@broadcom.com>
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Link: https://lore.kernel.org/r/20230316110209.60145-5-ranjan.kumar@broadcom.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: mpi3mr: Modify MUR timeout value to 120 seconds
Ranjan Kumar [Thu, 16 Mar 2023 11:02:04 +0000 (16:32 +0530)]
scsi: mpi3mr: Modify MUR timeout value to 120 seconds

Modify Message Unit Reset timeout value to 120 seconds from the previous
value of 30 seconds.

Signed-off-by: Ranjan Kumar <ranjan.kumar@broadcom.com>
Signed-off-by: Sreekant Reddy <sreekanth.reddy@broadcom.com>
Link: https://lore.kernel.org/r/20230316110209.60145-4-ranjan.kumar@broadcom.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: mpi3mr: Fix admin queue memory leak upon soft reset
Ranjan Kumar [Thu, 16 Mar 2023 11:02:03 +0000 (16:32 +0530)]
scsi: mpi3mr: Fix admin queue memory leak upon soft reset

After a soft reset, while setting up admin queue pairs, the driver
initially sets admin request base and admin reply base addresses to
NULL. This leads to DMA memory pointed by these pointers getting leaked.

Signed-off-by: Ranjan Kumar <ranjan.kumar@broadcom.com>
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Link: https://lore.kernel.org/r/20230316110209.60145-3-ranjan.kumar@broadcom.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: mpi3mr: Successive VD delete and add causes FW fault
Ranjan Kumar [Thu, 16 Mar 2023 11:02:02 +0000 (16:32 +0530)]
scsi: mpi3mr: Successive VD delete and add causes FW fault

Upon Virtual disk removal, firmware sends device status change event
(Virtual disk remove event) and expects the driver to start device remove
handshake (by sending target reset and IOU control command to firmware).
However, the driver does not initiate the device remove handshake which
leads to the firmware fault.

Signed-off-by: Ranjan Kumar <ranjan.kumar@broadcom.com>
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Link: https://lore.kernel.org/r/20230316110209.60145-2-ranjan.kumar@broadcom.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: ufs: hisi: Drop of_match_ptr() for ID table
Krzysztof Kozlowski [Fri, 10 Mar 2023 21:44:35 +0000 (22:44 +0100)]
scsi: ufs: hisi: Drop of_match_ptr() for ID table

The driver can match only via the DT table so the table should be always
used and the of_match_ptr() does not make any sense (this also allows ACPI
matching via PRP0001, even though it is not relevant here).

  drivers/ufs/host/ufs-hisi.c:561:34: error: ‘ufs_hisi_of_match’ defined but not used [-Werror=unused-const-variable=]

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230310214435.275127-3-krzysztof.kozlowski@linaro.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: ufs: exynos: Drop of_match_ptr() for ID table
Krzysztof Kozlowski [Fri, 10 Mar 2023 21:44:34 +0000 (22:44 +0100)]
scsi: ufs: exynos: Drop of_match_ptr() for ID table

The driver can match only via the DT table so the table should be always
used and the of_match_ptr() does not make any sense (this also allows ACPI
matching via PRP0001, even though it is not relevant here).

  drivers/ufs/host/ufs-exynos.c:1738:34: error: ‘exynos_ufs_of_match’ defined but not used [-Werror=unused-const-variable=]

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230310214435.275127-2-krzysztof.kozlowski@linaro.org
Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: ufs: qcom: Add __maybe_unused to OF ID table
Krzysztof Kozlowski [Fri, 10 Mar 2023 21:44:33 +0000 (22:44 +0100)]
scsi: ufs: qcom: Add __maybe_unused to OF ID table

The driver can be built on ACPI and its .of_match_table uses
of_match_ptr(), thus annotate the actual table as maybe unused.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230310214435.275127-1-krzysztof.kozlowski@linaro.org
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: qlogicpti: sun_esp: Use of_property_read_bool() for boolean properties
Rob Herring [Fri, 10 Mar 2023 14:47:23 +0000 (08:47 -0600)]
scsi: qlogicpti: sun_esp: Use of_property_read_bool() for boolean properties

It is preferred to use typed property access functions (i.e.
of_property_read_<type> functions) rather than low-level
of_get_property()/of_find_property() functions for reading properties.
Convert reading boolean properties to of_property_read_bool().

Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20230310144723.1544999-1-robh@kernel.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoMerge patch series "add virtual remote fabric"
Martin K. Petersen [Fri, 17 Mar 2023 03:41:00 +0000 (23:41 -0400)]
Merge patch series "add virtual remote fabric"

Dmitry Bogdanov <d.bogdanov@yadro.com> says:

The patchset is based on 6.4/scsi-staging branch.

The first 11 patches are just a refactoring to reduce code duplication
in fabric drivers.  They make several callouts be optional in fabric
ops.  Make a default implementation of the optional ops and remove
such implementations in the fabric drivers.

The last patch is a new virtual remote fabric driver.  It has a
valueble sence with patchset "scsi: target: make RTPI an TPG
identifier" to configure RPTI on remote/tpgt_x same as on tpgt_y on
other nodes in a storage cluster. That allows to report the same ports
in RTPG from each node and to have a clusterwide tpg/acl/lun view in
kernel.

Link: https://lore.kernel.org/r/20230313181110.20566-1-d.bogdanov@yadro.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: target: Add virtual remote target
Dmitry Bogdanov [Mon, 13 Mar 2023 18:11:10 +0000 (21:11 +0300)]
scsi: target: Add virtual remote target

Create virtual remote target module.

This can be used to see a whole ACL/LUN/TPG configuration from all nodes in
storage cluster.  For example, it permits setting up remote ports in ALUA
port groups. To report all ports in a cluster in REPORT TARGET PORT GROUP
command.

Suggested-by: Konstantin Shelekhin <k.shelekhin@yadro.com>
Signed-off-by: Dmitry Bogdanov <d.bogdanov@yadro.com>
Link: https://lore.kernel.org/r/20230313181110.20566-13-d.bogdanov@yadro.com
Reviewed-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: efct: Remove default fabric ops callouts
Dmitry Bogdanov [Mon, 13 Mar 2023 18:11:09 +0000 (21:11 +0300)]
scsi: efct: Remove default fabric ops callouts

Remove callouts that are identical to the default implementations in TCM
Core.

Signed-off-by: Dmitry Bogdanov <d.bogdanov@yadro.com>
Link: https://lore.kernel.org/r/20230313181110.20566-12-d.bogdanov@yadro.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: qla2xxx: Remove default fabric ops callouts
Dmitry Bogdanov [Mon, 13 Mar 2023 18:11:08 +0000 (21:11 +0300)]
scsi: qla2xxx: Remove default fabric ops callouts

Remove callouts that are identical to the default implementations in TCM
Core.

Signed-off-by: Dmitry Bogdanov <d.bogdanov@yadro.com>
Link: https://lore.kernel.org/r/20230313181110.20566-11-d.bogdanov@yadro.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: xen-scsiback: Remove default fabric ops callouts
Dmitry Bogdanov [Mon, 13 Mar 2023 18:11:07 +0000 (21:11 +0300)]
scsi: xen-scsiback: Remove default fabric ops callouts

Remove callouts that are identical to the default implementations in TCM
Core.

Acked-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Dmitry Bogdanov <d.bogdanov@yadro.com>
Link: https://lore.kernel.org/r/20230313181110.20566-10-d.bogdanov@yadro.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: vhost-scsi: Remove default fabric ops callouts
Dmitry Bogdanov [Mon, 13 Mar 2023 18:11:06 +0000 (21:11 +0300)]
scsi: vhost-scsi: Remove default fabric ops callouts

Remove callouts that are identical to the default implementations in TCM
Core.

Signed-off-by: Dmitry Bogdanov <d.bogdanov@yadro.com>
Link: https://lore.kernel.org/r/20230313181110.20566-9-d.bogdanov@yadro.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: usb: gadget: f_tcm: Remove default fabric ops callouts
Dmitry Bogdanov [Mon, 13 Mar 2023 18:11:05 +0000 (21:11 +0300)]
scsi: usb: gadget: f_tcm: Remove default fabric ops callouts

Remove callouts that are identical to the default implementations in TCM
Core.

Signed-off-by: Dmitry Bogdanov <d.bogdanov@yadro.com>
Link: https://lore.kernel.org/r/20230313181110.20566-8-d.bogdanov@yadro.com
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: target: fcoe: Remove default fabric ops callouts
Dmitry Bogdanov [Mon, 13 Mar 2023 18:11:04 +0000 (21:11 +0300)]
scsi: target: fcoe: Remove default fabric ops callouts

Remove callouts that are identical to the default implementations in TCM
Core.

Signed-off-by: Dmitry Bogdanov <d.bogdanov@yadro.com>
Link: https://lore.kernel.org/r/20230313181110.20566-7-d.bogdanov@yadro.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: target: sbp: Remove default fabric ops callouts
Dmitry Bogdanov [Mon, 13 Mar 2023 18:11:03 +0000 (21:11 +0300)]
scsi: target: sbp: Remove default fabric ops callouts

Remove callouts that are identical to the default implementations in TCM
Core.

Signed-off-by: Dmitry Bogdanov <d.bogdanov@yadro.com>
Link: https://lore.kernel.org/r/20230313181110.20566-6-d.bogdanov@yadro.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: target: loop: Remove default fabric ops callouts
Dmitry Bogdanov [Mon, 13 Mar 2023 18:11:02 +0000 (21:11 +0300)]
scsi: target: loop: Remove default fabric ops callouts

Remove callouts that are identical to the default implementations in TCM
Core.

Signed-off-by: Dmitry Bogdanov <d.bogdanov@yadro.com>
Link: https://lore.kernel.org/r/20230313181110.20566-5-d.bogdanov@yadro.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: ibmvscsit: Remove default fabric ops callouts
Dmitry Bogdanov [Mon, 13 Mar 2023 18:11:01 +0000 (21:11 +0300)]
scsi: ibmvscsit: Remove default fabric ops callouts

Remove callouts that are identical to the default implementations in TCM
Core.

Signed-off-by: Dmitry Bogdanov <d.bogdanov@yadro.com>
Link: https://lore.kernel.org/r/20230313181110.20566-4-d.bogdanov@yadro.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: infiniband: srpt: Remove default fabric ops callouts
Dmitry Bogdanov [Mon, 13 Mar 2023 18:11:00 +0000 (21:11 +0300)]
scsi: infiniband: srpt: Remove default fabric ops callouts

Remove callouts that are identical to the default implementations in TCM
Core.

Signed-off-by: Dmitry Bogdanov <d.bogdanov@yadro.com>
Link: https://lore.kernel.org/r/20230313181110.20566-3-d.bogdanov@yadro.com
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: target: Add default fabric ops callouts
Dmitry Bogdanov [Mon, 13 Mar 2023 18:10:59 +0000 (21:10 +0300)]
scsi: target: Add default fabric ops callouts

There are several callouts in target fabric ops that most of fabric drivers
fill with a function returning the same value.

Stop requiring such callouts to exist in the ops, fill them in TCM Core.

Signed-off-by: Dmitry Bogdanov <d.bogdanov@yadro.com>
Link: https://lore.kernel.org/r/20230313181110.20566-2-d.bogdanov@yadro.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoMerge patch series "scsi_debug: Some minor improvements"
Martin K. Petersen [Fri, 17 Mar 2023 03:26:31 +0000 (23:26 -0400)]
Merge patch series "scsi_debug: Some minor improvements"

John Garry <john.g.garry@oracle.com> says:

This series contains a bunch of minor improvements to the driver. I
have another bunch waiting with more major changes.

Most of the changes are quite straightforward, and the only patches of
note are as follows:

 - Fix the command abort feature, enabled with host option
   SDEBUG_OPT_CMD_ABORT.

 - Drop driver count of queued commands per device.

 - Add poll mode completions to statistics. We already have poll mode
   callback call count, so maybe it was intentional to omit poll mode
   from the statistics.

Link: https://lore.kernel.org/r/20230313093114.1498305-1-john.g.garry@oracle.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: scsi_debug: Add poll mode deferred completions to statistics
John Garry [Mon, 13 Mar 2023 09:31:14 +0000 (09:31 +0000)]
scsi: scsi_debug: Add poll mode deferred completions to statistics

Currently commands completed via poll mode are not included in the
statistics gathering for deferred completions and missed CPUs.

Poll mode completions should be treated the same as other deferred
completion types, so add poll mode completions to the statistics.

Signed-off-by: John Garry <john.g.garry@oracle.com>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Link: https://lore.kernel.org/r/20230313093114.1498305-12-john.g.garry@oracle.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: scsi_debug: Get command abort feature working again
John Garry [Mon, 13 Mar 2023 09:31:13 +0000 (09:31 +0000)]
scsi: scsi_debug: Get command abort feature working again

The command abort feature allows us to test aborting a command which has
timed-out.

The idea is that for specific commands we just don't call scsi_done() and
allow the request to timeout, which ensures SCSI EH kicks-in we try to
abort the command.

Since commit 4a0c6f432d15 ("scsi: scsi_debug: Add new defer type for
mq_poll") this does not seem to work. The issue is that we clear the
sd_dp->aborted flag in schedule_resp() before the completion callback has
run. When the completion callback actually runs, it calls scsi_done() as
normal as sd_dp->aborted unset. This is all very racy.

Fix by not clearing sd_dp->aborted in schedule_resp(). Also move the call
to blk_abort_request() from schedule_resp() to sdebug_q_cmd_complete(),
which makes the code have a more logical sequence.

I also note that this feature only works for commands which are classed as
"SDEG_RES_IMMED_MASK", but only practically triggered with prior RW
commands. So for my experiment I need to run fio to trigger the error on
the "nth" command (see inject_on_this_cmd()), and then run something like
sg_sync to queue a command to actually trigger the abort.

Signed-off-by: John Garry <john.g.garry@oracle.com>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Link: https://lore.kernel.org/r/20230313093114.1498305-11-john.g.garry@oracle.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: scsi_debug: Drop sdebug_dev_info.num_in_q
John Garry [Mon, 13 Mar 2023 09:31:12 +0000 (09:31 +0000)]
scsi: scsi_debug: Drop sdebug_dev_info.num_in_q

In schedule_resp(), under certain conditions we check whether the
per-device queue is full (num_in_q == queue depth - 1) and we may inject a
"task set full" (TSF) error if it is.

However how we read num_in_q is racy - many threads may see the same "queue
is full" value (and also issue a TSF).

There is per-queue locking in reading per-device num_in_q, but that would
not help.

Replace how we read num_in_q at this location with a call to
scsi_device_busy(). Calling scsi_device_busy() is likewise racy (as reading
num_in_q), so nothing lost or gained. Calling scsi_device_busy() is also
slow as it needs to read all bits in the per-device budget bitmap, but we
can live with that since we're just a simulator and it's only under a
certain configs which we would see this.

Also move the "task set full" print earlier as it would only be called now
under this condition. However, previously it may not have been called -
like returning early - but keep it simple and always call it.

At this point we can drop sdebug_dev_info.num_in_q - it is difficult to
maintain properly and adds extra normal case command processing.

Signed-off-by: John Garry <john.g.garry@oracle.com>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Link: https://lore.kernel.org/r/20230313093114.1498305-10-john.g.garry@oracle.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: scsi_debug: Drop check for num_in_q exceeding queue depth
John Garry [Mon, 13 Mar 2023 09:31:11 +0000 (09:31 +0000)]
scsi: scsi_debug: Drop check for num_in_q exceeding queue depth

The per-device num_in_q value cannot exceed the device queue depth, so drop
the check.

Signed-off-by: John Garry <john.g.garry@oracle.com>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Link: https://lore.kernel.org/r/20230313093114.1498305-9-john.g.garry@oracle.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: scsi_debug: Drop scsi_debug_host_reset() device NULL pointer check
John Garry [Mon, 13 Mar 2023 09:31:10 +0000 (09:31 +0000)]
scsi: scsi_debug: Drop scsi_debug_host_reset() device NULL pointer check

The check for device pointer for the SCSI command is unnecessary, so drop
it.

The only caller is scsi_try_host_reset() -> eh_host_reset_handler(), and
there that pointer cannot be NULL.

Indeed, there is already code later in the same function which does not
check the device pointer for the SCSI command.

Signed-off-by: John Garry <john.g.garry@oracle.com>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Link: https://lore.kernel.org/r/20230313093114.1498305-8-john.g.garry@oracle.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: scsi_debug: Drop scsi_debug_bus_reset() NULL pointer checks
John Garry [Mon, 13 Mar 2023 09:31:09 +0000 (09:31 +0000)]
scsi: scsi_debug: Drop scsi_debug_bus_reset() NULL pointer checks

The checks for SCSI cmnd, SCSI device, and SCSI host are unnecessary, so
drop them. Likewise, drop the NULL check for sdbg_host.

The only caller is scsi_try_bus_reset() -> eh_bus_reset_handler(), and
there those pointers cannot be NULL.

Signed-off-by: John Garry <john.g.garry@oracle.com>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Link: https://lore.kernel.org/r/20230313093114.1498305-7-john.g.garry@oracle.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: scsi_debug: Drop scsi_debug_target_reset() NULL pointer checks
John Garry [Mon, 13 Mar 2023 09:31:08 +0000 (09:31 +0000)]
scsi: scsi_debug: Drop scsi_debug_target_reset() NULL pointer checks

The checks for SCSI cmnd, SCSI device, and SCSI host are unnecessary, so
drop them. Likewise, drop the NULL check for sdbg_host.

The only caller is scsi_try_target_reset() -> eh_target_reset_handler(),
and there those pointers cannot be NULL.

Signed-off-by: John Garry <john.g.garry@oracle.com>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Link: https://lore.kernel.org/r/20230313093114.1498305-6-john.g.garry@oracle.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: scsi_debug: Drop scsi_debug_device_reset() NULL pointer checks
John Garry [Mon, 13 Mar 2023 09:31:07 +0000 (09:31 +0000)]
scsi: scsi_debug: Drop scsi_debug_device_reset() NULL pointer checks

The SCSI cmnd pointer arg would never be NULL, so drop the check. In
addition, its SCSI device pointer would never be NULL (so drop that check
also).

The only caller is scsi_try_bus_device_reset(), and the command and its
device pointer could not be NULL when calling eh_device_reset_handler()
there.

Signed-off-by: John Garry <john.g.garry@oracle.com>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Link: https://lore.kernel.org/r/20230313093114.1498305-5-john.g.garry@oracle.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: scsi_debug: Drop scsi_debug_abort() NULL pointer checks
John Garry [Mon, 13 Mar 2023 09:31:06 +0000 (09:31 +0000)]
scsi: scsi_debug: Drop scsi_debug_abort() NULL pointer checks

The SCSI cmnd pointer arg would never be NULL, so drop the check. In
addition, its SCSI device pointer would never be NULL.

The only caller is scsi_send_eh_cmnd() -> scsi_abort_eh_cmnd() ->
scsi_try_to_abort_cmd() -> scsi_try_to_abort_cmd(), and in the origin of
that chain those pointers cannot be NULL.

Signed-off-by: John Garry <john.g.garry@oracle.com>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Link: https://lore.kernel.org/r/20230313093114.1498305-4-john.g.garry@oracle.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: scsi_debug: Stop setting devip->sdbg_host twice
John Garry [Mon, 13 Mar 2023 09:31:05 +0000 (09:31 +0000)]
scsi: scsi_debug: Stop setting devip->sdbg_host twice

In sdebug_device_create(), the devip->sdbg_host pointer is needlessly set
twice, so stop doing that.

Signed-off-by: John Garry <john.g.garry@oracle.com>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Link: https://lore.kernel.org/r/20230313093114.1498305-3-john.g.garry@oracle.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: scsi_debug: Don't hold driver host struct pointer in host->hostdata[]
John Garry [Mon, 13 Mar 2023 09:31:04 +0000 (09:31 +0000)]
scsi: scsi_debug: Don't hold driver host struct pointer in host->hostdata[]

This driver stores just a pointer to the driver host structure in
host->hostdata[]. Most other drivers actually have the driver host
structure allocated in host->hostdata[], but this driver is different as we
allocate that memory separately before allocating the shost memory.

However there is no need to allocate this memory only in host->hostdata[]
when we can already look up the driver host structure from shost->dma_dev,
so add a macro for this - shost_to_sdebug_host(). Rename to_sdebug_host()
-> dev_to_sdebug_host() to avoid ambiguity.

Also remove a check for !sdbg_host in find_build_dev_info(), as this cannot
be true. Other similar checks will be later removed.

Signed-off-by: John Garry <john.g.garry@oracle.com>
Link: https://lore.kernel.org/r/20230313093114.1498305-2-john.g.garry@oracle.com
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: ufs: core: Add trace event for MCQ
Ziqi Chen [Wed, 15 Mar 2023 07:44:25 +0000 (15:44 +0800)]
scsi: ufs: core: Add trace event for MCQ

Add MCQ hardware queue ID in the existing trace event ufshcd_command().

Signed-off-by: Ziqi Chen <quic_ziqichen@quicinc.com>
Link: https://lore.kernel.org/r/1678866271-49601-1-git-send-email-quic_ziqichen@quicinc.com
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: ufs: core: Print trs for pending requests in MCQ mode
Ziqi Chen [Wed, 15 Mar 2023 07:31:52 +0000 (15:31 +0800)]
scsi: ufs: core: Print trs for pending requests in MCQ mode

We don't have outstanding_reqs bitmap in MCQ mode. Considering that the
queue depth may increase beyond 64 in the future, rework ufshcd_print_trs()
to get rid of bitmap usage so that we can print trs for pending requests in
both SDB and MCQ mode.

Signed-off-by: Ziqi Chen <quic_ziqichen@quicinc.com>
Link: https://lore.kernel.org/r/1678865517-43139-1-git-send-email-quic_ziqichen@quicinc.com
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: ufs: core: Set the residual byte count
Bart Van Assche [Tue, 14 Mar 2023 20:58:35 +0000 (13:58 -0700)]
scsi: ufs: core: Set the residual byte count

It is important for the SCSI core to know the residual byte count.  Hence,
extract the residual byte count from the UFS response and pass it to the
SCSI core. A few examples of the output of a debugging patch that has been
applied on top of this patch:

[    1.937750] cmd 0x12: len = 255; resid = 241
[ ... ]
[    1.993400] cmd 0xa0: len = 4096; resid = 4048
[ ... ]

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230314205844.313519-1-bvanassche@acm.org
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: ufs: core: Disable the reset settle delay
Bart Van Assche [Tue, 14 Mar 2023 20:58:12 +0000 (13:58 -0700)]
scsi: ufs: core: Disable the reset settle delay

Neither UFS host controllers nor UFS devices require a ten second delay
after a host reset or after a bus reset. Hence this patch.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230314205822.313447-1-bvanassche@acm.org
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: fnic: Switch to use %ptTs
Andy Shevchenko [Tue, 14 Mar 2023 14:58:13 +0000 (16:58 +0200)]
scsi: fnic: Switch to use %ptTs

Use %ptTs instead of open-coded variant to print contents of time64_t type
in human readable form.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20230314145813.66112-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: be2iscsi: Make some variables static
Tom Rix [Tue, 14 Mar 2023 00:51:57 +0000 (20:51 -0400)]
scsi: be2iscsi: Make some variables static

smatch reports several warnings:

drivers/scsi/be2iscsi/be_main.c:148:1: warning:
  symbol 'dev_attr_beiscsi_log_enable' was not declared. Should it be static?
drivers/scsi/be2iscsi/be_main.c:158:1: warning:
  symbol 'dev_attr_beiscsi_drvr_ver' was not declared. Should it be static?
drivers/scsi/be2iscsi/be_main.c:159:1: warning:
  symbol 'dev_attr_beiscsi_adapter_family' was not declared. Should it be static?
drivers/scsi/be2iscsi/be_main.c:160:1: warning:
  symbol 'dev_attr_beiscsi_fw_ver' was not declared. Should it be static?
drivers/scsi/be2iscsi/be_main.c:161:1: warning:
  symbol 'dev_attr_beiscsi_phys_port' was not declared. Should it be static?
drivers/scsi/be2iscsi/be_main.c:162:1: warning:
  symbol 'dev_attr_beiscsi_active_session_count' was not declared. Should it be static?
drivers/scsi/be2iscsi/be_main.c:164:1: warning:
  symbol 'dev_attr_beiscsi_free_session_count' was not declared. Should it be static ?

These variables are only used in be_main.c, so should be static.

Signed-off-by: Tom Rix <trix@redhat.com>
Link: https://lore.kernel.org/r/20230314005157.536918-1-trix@redhat.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoMerge patch series "PCI/AER: Remove redundant Device Control Error Reporting Enable"
Martin K. Petersen [Fri, 10 Mar 2023 03:01:40 +0000 (22:01 -0500)]
Merge patch series "PCI/AER: Remove redundant Device Control Error Reporting Enable"

Bjorn Helgaas <helgaas@kernel.org> says:

Since f26e58bf6f54 ("PCI/AER: Enable error reporting when AER is native"),
which appeared in v6.0, the PCI core has enabled PCIe error reporting for
all devices during enumeration.

Remove driver code to do this and remove unnecessary includes of
<linux/aer.h> from several other drivers.

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: qla4xxx: Drop redundant pci_enable_pcie_error_reporting()
Bjorn Helgaas [Tue, 7 Mar 2023 18:28:42 +0000 (12:28 -0600)]
scsi: qla4xxx: Drop redundant pci_enable_pcie_error_reporting()

pci_enable_pcie_error_reporting() enables the device to send ERR_*
Messages.  Since commit f26e58bf6f54 ("PCI/AER: Enable error reporting when
AER is native"), the PCI core does this for all devices during enumeration,
so the driver doesn't need to do it itself.

Remove the redundant pci_enable_pcie_error_reporting() call from the
driver.  Also remove the corresponding pci_disable_pcie_error_reporting()
from the driver .remove() path.

Note that this only controls ERR_* Messages from the device.  An ERR_*
Message may cause the Root Port to generate an interrupt, depending on the
AER Root Error Command register managed by the AER service driver.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Link: https://lore.kernel.org/r/20230307182842.870378-11-helgaas@kernel.org
Cc: Nilesh Javali <njavali@marvell.com>
Cc: Manish Rangankar <mrangankar@marvell.com>
Cc: GR-QLogic-Storage-Upstream@marvell.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: qla2xxx: Drop redundant pci_enable_pcie_error_reporting()
Bjorn Helgaas [Tue, 7 Mar 2023 18:28:41 +0000 (12:28 -0600)]
scsi: qla2xxx: Drop redundant pci_enable_pcie_error_reporting()

pci_enable_pcie_error_reporting() enables the device to send ERR_*
Messages.  Since commit f26e58bf6f54 ("PCI/AER: Enable error reporting when
AER is native"), the PCI core does this for all devices during enumeration,
so the driver doesn't need to do it itself.

Remove the redundant pci_enable_pcie_error_reporting() call from the
driver.  Also remove the corresponding pci_disable_pcie_error_reporting()
from the driver .remove() path.

Note that this only controls ERR_* Messages from the device.  An ERR_*
Message may cause the Root Port to generate an interrupt, depending on the
AER Root Error Command register managed by the AER service driver.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Link: https://lore.kernel.org/r/20230307182842.870378-10-helgaas@kernel.org
Cc: Nilesh Javali <njavali@marvell.com>
Cc: GR-QLogic-Storage-Upstream@marvell.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: mpt3sas: Drop redundant pci_enable_pcie_error_reporting()
Bjorn Helgaas [Tue, 7 Mar 2023 18:28:40 +0000 (12:28 -0600)]
scsi: mpt3sas: Drop redundant pci_enable_pcie_error_reporting()

pci_enable_pcie_error_reporting() enables the device to send ERR_*
Messages.  Since commit f26e58bf6f54 ("PCI/AER: Enable error reporting when
AER is native"), the PCI core does this for all devices during enumeration,
so the driver doesn't need to do it itself.

Remove the redundant pci_enable_pcie_error_reporting() call from the
driver.  Also remove the corresponding pci_disable_pcie_error_reporting()
from the driver .remove() path.

Note that this only controls ERR_* Messages from the device.  An ERR_*
Message may cause the Root Port to generate an interrupt, depending on the
AER Root Error Command register managed by the AER service driver.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Link: https://lore.kernel.org/r/20230307182842.870378-9-helgaas@kernel.org
Cc: Sathya Prakash <sathya.prakash@broadcom.com>
Cc: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Cc: Suganath Prabu Subramani <suganath-prabu.subramani@broadcom.com>
Cc: MPT-FusionLinux.pdl@broadcom.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: lpfc: Drop redundant pci_enable_pcie_error_reporting()
Bjorn Helgaas [Tue, 7 Mar 2023 18:28:39 +0000 (12:28 -0600)]
scsi: lpfc: Drop redundant pci_enable_pcie_error_reporting()

pci_enable_pcie_error_reporting() enables the device to send ERR_*
Messages.  Since commit f26e58bf6f54 ("PCI/AER: Enable error reporting when
AER is native"), the PCI core does this for all devices during enumeration,
so the driver doesn't need to do it itself.

Remove the redundant pci_enable_pcie_error_reporting() call from the
driver.  Also remove the corresponding pci_disable_pcie_error_reporting()
from the driver .remove() path.

Note that this only controls ERR_* Messages from the device.  An ERR_*
Message may cause the Root Port to generate an interrupt, depending on the
AER Root Error Command register managed by the AER service driver.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Link: https://lore.kernel.org/r/20230307182842.870378-8-helgaas@kernel.org
Cc: James Smart <james.smart@broadcom.com>
Cc: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: hpsa: Remove unnecessary pci_disable_pcie_error_reporting() comment
Bjorn Helgaas [Tue, 7 Mar 2023 18:28:38 +0000 (12:28 -0600)]
scsi: hpsa: Remove unnecessary pci_disable_pcie_error_reporting() comment

Commit 105a3dbc7452 ("hpsa: clean up driver init") added a comment about
pci_disable_pcie_error_reporting(), but hpsa has never called either
pci_enable_pcie_error_reporting() or pci_disable_pcie_error_reporting().

Since commit f26e58bf6f54 ("PCI/AER: Enable error reporting when AER is
native"), the PCI core is responsible for managing PCIe device error
reporting.

Remove the comment about pci_disable_pcie_error_reporting().

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Link: https://lore.kernel.org/r/20230307182842.870378-7-helgaas@kernel.org
Cc: Don Brace <don.brace@microchip.com>
Cc: storagedev@microchip.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: csiostor: Remove unnecessary aer.h include
Bjorn Helgaas [Tue, 7 Mar 2023 18:28:37 +0000 (12:28 -0600)]
scsi: csiostor: Remove unnecessary aer.h include

<linux/aer.h> is unused, so remove it.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Link: https://lore.kernel.org/r/20230307182842.870378-6-helgaas@kernel.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: bfa: Drop redundant pci_enable_pcie_error_reporting()
Bjorn Helgaas [Tue, 7 Mar 2023 18:28:36 +0000 (12:28 -0600)]
scsi: bfa: Drop redundant pci_enable_pcie_error_reporting()

pci_enable_pcie_error_reporting() enables the device to send ERR_*
Messages.  Since commit f26e58bf6f54 ("PCI/AER: Enable error reporting when
AER is native"), the PCI core does this for all devices during enumeration,
so the driver doesn't need to do it itself.

Remove the redundant pci_enable_pcie_error_reporting() call from the
driver.  Also remove the corresponding pci_disable_pcie_error_reporting()
from the driver .remove() path.

Note that this only controls ERR_* Messages from the device.  An ERR_*
Message may cause the Root Port to generate an interrupt, depending on the
AER Root Error Command register managed by the AER service driver.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Link: https://lore.kernel.org/r/20230307182842.870378-5-helgaas@kernel.org
Cc: Anil Gurumurthy <anil.gurumurthy@qlogic.com>
Cc: Sudarsana Kalluru <sudarsana.kalluru@qlogic.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: be2iscsi: Drop redundant pci_enable_pcie_error_reporting()
Bjorn Helgaas [Tue, 7 Mar 2023 18:28:35 +0000 (12:28 -0600)]
scsi: be2iscsi: Drop redundant pci_enable_pcie_error_reporting()

pci_enable_pcie_error_reporting() enables the device to send ERR_*
Messages.  Since commit f26e58bf6f54 ("PCI/AER: Enable error reporting when
AER is native"), the PCI core does this for all devices during enumeration,
so the driver doesn't need to do it itself.

Remove the redundant pci_enable_pcie_error_reporting() call from the
driver.  Also remove the corresponding pci_disable_pcie_error_reporting()
from the driver .remove() path.

Note that this only controls ERR_* Messages from the device.  An ERR_*
Message may cause the Root Port to generate an interrupt, depending on the
AER Root Error Command register managed by the AER service driver.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Link: https://lore.kernel.org/r/20230307182842.870378-4-helgaas@kernel.org
Cc: Ketan Mukadam <ketan.mukadam@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: arcmsr: Remove unnecessary aer.h include
Bjorn Helgaas [Tue, 7 Mar 2023 18:28:34 +0000 (12:28 -0600)]
scsi: arcmsr: Remove unnecessary aer.h include

<linux/aer.h> is unused, so remove it.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Link: https://lore.kernel.org/r/20230307182842.870378-3-helgaas@kernel.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: aacraid: Drop redundant pci_enable_pcie_error_reporting()
Bjorn Helgaas [Tue, 7 Mar 2023 18:28:33 +0000 (12:28 -0600)]
scsi: aacraid: Drop redundant pci_enable_pcie_error_reporting()

pci_enable_pcie_error_reporting() enables the device to send ERR_*
Messages.  Since commit f26e58bf6f54 ("PCI/AER: Enable error reporting when
AER is native"), the PCI core does this for all devices during enumeration,
so the driver doesn't need to do it itself.

Remove the redundant pci_enable_pcie_error_reporting() call from the
driver.

Note that this only controls ERR_* Messages from the device.  An ERR_*
Message may cause the Root Port to generate an interrupt, depending on the
AER Root Error Command register managed by the AER service driver.

Also remove pci_disable_pcie_error_reporting() from the .error_detected()
path, which was added by commit 5c63f7f710bd ("aacraid: Added EEH support")
but looks unnecessary.  Error reporting will be disabled by the device
reset and will be re-enabled by the pci_restore_state() in
aac_pci_slot_reset().

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Link: https://lore.kernel.org/r/20230307182842.870378-2-helgaas@kernel.org
Cc: Adaptec OEM Raid Solutions <aacraid@microsemi.com>
Cc: Raghava Aditya Renukunta <raghavaaditya.renukunta@pmcs.com>
Cc: Tomas Henzl <thenzl@redhat.com>
Cc: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoMerge patch series "Add poll support for hisi_sas v3 hw"
Martin K. Petersen [Fri, 10 Mar 2023 02:50:53 +0000 (21:50 -0500)]
Merge patch series "Add poll support for hisi_sas v3 hw"

chenxiang <chenxiang66@hisilicon.com> says:

To support IO_URING IOPOLL support for hisi_sas, we need to:

 - Add and fill mq_poll interface to poll queue;

 - Ensure internal I/Os (including internal abort I/Os) are delivered and
   completed through non-iopoll queue (queue 0);

Sending internal abort commands to non-poll queue actually requires to
sending the abort command to every queue. This carries a a risk. Make iopoll
support module parameter "experimental".

I have tested performance on v3 hw with different modes as follows.  4K
READs and 4K WRITEs both see an improvement when enabling poll mode:

4K READ     4K RANDREAD     4K WRITE 4K RANDWRITE
interrupt + libaio 1770k     1316k     1197k 831k
interrupt + io_uring 1848k     1390k     1238k 857k
iopoll + io_uring 2117k     1364k     1874k 849k

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: hisi_sas: Add device attribute experimental_iopoll_q_cnt for v3 hw
Xiang Chen [Tue, 7 Mar 2023 06:09:15 +0000 (14:09 +0800)]
scsi: hisi_sas: Add device attribute experimental_iopoll_q_cnt for v3 hw

Add device attribute experimental_iopoll_q_cnt to indicate how many iopoll
queues are used for v3 hw.

Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Link: https://lore.kernel.org/r/1678169355-76215-5-git-send-email-chenxiang66@hisilicon.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: hisi_sas: Sync complete queue for poll queue
Xiang Chen [Tue, 7 Mar 2023 06:09:14 +0000 (14:09 +0800)]
scsi: hisi_sas: Sync complete queue for poll queue

Currently we sync irq to avoid freeing task before using task in I/O
completion. After adding io_uring support, we need to do something similar
for poll queues.  As the process of CQ entries on poll queue are protected
by spinlock cq->lock, we can use spin_lock() + spin_unlock() on cq->lock to
make sure that CQ entries are processed to completion and then the complete
queue is synced.

Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Link: https://lore.kernel.org/r/1678169355-76215-4-git-send-email-chenxiang66@hisilicon.com
Reviewed-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: hisi_sas: Add poll support for v3 hw
Xiang Chen [Tue, 7 Mar 2023 06:09:13 +0000 (14:09 +0800)]
scsi: hisi_sas: Add poll support for v3 hw

Add a module parameter to set how many queues are used for iopoll. Also
fill the interface mq_poll. For internal I/Os from libsas and libata we use
non-iopoll queue (queue 0) to deliver and complete them. But for internal
abort I/Os, just don't send them for poll queues.

There is still a risk associated as this sends internal abort commands to
non-iopoll queues which actually requires sending an internal abort command
to every queue. As a result, make the module parameter as "experimental"
for now.

Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Link: https://lore.kernel.org/r/1678169355-76215-3-git-send-email-chenxiang66@hisilicon.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: hisi_sas: Add function complete_v3_hw()
Xiang Chen [Tue, 7 Mar 2023 06:09:12 +0000 (14:09 +0800)]
scsi: hisi_sas: Add function complete_v3_hw()

Put the work of processing cq slots in a separate function,
complete_v3_hw(), which can then be used by cq_thread_v3_hw() and other
functions when adding poll support.

Co-developed-by: John Garry <john.garry@huawei.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Link: https://lore.kernel.org/r/1678169355-76215-2-git-send-email-chenxiang66@hisilicon.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoMerge patch series "scsi: target: make RTPI an TPG identifier"
Martin K. Petersen [Fri, 10 Mar 2023 02:35:58 +0000 (21:35 -0500)]
Merge patch series "scsi: target: make RTPI an TPG identifier"

Dmitry Bogdanov <d.bogdanov@yadro.com> says:

SAM-5 4.6.5.2 (Relative Port Identifier attribute) defines the attribute as
unique across SCSI target ports:

  The Relative Port Identifier attribute identifies a SCSI target port or a
  SCSI initiator port relative to other SCSI ports in a SCSI target device
  and any SCSI initiator devices contained within that SCSI target device. A
  SCSI target device may assign relative port identifiers to its SCSI target
  ports and any SCSI initiator ports. If relative port identifiers are
  assigned, the SCSI target device shall assign each of its SCSI target
  ports and any SCSI initiator ports a unique relative port identifier from
  1 to 65 535. SCSI target ports and SCSI initiator ports share the same
  number space.

In the current TCM implementation, auto-incremented lun_rtpi weakly follows
the model outlined by SAM-5 and SPC-4. In case of multiple SCSI target
ports (se_portal_groups), which is common to scenario with multiple HBAs or
multiple iSCSI/FC targets, it's possible to have two backstores (se_devices)
with different values of lun_rtpi on the same SCSI target port.

Similar issue happens during re-export. If a LUN of a backstore is removed
from a target port and added again to the same target port, RTPI is
incremented again and will be different from the first time.

The two issues happen because each se_device increments RTPI for its own
LUNs independently.

The behaviour means that a SCSI application client can't reliably make any
sense of RTPI values reported by a LUN as it's not really related to SCSI
target ports. A conforming target implementation must ensure that RTPI field
is unique per port. The patchset resolves the issue.

Make RTPI be part of se_tpg instead of se_lun. Make it configurable.

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: target: core: Add RTPI attribute for target port
Dmitry Bogdanov [Wed, 1 Mar 2023 08:45:12 +0000 (11:45 +0300)]
scsi: target: core: Add RTPI attribute for target port

RELATIVE TARGET PORT IDENTIFIER can be read and configured via configfs:

$ echo 0x10 > $TARGET/tpgt_N/rtpi

RTPI can be changed only on disabled target ports.

Co-developed-by: Roman Bolshakov <r.bolshakov@yadro.com>
Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
Signed-off-by: Dmitry Bogdanov <d.bogdanov@yadro.com>
Link: https://lore.kernel.org/r/20230301084512.21956-5-d.bogdanov@yadro.com
Reviewed-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: target: core: Drop device-based RTPI
Roman Bolshakov [Wed, 1 Mar 2023 08:45:11 +0000 (11:45 +0300)]
scsi: target: core: Drop device-based RTPI

The code is not needed since target port-based RTPI allocation replaced it.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
Signed-off-by: Dmitry Bogdanov <d.bogdanov@yadro.com>
Link: https://lore.kernel.org/r/20230301084512.21956-4-d.bogdanov@yadro.com
Reviewed-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: target: core: Use RTPI from target port
Roman Bolshakov [Wed, 1 Mar 2023 08:45:10 +0000 (11:45 +0300)]
scsi: target: core: Use RTPI from target port

Replace all references to RTPI from LUN field to se_portal_group field.  It
introduces consistent reporting of RTPI for all LUNs and all target ports.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
Signed-off-by: Dmitry Bogdanov <d.bogdanov@yadro.com>
Link: https://lore.kernel.org/r/20230301084512.21956-3-d.bogdanov@yadro.com
Reviewed-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: target: core: Add RTPI field to target port
Dmitry Bogdanov [Wed, 1 Mar 2023 08:45:09 +0000 (11:45 +0300)]
scsi: target: core: Add RTPI field to target port

SAM-5 4.6.5.2 (Relative Port Identifier attribute) defines the attribute as
unique across SCSI target ports.

The change introduces RTPI attribute to se_portal group. The value is
unique across all enabled SCSI target ports. It also limits number of SCSI
target ports to 65535.

Signed-off-by: Dmitry Bogdanov <d.bogdanov@yadro.com>
Link: https://lore.kernel.org/r/20230301084512.21956-2-d.bogdanov@yadro.com
Reviewed-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoMerge patch series "lpfc: Update lpfc to revision 14.2.0.11"
Martin K. Petersen [Fri, 10 Mar 2023 02:22:40 +0000 (21:22 -0500)]
Merge patch series "lpfc: Update lpfc to revision 14.2.0.11"

Justin Tee <justin.tee@broadcom.com> says:

Update lpfc to revision 14.2.0.11

This patch set contains bug fixes for buffer overflow, resource
management, discovery, and HBA error status handling.

The patches were cut against Martin's 6.3/scsi-queue tree.

Justin Tee (10):
  lpfc: Protect against potential lpfc_debugfs_lockstat_write buffer overflow
  lpfc: Reorder freeing of various dma buffers and their list removal
  lpfc: Fix lockdep warning for rx_monitor lock when unloading driver
  lpfc: Record LOGO state with discovery engine even if aborted
  lpfc: Defer issuing new PLOGI if received RSCN before completing REG_LOGIN
  lpfc: Correct used_rpi count when devloss tmo fires with no recovery
  lpfc: Skip waiting for register ready bits when in unrecoverable state
  lpfc: Revise lpfc_error_lost_link reason code evaluation logic
  lpfc: Update lpfc version to 14.2.0.11
  lpfc: Copyright updates for 14.2.0.11 patches

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: lpfc: Copyright updates for 14.2.0.11 patches
Justin Tee [Wed, 1 Mar 2023 23:16:26 +0000 (15:16 -0800)]
scsi: lpfc: Copyright updates for 14.2.0.11 patches

Update copyrights to 2023 for files modified in the 14.2.0.11 patch set.

Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Link: https://lore.kernel.org/r/20230301231626.9621-11-justintee8345@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: lpfc: Update lpfc version to 14.2.0.11
Justin Tee [Wed, 1 Mar 2023 23:16:25 +0000 (15:16 -0800)]
scsi: lpfc: Update lpfc version to 14.2.0.11

Update lpfc version to 14.2.0.11.

Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Link: https://lore.kernel.org/r/20230301231626.9621-10-justintee8345@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: lpfc: Revise lpfc_error_lost_link() reason code evaluation logic
Justin Tee [Wed, 1 Mar 2023 23:16:24 +0000 (15:16 -0800)]
scsi: lpfc: Revise lpfc_error_lost_link() reason code evaluation logic

Extended status reason code errors should mask off the IOERR_PARAM_MASK
before checking strict equalities for IOERR values.

Update the lpfc_error_lost_link() routine as such.

Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Link: https://lore.kernel.org/r/20230301231626.9621-9-justintee8345@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: lpfc: Skip waiting for register ready bits when in unrecoverable state
Justin Tee [Wed, 1 Mar 2023 23:16:23 +0000 (15:16 -0800)]
scsi: lpfc: Skip waiting for register ready bits when in unrecoverable state

During tolerance tests that force an HBA to become unresponsive, rmmod
hangs resulting in the inability to remove the driver.

The lpfc_pci_remove_one_s4() routine attempts to submit a clean up mailbox
command via the lpfc_sli4_post_sync_mbox() routine, but ends up waiting
forever for a mailbox register to set its ready bit.  Because the HBA is in
an unrecoverable and unresponsive state, the ready bit will never be set.

Create a new routine called lpfc_sli4_unrecoverable_port(), which checks a
port status register's error notification bits.

Use the lpfc_sli4_unrecoverable_port() routine in ready bit check routines
to early return error if port is deemed unrecoverable.

Also, when the lpfc_handle_eratt_s4() handler detects an unrecoverable
state, call the lpfc_sli4_offline_eratt() routine to kick off flushing
outstanding I/O.

Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Link: https://lore.kernel.org/r/20230301231626.9621-8-justintee8345@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: lpfc: Correct used_rpi count when devloss tmo fires with no recovery
Justin Tee [Wed, 1 Mar 2023 23:16:22 +0000 (15:16 -0800)]
scsi: lpfc: Correct used_rpi count when devloss tmo fires with no recovery

A fabric controller can sometimes send an RDP request right before a link
down event.  Because of this outstanding RDP request, the driver does not
remove the last reference count on its ndlp causing a potential leak of RPI
resources when devloss tmo fires.

In lpfc_cmpl_els_rsp(), modify the NPIV clause to always allow the
lpfc_drop_node() routine to execute when not registered with SCSI
transport.

This relaxes the contraint that an NPIV ndlp must be in a specific state in
order to call lpfc_drop node.  Logic is revised such that the
lpfc_drop_node() routine is always called to ensure the last ndlp decrement
occurs.

Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Link: https://lore.kernel.org/r/20230301231626.9621-7-justintee8345@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: lpfc: Defer issuing new PLOGI if received RSCN before completing REG_LOGIN
Justin Tee [Wed, 1 Mar 2023 23:16:21 +0000 (15:16 -0800)]
scsi: lpfc: Defer issuing new PLOGI if received RSCN before completing REG_LOGIN

When mapped to a target with multiple virtual ports, a link bounce
sometimes results in unsuccessful rediscovery of all of the target's
virtual ports.  This is because a succession of repeat RSCNs for the
virtual target ports leaves ndlps in the REG_LOGIN state with the
NLP_REG_LOGIN_SEND flag set.  With NLP_REG_LOGIN_SEND set, during the next
PLOGI, the driver will UNREG_RPI.  When UNREG_RPI is processed, the driver
can be in the middle of PRLI_ISSUE or MAPPED state resulting in an illegal
state transition by the discovery engine and stalling.

Fix by calling the discovery state machine with DEVICE_RECOVERY event
during RSCN processing.  This will set the NLP_IGNR_REG_CMPL bit and
prevent the old REG_LOGIN state from advancing.  Then for the new PLOGI
issue, add the check for the NLP_IGNR_REG_CMPL bit to delay issuing the new
PLOGI until the queued REG_LOGIN and UNREG_LOGIN have been processed.

Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Link: https://lore.kernel.org/r/20230301231626.9621-6-justintee8345@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: lpfc: Record LOGO state with discovery engine even if aborted
Justin Tee [Wed, 1 Mar 2023 23:16:20 +0000 (15:16 -0800)]
scsi: lpfc: Record LOGO state with discovery engine even if aborted

A target vendor array reboot in P2P topology can sometimes result in
unsuccessful rediscovery.

Rework the lpfc_cmpl_els_logo() routine such that when the LOGO completes
as a failure because of driver abort, the LOGO state is still recorded with
the discovery state machine.

This is a small rework to set LOGO completion without forcing a device
removal state change.

Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Link: https://lore.kernel.org/r/20230301231626.9621-5-justintee8345@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: lpfc: Fix lockdep warning for rx_monitor lock when unloading driver
Justin Tee [Wed, 1 Mar 2023 23:16:19 +0000 (15:16 -0800)]
scsi: lpfc: Fix lockdep warning for rx_monitor lock when unloading driver

Lockdep enabled kernels report a theoretical deadlock state where the
cmf_timer interrupt occurs while the rx_monitor ring is being destroyed.

During rmmod, the cmf_timer is cancelled prior to the
lpfc_rx_monitor_destroy_ring call.  This actually eliminates the need to
take the rx_monitor ring lock in lpfc_rx_monitor_destroy_ring.  Thus, just
remove lock/unlock of rx_monitor in lpfc_rx_monitor_destroy_ring.

Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Link: https://lore.kernel.org/r/20230301231626.9621-4-justintee8345@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: lpfc: Reorder freeing of various DMA buffers and their list removal
Justin Tee [Wed, 1 Mar 2023 23:16:18 +0000 (15:16 -0800)]
scsi: lpfc: Reorder freeing of various DMA buffers and their list removal

Code sections where DMA resources are freed before list removal are
reworked to ensure item removal before being freed.

Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Link: https://lore.kernel.org/r/20230301231626.9621-3-justintee8345@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: lpfc: Prevent lpfc_debugfs_lockstat_write() buffer overflow
Justin Tee [Wed, 1 Mar 2023 23:16:17 +0000 (15:16 -0800)]
scsi: lpfc: Prevent lpfc_debugfs_lockstat_write() buffer overflow

A static code analysis tool flagged the possibility of buffer overflow when
using copy_from_user() for a debugfs entry.

Currently, it is possible that copy_from_user() copies more bytes than what
would fit in the mybuf char array.  Add a min() restriction check between
sizeof(mybuf) - 1 and nbytes passed from the userspace buffer to protect
against buffer overflow.

Link: https://lore.kernel.org/r/20230301231626.9621-2-justintee8345@gmail.com
Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: message: fusion: Avoid flush_scheduled_work() usage
Tetsuo Handa [Tue, 21 Feb 2023 15:02:46 +0000 (00:02 +0900)]
scsi: message: fusion: Avoid flush_scheduled_work() usage

Like commit c4f135d64382 ("workqueue: Wrap flush_workqueue() using a
macro") says, flush_scheduled_work() is dangerous and will be forbidden.

Commit 4d4109d0eb69 ("[SCSI] mpt fusion: Power Management fixes for MPT SAS
PCI-E controllers") added flush_scheduled_work() call into
mptscsih_suspend().  As of commit 4d4109d0eb69, there were several
schedule{,_delayed}_work() calls where flush_scheduled_work() from
mptscsih_suspend() meant to wait for completion. However, which work items
this flush_scheduled_work() call was for was not explained.

Then, schedule_work("struct mptsas_hotplug_event"->work) and
schedule_work(MPT_ADAPTER->sas_persist_task) have been removed by commit
3eb0822c6740 ("[SCSI] mpt fusion: Firmware event implementation using
seperate WorkQueue"), and schedule_work("struct
mptsas_send_discovery_event"->work) has been removed by commit f9c34022eae9
("[SCSI] mpt fusion: SAS topology scan changes, expander events").

There still remains schedule_work("struct work_queue_wrapper"->work) call
in mptspi.c and schedule_delayed_work("struct mpt_lan_priv"->work) call in
mptlan.c , but I guess that these are not work items which commit
4d4109d0eb69 meant to wait for completion because these are not per
MPT_ADAPTER work items. If my guess is correct, we no longer need to call
flush_scheduled_work() from mptscsih_suspend().

Link: https://lore.kernel.org/r/0b9ebcfb-b647-1381-0653-b54528a64a86@I-love.SAKURA.ne.jp
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: message: fusion: Remove unused sas_persist_task work
Tetsuo Handa [Tue, 21 Feb 2023 15:02:41 +0000 (00:02 +0900)]
scsi: message: fusion: Remove unused sas_persist_task work

MPT_ADAPTER->sas_persist_task is no longer used since commit 3eb0822c6740
("[SCSI] mpt fusion: Firmware event implementation using seperate
WorkQueue").

Link: https://lore.kernel.org/r/b2ca2164-5347-8ec1-d8b6-3225df864173@I-love.SAKURA.ne.jp
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoscsi: be2iscsi: Remove unused variable internal_page_offset
Jiapeng Chong [Thu, 9 Feb 2023 03:52:24 +0000 (11:52 +0800)]
scsi: be2iscsi: Remove unused variable internal_page_offset

The variable 'internal_page_offset' is not used. Delete it.

drivers/scsi/be2iscsi/be_cmds.c:1176:6: warning: variable 'internal_page_offset' set but not used.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=4011
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Link: https://lore.kernel.org/r/20230209035224.90327-1-jiapeng.chong@linux.alibaba.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
18 months agoLinux 6.3-rc1 v6.3-rc1
Linus Torvalds [Sun, 5 Mar 2023 22:52:03 +0000 (14:52 -0800)]
Linux 6.3-rc1

18 months agocpumask: re-introduce constant-sized cpumask optimizations
Linus Torvalds [Sat, 4 Mar 2023 21:35:43 +0000 (13:35 -0800)]
cpumask: re-introduce constant-sized cpumask optimizations

Commit aa47a7c215e7 ("lib/cpumask: deprecate nr_cpumask_bits") resulted
in the cpumask operations potentially becoming hugely less efficient,
because suddenly the cpumask was always considered to be variable-sized.

The optimization was then later added back in a limited form by commit
6f9c07be9d02 ("lib/cpumask: add FORCE_NR_CPUS config option"), but that
FORCE_NR_CPUS option is not useful in a generic kernel and more of a
special case for embedded situations with fixed hardware.

Instead, just re-introduce the optimization, with some changes.

Instead of depending on CPUMASK_OFFSTACK being false, and then always
using the full constant cpumask width, this introduces three different
cpumask "sizes":

 - the exact size (nr_cpumask_bits) remains identical to nr_cpu_ids.

   This is used for situations where we should use the exact size.

 - the "small" size (small_cpumask_bits) is the NR_CPUS constant if it
   fits in a single word and the bitmap operations thus end up able
   to trigger the "small_const_nbits()" optimizations.

   This is used for the operations that have optimized single-word
   cases that get inlined, notably the bit find and scanning functions.

 - the "large" size (large_cpumask_bits) is the NR_CPUS constant if it
   is an sufficiently small constant that makes simple "copy" and
   "clear" operations more efficient.

   This is arbitrarily set at four words or less.

As a an example of this situation, without this fixed size optimization,
cpumask_clear() will generate code like

        movl    nr_cpu_ids(%rip), %edx
        addq    $63, %rdx
        shrq    $3, %rdx
        andl    $-8, %edx
        callq   memset@PLT

on x86-64, because it would calculate the "exact" number of longwords
that need to be cleared.

In contrast, with this patch, using a MAX_CPU of 64 (which is quite a
reasonable value to use), the above becomes a single

movq $0,cpumask

instruction instead, because instead of caring to figure out exactly how
many CPU's the system has, it just knows that the cpumask will be a
single word and can just clear it all.

Note that this does end up tightening the rules a bit from the original
version in another way: operations that set bits in the cpumask are now
limited to the actual nr_cpu_ids limit, whereas we used to do the
nr_cpumask_bits thing almost everywhere in the cpumask code.

But if you just clear bits, or scan for bits, we can use the simpler
compile-time constants.

In the process, remove 'cpumask_complement()' and 'for_each_cpu_not()'
which were not useful, and which fundamentally have to be limited to
'nr_cpu_ids'.  Better remove them now than have somebody introduce use
of them later.

Of course, on x86-64 with MAXSMP there is no sane small compile-time
constant for the cpumask sizes, and we end up using the actual CPU bits,
and will generate the above kind of horrors regardless.  Please don't
use MAXSMP unless you really expect to have machines with thousands of
cores.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
18 months agoMerge tag 'v6.3-p2' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
Linus Torvalds [Sun, 5 Mar 2023 19:32:30 +0000 (11:32 -0800)]
Merge tag 'v6.3-p2' of git://git./linux/kernel/git/herbert/crypto-2.6

Pull crypto fix from Herbert Xu:
 "Fix a regression in the caam driver"

* tag 'v6.3-p2' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
  crypto: caam - Fix edesc/iv ordering mixup

18 months agoMerge tag 'x86-urgent-2023-03-05' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Sun, 5 Mar 2023 19:27:48 +0000 (11:27 -0800)]
Merge tag 'x86-urgent-2023-03-05' of git://git./linux/kernel/git/tip/tip

Pull x86 updates from Thomas Gleixner:
 "A small set of updates for x86:

   - Return -EIO instead of success when the certificate buffer for SEV
     guests is not large enough

   - Allow STIPB to be enabled with legacy IBSR. Legacy IBRS is cleared
     on return to userspace for performance reasons, but the leaves user
     space vulnerable to cross-thread attacks which STIBP prevents.
     Update the documentation accordingly"

* tag 'x86-urgent-2023-03-05' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  virt/sev-guest: Return -EIO if certificate buffer is not large enough
  Documentation/hw-vuln: Document the interaction between IBRS and STIBP
  x86/speculation: Allow enabling STIBP with legacy IBRS

18 months agoMerge tag 'irq-urgent-2023-03-05' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Sun, 5 Mar 2023 19:19:16 +0000 (11:19 -0800)]
Merge tag 'irq-urgent-2023-03-05' of git://git./linux/kernel/git/tip/tip

Pull irq updates from Thomas Gleixner:
 "A set of updates for the interrupt susbsystem:

   - Prevent possible NULL pointer derefences in
     irq_data_get_affinity_mask() and irq_domain_create_hierarchy()

   - Take the per device MSI lock before invoking code which relies on
     it being hold

   - Make sure that MSI descriptors are unreferenced before freeing
     them. This was overlooked when the platform MSI code was converted
     to use core infrastructure and results in a fals positive warning

   - Remove dead code in the MSI subsystem

   - Clarify the documentation for pci_msix_free_irq()

   - More kobj_type constification"

* tag 'irq-urgent-2023-03-05' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  genirq/msi, platform-msi: Ensure that MSI descriptors are unreferenced
  genirq/msi: Drop dead domain name assignment
  irqdomain: Add missing NULL pointer check in irq_domain_create_hierarchy()
  genirq/irqdesc: Make kobj_type structures constant
  PCI/MSI: Clarify usage of pci_msix_free_irq()
  genirq/msi: Take the per-device MSI lock before validating the control structure
  genirq/ipi: Fix NULL pointer deref in irq_data_get_affinity_mask()

18 months agoMerge tag 'pull-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Linus Torvalds [Sun, 5 Mar 2023 19:11:52 +0000 (11:11 -0800)]
Merge tag 'pull-misc' of git://git./linux/kernel/git/viro/vfs

Pull vfs update from Al Viro:
 "Adding Christian Brauner as VFS co-maintainer"

* tag 'pull-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
  Adding VFS co-maintainer

18 months agoMerge tag 'pull-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Linus Torvalds [Sun, 5 Mar 2023 19:07:58 +0000 (11:07 -0800)]
Merge tag 'pull-fixes' of git://git./linux/kernel/git/viro/vfs

Pull VM_FAULT_RETRY fixes from Al Viro:
 "Some of the page fault handlers do not deal with the following case
  correctly:

   - handle_mm_fault() has returned VM_FAULT_RETRY

   - there is a pending fatal signal

   - fault had happened in kernel mode

  Correct action in such case is not "return unconditionally" - fatal
  signals are handled only upon return to userland and something like
  copy_to_user() would end up retrying the faulting instruction and
  triggering the same fault again and again.

  What we need to do in such case is to make the caller to treat that as
  failed uaccess attempt - handle exception if there is an exception
  handler for faulting instruction or oops if there isn't one.

  Over the years some architectures had been fixed and now are handling
  that case properly; some still do not. This series should fix the
  remaining ones.

  Status:

   - m68k, riscv, hexagon, parisc: tested/acked by maintainers.

   - alpha, sparc32, sparc64: tested locally - bug has been reproduced
     on the unpatched kernel and verified to be fixed by this series.

   - ia64, microblaze, nios2, openrisc: build, but otherwise completely
     untested"

* tag 'pull-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
  openrisc: fix livelock in uaccess
  nios2: fix livelock in uaccess
  microblaze: fix livelock in uaccess
  ia64: fix livelock in uaccess
  sparc: fix livelock in uaccess
  alpha: fix livelock in uaccess
  parisc: fix livelock in uaccess
  hexagon: fix livelock in uaccess
  riscv: fix livelock in uaccess
  m68k: fix livelock in uaccess

18 months agoRemove Intel compiler support
Masahiro Yamada [Sun, 16 Oct 2022 18:23:49 +0000 (03:23 +0900)]
Remove Intel compiler support

include/linux/compiler-intel.h had no update in the past 3 years.

We often forget about the third C compiler to build the kernel.

For example, commit a0a12c3ed057 ("asm goto: eradicate CC_HAS_ASM_GOTO")
only mentioned GCC and Clang.

init/Kconfig defines CC_IS_GCC and CC_IS_CLANG but not CC_IS_ICC,
and nobody has reported any issue.

I guess the Intel Compiler support is broken, and nobody is caring
about it.

Harald Arnesen pointed out ICC (classic Intel C/C++ compiler) is
deprecated:

    $ icc -v
    icc: remark #10441: The Intel(R) C++ Compiler Classic (ICC) is
    deprecated and will be removed from product release in the second half
    of 2023. The Intel(R) oneAPI DPC++/C++ Compiler (ICX) is the recommended
    compiler moving forward. Please transition to use this compiler. Use
    '-diag-disable=10441' to disable this message.
    icc version 2021.7.0 (gcc version 12.1.0 compatibility)

Arnd Bergmann provided a link to the article, "Intel C/C++ compilers
complete adoption of LLVM".

lib/zstd/common/compiler.h and lib/zstd/compress/zstd_fast.c were kept
untouched for better sync with https://github.com/facebook/zstd

Link: https://www.intel.com/content/www/us/en/developer/articles/technical/adoption-of-llvm-complete-icx.html
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Miguel Ojeda <ojeda@kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
18 months agoAdding VFS co-maintainer
Al Viro [Sun, 5 Mar 2023 01:27:29 +0000 (20:27 -0500)]
Adding VFS co-maintainer

Acked-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
18 months agoMerge tag 'i2c-for-6.3-rc1-part2' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Sat, 4 Mar 2023 22:48:29 +0000 (14:48 -0800)]
Merge tag 'i2c-for-6.3-rc1-part2' of git://git./linux/kernel/git/wsa/linux

Pull more i2c updates from Wolfram Sang:
 "Some improvements/fixes for the newly added GXP driver and a Kconfig
  dependency fix"

* tag 'i2c-for-6.3-rc1-part2' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
  i2c: gxp: fix an error code in probe
  i2c: gxp: return proper error on address NACK
  i2c: gxp: remove "empty" switch statement
  i2c: Disable I2C_APPLE when I2C_PASEMI is a builtin

18 months agomm: avoid gcc complaint about pointer casting
Linus Torvalds [Sat, 4 Mar 2023 22:03:27 +0000 (14:03 -0800)]
mm: avoid gcc complaint about pointer casting

The migration code ends up temporarily stashing information of the wrong
type in unused fields of the newly allocated destination folio.  That
all works fine, but gcc does complain about the pointer type mis-use:

    mm/migrate.c: In function ‘__migrate_folio_extract’:
    mm/migrate.c:1050:20: note: randstruct: casting between randomized structure pointer types (ssa): ‘struct anon_vma’ and ‘struct address_space’

     1050 |         *anon_vmap = (void *)dst->mapping;
          |         ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~

and gcc is actually right to complain since it really doesn't understand
that this is a very temporary special case where this is ok.

This could be fixed in different ways by just obfuscating the assignment
sufficiently that gcc doesn't see what is going on, but the truly
"proper C" way to do this is by explicitly using a union.

Using unions for type conversions like this is normally hugely ugly and
syntactically nasty, but this really is one of the few cases where we
want to make it clear that we're not doing type conversion, we're really
re-using the value bit-for-bit just using another type.

IOW, this should not become a common pattern, but in this one case using
that odd union is probably the best way to document to the compiler what
is conceptually going on here.

[ Side note: there are valid cases where we convert pointers to other
  pointer types, notably the whole "folio vs page" situation, where the
  types actually have fundamental commonalities.

  The fact that the gcc note is limited to just randomized structures
  means that we don't see equivalent warnings for those cases, but it
  migth also mean that we miss other cases where we do play these kinds
  of dodgy games, and this kind of explicit conversion might be a good
  idea. ]

I verified that at least for an allmodconfig build on x86-64, this
generates the exact same code, apart from line numbers and assembler
comment changes.

Fixes: 64c8902ed441 ("migrate_pages: split unmap_and_move() to _unmap() and _move()")
Cc: Huang, Ying <ying.huang@intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
18 months agoMerge tag 'mm-hotfixes-stable-2023-03-04-13-12' of git://git.kernel.org/pub/scm/linux...
Linus Torvalds [Sat, 4 Mar 2023 21:32:50 +0000 (13:32 -0800)]
Merge tag 'mm-hotfixes-stable-2023-03-04-13-12' of git://git./linux/kernel/git/akpm/mm

Pull misc fixes from Andrew Morton:
 "17 hotfixes.

  Eight are for MM and seven are for other parts of the kernel. Seven
  are cc:stable and eight address post-6.3 issues or were judged
  unsuitable for -stable backporting"

* tag 'mm-hotfixes-stable-2023-03-04-13-12' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm:
  mailmap: map Dikshita Agarwal's old address to his current one
  mailmap: map Vikash Garodia's old address to his current one
  fs/cramfs/inode.c: initialize file_ra_state
  fs: hfsplus: fix UAF issue in hfsplus_put_super
  panic: fix the panic_print NMI backtrace setting
  lib: parser: update documentation for match_NUMBER functions
  kasan, x86: don't rename memintrinsics in uninstrumented files
  kasan: test: fix test for new meminstrinsic instrumentation
  kasan: treat meminstrinsic as builtins in uninstrumented files
  kasan: emit different calls for instrumentable memintrinsics
  ocfs2: fix non-auto defrag path not working issue
  ocfs2: fix defrag path triggering jbd2 ASSERT
  mailmap: map Georgi Djakov's old Linaro address to his current one
  mm/hwpoison: convert TTU_IGNORE_HWPOISON to TTU_HWPOISON
  lib/zlib: DFLTCC deflate does not write all available bits for Z_NO_FLUSH
  mm/damon/paddr: fix missing folio_put()
  mm/mremap: fix dup_anon_vma() in vma_merge() case 4

18 months agoMerge tag 'powerpc-6.3-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc...
Linus Torvalds [Sat, 4 Mar 2023 19:20:42 +0000 (11:20 -0800)]
Merge tag 'powerpc-6.3-2' of git://git./linux/kernel/git/powerpc/linux

Pull powerpc fixes from Michael Ellerman:

 - Drop orphaned VAS MAINTAINERS entry

 - Fix build errors with clang and KCSAN

 - Avoid build errors seen with LD_DEAD_CODE_DATA_ELIMINATION together
   with recordmcount

Thanks to Nathan Chancellor.

* tag 'powerpc-6.3-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
  powerpc: Avoid dead code/data elimination when using recordmcount
  powerpc/vmlinux.lds: Add .text.asan/tsan sections
  powerpc: Drop orphaned VAS MAINTAINERS entry

18 months agoMerge tag 'sound-fix-6.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai...
Linus Torvalds [Sat, 4 Mar 2023 18:53:59 +0000 (10:53 -0800)]
Merge tag 'sound-fix-6.3-rc1' of git://git./linux/kernel/git/tiwai/sound

Pull sound fixes from Takashi Iwai:
 "A collection of various small fixes that have been gathered since the
  last PR.

  The majority of changes are for ASoC, and there is a small change in
  ASoC PCM core, but the rest are all for driver- specific fixes /
  quirks / updates"

* tag 'sound-fix-6.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (32 commits)
  ALSA: ice1712: Delete unreachable code in aureon_add_controls()
  ALSA: ice1712: Do not left ice->gpio_mutex locked in aureon_add_controls()
  ALSA: hda/realtek: Add quirk for HP EliteDesk 800 G6 Tower PC
  ALSA: hda/realtek: Improve support for Dell Precision 3260
  ASoC: mediatek: mt8195: add missing initialization
  ASoC: mediatek: mt8188: add missing initialization
  ASoC: amd: yc: Add DMI entries to support HP OMEN 16-n0xxx (8A43)
  ASoC: zl38060 add gpiolib dependency
  ASoC: sam9g20ek: Disable capture unless building with microphone input
  ASoC: mt8192: Fix range for sidetone positive gain
  ASoC: mt8192: Report an error if when an invalid sidetone gain is written
  ASoC: mt8192: Fix event generation for controls
  ASoC: mt8192: Remove spammy log messages
  ASoC: mchp-pdmc: fix poc noise at capture startup
  ASoC: dt-bindings: sama7g5-pdmc: add microchip,startup-delay-us binding
  ASoC: soc-pcm: add option to start DMA after DAI
  ASoC: mt8183: Fix event generation for I2S DAI operations
  ASoC: mt8183: Remove spammy logging from I2S DAI driver
  ASoC: mt6358: Remove undefined HPx Mux enumeration values
  ASoC: mt6358: Validate Wake on Voice 2 writes
  ...

18 months agoMerge tag 'for-v6.3-part2' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux...
Linus Torvalds [Sat, 4 Mar 2023 00:33:28 +0000 (16:33 -0800)]
Merge tag 'for-v6.3-part2' of git://git./linux/kernel/git/sre/linux-power-supply

Pull more power supply updates from Sebastian Reichel:

 - Fix DT binding for Richtek RT9467

 - Fix a NULL pointer check in the power-supply core

 - Document meaning of absent "present" property

* tag 'for-v6.3-part2' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply:
  dt-bindings: power: supply: Revise Richtek RT9467 compatible name
  ABI: testing: sysfs-class-power: Document absence of "present" property
  power: supply: fix null pointer check order in __power_supply_register

18 months agoMerge tag '6.3-rc-smb3-client-fixes-part2' of git://git.samba.org/sfrench/cifs-2.6
Linus Torvalds [Sat, 4 Mar 2023 00:26:43 +0000 (16:26 -0800)]
Merge tag '6.3-rc-smb3-client-fixes-part2' of git://git.samba.org/sfrench/cifs-2.6

Pull more cifs updates from Steve French:

 - xfstest generic/208 fix (memory leak)

 - minor netfs fix (to address smatch warning)

 - a DFS fix for stable

 - a reconnect race fix

 - two multichannel fixes

 - RDMA (smbdirect) fix

 - two additional writeback fixes from David

* tag '6.3-rc-smb3-client-fixes-part2' of git://git.samba.org/sfrench/cifs-2.6:
  cifs: Fix memory leak in direct I/O
  cifs: prevent data race in cifs_reconnect_tcon()
  cifs: improve checking of DFS links over STATUS_OBJECT_NAME_INVALID
  iov: Fix netfs_extract_user_to_sg()
  cifs: Fix cifs_write_back_from_locked_folio()
  cifs: reuse cifs_match_ipaddr for comparison of dstaddr too
  cifs: match even the scope id for ipv6 addresses
  cifs: Fix an uninitialised variable
  cifs: Add some missing xas_retry() calls

18 months agoumh: simplify the capability pointer logic
Linus Torvalds [Thu, 2 Mar 2023 23:49:44 +0000 (15:49 -0800)]
umh: simplify the capability pointer logic

The usermodehelper code uses two fake pointers for the two capability
cases: CAP_BSET for reading and writing 'usermodehelper_bset', and
CAP_PI to read and write 'usermodehelper_inheritable'.

This seems to be a completely unnecessary indirection, since we could
instead just use the pointers themselves, and never have to do any "if
this then that" kind of logic.

So just get rid of the fake pointer values, and use the real pointer
values instead.

Reviewed-by: Luis Chamberlain <mcgrof@kernel.org>
Cc: Eric Biederman <ebiederm@xmission.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Kees Cook <keescook@chromium.org>
Cc: Iurii Zaikin <yzaikin@google.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
18 months agoMerge tag 'cocci-for-6.3' of git://git.kernel.org/pub/scm/linux/kernel/git/jlawall...
Linus Torvalds [Fri, 3 Mar 2023 23:00:28 +0000 (15:00 -0800)]
Merge tag 'cocci-for-6.3' of git://git./linux/kernel/git/jlawall/linux

Pull coccinelle updates from Julia Lawall:
 "Changes in make coccicheck and improve a semantic patch

  This makes a couple of changes in make coccicheck related to shell
  commands.

  It also updates the api/atomic_as_refcounter semantic patch to include
  WARNING in the output message, as done in other cases"

* tag 'cocci-for-6.3' of git://git.kernel.org/pub/scm/linux/kernel/git/jlawall/linux:
  scripts: coccicheck: Use /usr/bin/env
  scripts: coccicheck: Avoid warning about spurious escape
  coccinelle: api/atomic_as_refcounter: include message type in output

18 months agoMerge tag 'rust-fixes-6.3-rc1' of https://github.com/Rust-for-Linux/linux
Linus Torvalds [Fri, 3 Mar 2023 22:51:15 +0000 (14:51 -0800)]
Merge tag 'rust-fixes-6.3-rc1' of https://github.com/Rust-for-Linux/linux

Pull Rust fix from Miguel Ojeda:
 "A single build error fix: there was a change during the merge window
  to a C header parsed by the Rust bindings generator, introducing a
  type that it does not handle well.

  The fix tells the generator to treat the type as opaque (for now)"

* tag 'rust-fixes-6.3-rc1' of https://github.com/Rust-for-Linux/linux:
  rust: bindgen: Add `alt_instr` as opaque type

18 months agoMerge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Linus Torvalds [Fri, 3 Mar 2023 22:41:50 +0000 (14:41 -0800)]
Merge tag 'scsi-misc' of git://git./linux/kernel/git/jejb/scsi

Pull more SCSI updates from James Bottomley:
 "Updates that missed the first pull, mostly because of needing more
  soak time.

  Driver updates (zfcp, ufs, mpi3mr, plus two ipr bug fixes), an
  enclosure services (ses) update (mostly bug fixes) and other minor bug
  fixes and changes"

* tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (32 commits)
  scsi: zfcp: Trace when request remove fails after qdio send fails
  scsi: zfcp: Change the type of all fsf request id fields and variables to u64
  scsi: zfcp: Make the type for accessing request hashtable buckets size_t
  scsi: ufs: core: Simplify ufshcd_execute_start_stop()
  scsi: ufs: core: Rely on the block layer for setting RQF_PM
  scsi: core: Extend struct scsi_exec_args
  scsi: lpfc: Fix double word in comments
  scsi: core: Remove the /proc/scsi/${proc_name} directory earlier
  scsi: core: Fix a source code comment
  scsi: cxgbi: Remove unneeded version.h include
  scsi: qedi: Remove unneeded version.h include
  scsi: mpi3mr: Remove unneeded version.h include
  scsi: mpi3mr: Fix missing mrioc->evtack_cmds initialization
  scsi: mpi3mr: Use number of bits to manage bitmap sizes
  scsi: mpi3mr: Remove unnecessary memcpy() to alltgt_info->dmi
  scsi: mpi3mr: Fix issues in mpi3mr_get_all_tgt_info()
  scsi: mpi3mr: Fix an issue found by KASAN
  scsi: mpi3mr: Replace 1-element array with flex-array
  scsi: ipr: Work around fortify-string warning
  scsi: ipr: Make ipr_probe_ioa_part2() return void
  ...

18 months agoi2c: gxp: fix an error code in probe
Dan Carpenter [Mon, 27 Feb 2023 10:06:33 +0000 (13:06 +0300)]
i2c: gxp: fix an error code in probe

This is passing IS_ERR() instead of PTR_ERR() so instead of an error
code it prints and returns the number 1.

Fixes: 4a55ed6f89f5 ("i2c: Add GXP SoC I2C Controller")
Signed-off-by: Dan Carpenter <error27@gmail.com>
Reviewed-by: Nick Hawkins <nick.hawkins@hpe.com>
Signed-off-by: Wolfram Sang <wsa@kernel.org>