tree:
https://git.kernel.org/pub/scm/linux/kernel/git/hare/scsi-devel.git virtio-vfc.v6
head: 7e3ab9aac391a4fb2aef468332128900bdef8df6
commit: d5a2b439cfd4818e84e84c43c7e499d258af4500 [2/5] virtio-scsi: implement target
rescan
config: h8300-randconfig-r031-20210314 (attached as .config)
compiler: h8300-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O
~/bin/make.cross
chmod +x ~/bin/make.cross
#
https://git.kernel.org/pub/scm/linux/kernel/git/hare/scsi-devel.git/commi...
git remote add hare-scsi-devel
https://git.kernel.org/pub/scm/linux/kernel/git/hare/scsi-devel.git
git fetch --no-tags hare-scsi-devel virtio-vfc.v6
git checkout d5a2b439cfd4818e84e84c43c7e499d258af4500
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=h8300
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All error/warnings (new ones prefixed by >>):
In file included from include/linux/kernel.h:10,
from include/linux/list.h:9,
from include/linux/module.h:12,
from drivers/scsi/virtio_scsi.c:15:
include/linux/scatterlist.h: In function 'sg_set_buf':
include/asm-generic/page.h:93:50: warning: ordered comparison of pointer with null
pointer [-Wextra]
93 | #define virt_addr_valid(kaddr) (((void *)(kaddr) >= (void *)PAGE_OFFSET)
&& \
| ^~
include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
78 | # define unlikely(x) __builtin_expect(!!(x), 0)
| ^
include/linux/scatterlist.h:137:2: note: in expansion of macro 'BUG_ON'
137 | BUG_ON(!virt_addr_valid(buf));
| ^~~~~~
include/linux/scatterlist.h:137:10: note: in expansion of macro
'virt_addr_valid'
137 | BUG_ON(!virt_addr_valid(buf));
| ^~~~~~~~~~~~~~~
drivers/scsi/virtio_scsi.c: In function 'virtscsi_rescan_work':
> drivers/scsi/virtio_scsi.c:780:8: error: implicit declaration of
function 'virtscsi_kick_cmd'; did you mean 'virtscsi_kick_vq'?
[-Werror=implicit-function-declaration]
780 | ret =
virtscsi_kick_cmd(&vscsi->ctrl_vq, cmd, sizeof(cmd->req.rescan),
| ^~~~~~~~~~~~~~~~~
| virtscsi_kick_vq
drivers/scsi/virtio_scsi.c: At top level:
> drivers/scsi/virtio_scsi.c:874:5: warning: no previous prototype
for 'virtscsi_scan_finished' [-Wmissing-prototypes]
874 | int
virtscsi_scan_finished(struct Scsi_Host *sh, unsigned long time)
| ^~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
vim +780 drivers/scsi/virtio_scsi.c
752
753 static void virtscsi_rescan_work(struct work_struct *work)
754 {
755 struct virtio_scsi *vscsi =
756 container_of(work, struct virtio_scsi, rescan_work);
757 struct Scsi_Host *sh = virtio_scsi_host(vscsi->vdev);
758 int target_id, ret, transport;
759 struct virtio_scsi_cmd *cmd = &vscsi->rescan_cmd;
760 DECLARE_COMPLETION_ONSTACK(comp);
761
762 spin_lock_irq(&vscsi->rescan_lock);
763 target_id = vscsi->next_target_id;
764 if (target_id == -1) {
765 dev_dbg(&sh->shost_gendev, "rescan: terminated\n");
766 spin_unlock_irq(&vscsi->rescan_lock);
767 return;
768 }
769 spin_unlock_irq(&vscsi->rescan_lock);
770
771 dev_dbg(&sh->shost_gendev, "rescan: next target %d\n",
target_id);
772 memset(cmd, 0, sizeof(*cmd));
773 cmd->comp = ∁
774 cmd->sc = NULL;
775 cmd->req.rescan = (struct virtio_scsi_rescan_req){
776 .type = VIRTIO_SCSI_T_RESCAN,
777 .next_id = cpu_to_virtio32(vscsi->vdev, target_id),
778 };
779
780 ret = virtscsi_kick_cmd(&vscsi->ctrl_vq, cmd,
sizeof(cmd->req.rescan),
781 sizeof(cmd->resp.rescan));
782 if (ret < 0) {
783 spin_lock_irq(&vscsi->rescan_lock);
784 vscsi->next_target_id = -1;
785 spin_unlock_irq(&vscsi->rescan_lock);
786 dev_dbg(&sh->shost_gendev, "rescan: failed to sent command\n");
787 sh->sequential_scan = true;
788 scsi_scan_host(sh);
789 return;
790 }
791
792 wait_for_completion(&comp);
793 target_id = virtio32_to_cpu(vscsi->vdev, cmd->resp.rescan.id);
794 if (target_id == -1) {
795 dev_dbg(&sh->shost_gendev, "rescan: no more targets\n");
796 spin_lock_irq(&vscsi->rescan_lock);
797 vscsi->next_target_id = -1;
798 spin_unlock_irq(&vscsi->rescan_lock);
799 return;
800 }
801 transport = virtio32_to_cpu(vscsi->vdev, cmd->resp.rescan.transport);
802 spin_lock_irq(&vscsi->rescan_lock);
803 vscsi->next_target_id = target_id + 1;
804 spin_unlock_irq(&vscsi->rescan_lock);
805 shost_printk(KERN_INFO, sh,
806 "found %s target %d (WWN %*phN)\n",
807 transport == SCSI_PROTOCOL_FCP ? "FC" : "SAS",
808 target_id, 8, cmd->resp.rescan.port_wwn);
809 scsi_scan_target(&sh->shost_gendev, 0, target_id,
810 SCAN_WILD_CARD, SCSI_SCAN_INITIAL);
811 queue_work(system_freezable_wq, &vscsi->rescan_work);
812 return;
813 }
814
815 static int virtscsi_scan_host(struct virtio_scsi *vscsi)
816 {
817 struct Scsi_Host *sh = virtio_scsi_host(vscsi->vdev);
818 int ret, transport;
819 struct virtio_scsi_cmd *cmd = &vscsi->rescan_cmd;
820 DECLARE_COMPLETION_ONSTACK(comp);
821
822 dev_dbg(&sh->shost_gendev, "rescan: scan host\n");
823 memset(cmd, 0, sizeof(*cmd));
824 cmd->comp = ∁
825 cmd->sc = NULL;
826 cmd->req.rescan = (struct virtio_scsi_rescan_req){
827 .type = VIRTIO_SCSI_T_RESCAN,
828 .next_id = cpu_to_virtio32(vscsi->vdev, -1),
829 };
830
831 ret = virtscsi_kick_cmd(&vscsi->ctrl_vq, cmd, sizeof(cmd->req.rescan),
832 sizeof(cmd->resp.rescan));
833 if (ret < 0)
834 return ret;
835
836 wait_for_completion(&comp);
837 if (cmd->resp.rescan.id != -1) {
838 dev_dbg(&sh->shost_gendev, "rescan: invalid target id\n");
839 return -ENOSYS;
840 }
841 transport = virtio32_to_cpu(vscsi->vdev, cmd->resp.rescan.transport);
842 shost_printk(KERN_INFO, sh, "%s host wwnn %*phN wwpn %*phN\n",
843 transport == SCSI_PROTOCOL_FCP ? "FC" : "SAS",
844 8, cmd->resp.rescan.node_wwn,
845 8, cmd->resp.rescan.port_wwn);
846 return 0;
847 }
848
849 static void virtscsi_scan_start(struct Scsi_Host *sh)
850 {
851 struct virtio_scsi *vscsi = shost_priv(sh);
852
853 if (!sh->sequential_scan && virtscsi_scan_host(vscsi) < 0) {
854 shost_printk(KERN_INFO, sh,
855 "rescan: use sequential scan\n");
856 sh->sequential_scan = true;
857 }
858 if (sh->sequential_scan) {
859 scsi_scan_host(sh);
860 return;
861 }
862 spin_lock_irq(&vscsi->rescan_lock);
863 if (vscsi->next_target_id != -1) {
864 dev_dbg(&sh->shost_gendev, "rescan: already running\n");
865 spin_unlock_irq(&vscsi->rescan_lock);
866 return;
867 }
868 vscsi->next_target_id = 0;
869 dev_dbg(&sh->shost_gendev, "rescan: start\n");
870 spin_unlock_irq(&vscsi->rescan_lock);
871 queue_work(system_freezable_wq, &vscsi->rescan_work);
872 }
873
874 int virtscsi_scan_finished(struct Scsi_Host *sh, unsigned long
time)
875 {
876 struct virtio_scsi *vscsi = shost_priv(sh);
877 int ret = 1;
878
879 spin_lock_irq(&vscsi->rescan_lock);
880 if (vscsi->next_target_id != -1)
881 ret = 0;
882 spin_unlock_irq(&vscsi->rescan_lock);
883 if (!ret)
884 flush_work(&vscsi->rescan_work);
885
886 dev_dbg(&sh->shost_gendev, "rescan: %sfinished\n",
887 ret ? "" : "not ");
888 return ret;
889 }
890
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org