From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5D42431F996 for ; Tue, 28 Jul 2026 05:35:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785216903; cv=none; b=Cgo08XJtDC128vZPgh/yNPoYaaRIsGOkNX8HuxHBZlV4pAc8LVm6DRHZR50vkla626pdqCDDz6CsyShNi46gkRI/+b7CZSJo4Uxa89ni6vXiEOWapmWHhSRDG/2DL7b1m9r7CKtudeiebcrc8Nz/SnItIKThmyAczDCcNMtAGjM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785216903; c=relaxed/simple; bh=cKul/h3IPZbb9VFh4rdMOhK1Ffwwx65anMjRAzvkQPg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=S2QE+SzRaf0DNPtpp+UQdj/qDfNfC15hOt8FgEKoHCd2FyB4Pyf0S2lp0l6ArwSMMYug4823nqRDvR95zX7eSVro/96sNV5h5ZtB8oqhiNLsJ1Qi10z3+5EM2VuaBnO5IX9uAJFoYGlrg9v1guUokNwjcIddgeKGkHzlMrAJKnQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=hUsSB54v; arc=none smtp.client-ip=209.85.214.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="hUsSB54v" Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-2cacef7d299so49565ad.1 for ; Mon, 27 Jul 2026 22:35:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1785216902; x=1785821702; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :content-type:mime-version:references:message-id:subject:cc:to:from :date:from:to:cc:subject:date:message-id:reply-to:content-type; bh=NSd0Snni0h0/tE0vaFb4D1at9rHpTmqJbpcAV8DTvqQ=; b=hUsSB54vDmVzqOA0mnOa/npPR5ww6YDRYBtrOXFO0TPvHnrcTW8h0/JKanQujsNwGZ h5tyqxaMawyQLgUiGBtv7Rs7yGU+jG3hZFPVu8TBxkuwaHRnwupVKn3y42eQFSuE9jP0 9cEbSMWUj0WqmEgNZv+qzsIeshz8R1X1vVGBQUIBxqBCVn8zKt9nu/vHFq8snnbg/IKK OGlAkekcm3B9d2ogyyG2bGXU1MbDjqX56h4K33zB0MO7GtlApL3VghgUXO7PMjw1Jmkf TAMq+ssNbo1Wx0ScMrEGH2xpIEfSbDQChkpjHMlVyj1GK/cgulVCIqmZVHf3gtggCrHa 5aCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785216902; x=1785821702; h=in-reply-to:content-transfer-encoding:content-disposition :content-type:mime-version:references:message-id:subject:cc:to:from :date:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to:content-type; bh=NSd0Snni0h0/tE0vaFb4D1at9rHpTmqJbpcAV8DTvqQ=; b=I7l5k9aU7cnjZ0Errq/LB4KcrQurmPWxf64tIpbavtlHqVEgrnNs9tZBR84C0P8+VO s56Kta3a8oW23sGYN/vIbeBqrtObplbpbNDHmcpacVdPl8MKQVmS+conAye1T1I2Kp3C k4AhQbLLUKBEaFi7ZPD0KL1HmBuYFn8Ug2/1L+zqZgd+9Q9vnZFwW91bNrrG8pY51H7h gJDNN7dmc1bgoXeG8L5Gy7dS1vPYUDOrYnJtySWd/6+z7QycCNuqchbHtPgSddt+K7OM q1wmtdaqB0WryUN2GVfv0QFT10Y5yjtD/PBh4bwFRg8GqNSxGEPONvmzlKUXwj1ZO8Jq lbsg== X-Forwarded-Encrypted: i=1; AHgh+RowlfkZ9iDwlrZ5UmfIb3p1VBXSUWZdiJ3jfUWGcAnUuMFNvBR8Uv/NzEO8cgyjSLl6LS9vTqxKxsY=@vger.kernel.org X-Gm-Message-State: AOJu0YwhpH6ifHEVdujajBCFU4fppPLx53zMEwWDr1dS9+lIe/iqEaDG tCnZFuaSXCYgL+Ipq+g9b2Nuh8TPLsx4EWlIam/T6i6IeP/PpuVOHYfd6v2weiKLEA== X-Gm-Gg: AR+sD125TJwXRHEeo4HlpBJU1HfO7SuVb7vnqXjKLxAlLcC/cjmIOz+WZv8BZt5s7QE Kw/pTVXkPmwyfBdLQfntVEynfT93CEy+2g1sqYH2tZV4mcoU9uPbzxQe3tfYWKAq5FDp3ihCq4Y ANKtrFEZXrTw4omXYT1KLf8ACsVXpkSQhaYNDtFPS/a9f8xRNo+DkbCgSrzpUiMQ14eiIR7XqtK js2SBgNV2Xl9d1+4PnhZ6Mm9XNvLYgl5f5yIu/gnYtPERf0TbpdB796IZ8GzilgX8fNqMbF9KWe rUSqNVSed0QlzTC8hjayW9UmLDu9SBALJ/ajgKBXtpyXy+WWundZdTcRbGijmmtw6qNBbYoIIde TfShRVGGHa0mrg4KunSe2WuYJzR1ku22vkS3tFMZZSgA5YUi3y/1WcKOR0Tq9cL3eYk+ZTZnjX9 5sNguC8zUzK6AwiUW85kRH0EodyhkPZ16uKZpleBda+FycWVjaaw== X-Received: by 2002:a17:902:f1d3:b0:2c7:9e6a:1a8d with SMTP id d9443c01a7336-2cfdb75acb4mr15516765ad.12.1785216900834; Mon, 27 Jul 2026 22:35:00 -0700 (PDT) Received: from google.com (176.13.105.34.bc.googleusercontent.com. [34.105.13.176]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-38f08ae3079sm3822540a91.3.2026.07.27.22.34.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jul 2026 22:34:59 -0700 (PDT) Date: Mon, 27 Jul 2026 22:34:54 -0700 From: Vipin Sharma To: Zhu Yanjun Cc: kexec@lists.infradead.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, kvm@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, ajayachandra@nvidia.com, alex@shazbot.org, amastro@fb.com, ankita@nvidia.com, apopple@nvidia.com, bhelgaas@google.com, chrisl@kernel.org, christian.koenig@amd.com, corbet@lwn.net, dmatlack@google.com, graf@amazon.com, jacob.pan@linux.microsoft.com, jgg@nvidia.com, jgg@ziepe.ca, jrhilke@google.com, julianr@linux.ibm.com, kees@kernel.org, kevin.tian@intel.com, leon@kernel.org, leonro@nvidia.com, lukas@wunner.de, mattev@meta.com, michal.winiarski@intel.com, parav@nvidia.com, pasha.tatashin@soleen.com, praan@google.com, pratyush@kernel.org, rananta@google.com, rientjes@google.com, rodrigo.vivi@intel.com, rppt@kernel.org, saeedm@nvidia.com, schnelle@linux.ibm.com, skhan@linuxfoundation.org, skhawaja@google.com, vivek.kasireddy@intel.com, witu@nvidia.com, yi.l.liu@intel.com Subject: Re: [PATCH v5 17/20] vfio: selftests: Add vfio_pci_liveupdate_kexec_test Message-ID: <20260728052011.GA736369.vipinsh@google.com> References: <20260714151505.3466855-1-vipinsh@google.com> <20260714151505.3466855-18-vipinsh@google.com> Precedence: bulk X-Mailing-List: linux-doc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Sun, Jul 26, 2026 at 05:40:54PM -0700, Zhu Yanjun wrote: > > 在 2026/7/14 8:15, Vipin Sharma 写道: > > Add a selftest to exercise preserving a vfio-pci device across a Live > > Update. For now the test is extremely simple and just verifies that the > > device file can be preserved and retrieved. In the future this test will > > be extended to verify more parts about device preservation as they are > > implemented. > > > > This test is added to TEST_GEN_PROGS_EXTENDED since it must be run > > manually along with a kexec. > > > > To run this test manually: > > > > $ tools/testing/selftests/vfio/scripts/setup.sh 0000:00:04.0 > > $ tools/testing/selftests/vfio/vfio_pci_liveupdate_kexec_test --stage 1 0000:00:04.0 > # ls /dev > autofs           disk       iommu         mem     rtc0      tty10 tty21  > tty32  tty43  tty54  tty8    ttyS18  ttyS29   uinput  vcs6   vcsu4        > virtio-ports > block            dma_heap   kmsg          mqueue  sg0       tty11 tty22  > tty33  tty44  tty55  tty9    ttyS19  ttyS3    urandom vcsa   vcsu5        > vport2p1 > bsg              dri        kvm           net     shm       tty12 tty23  > tty34  tty45  tty56  ttyS0   ttyS2   ttyS30   usbmon0 vcsa1  vcsu6        > vsock > btrfs-control    fd         liveupdate    null    snapshot  tty13 tty24  > tty35  tty46  tty57  ttyS1   ttyS20  ttyS31   usbmon1 vcsa2  vda          > watchdog > bus              full       log           nvram   snd       tty14 tty25  > tty36  tty47  tty58  ttyS10  ttyS21  ttyS4    usbmon2 vcsa3  vda1        >  watchdog0 > cdrom            fuse       loop-control  port    sr0       tty15 tty26  > tty37  tty48  tty59  ttyS11  ttyS22  ttyS5    userfaultfd vcsa4  vda2        >  zero > char             hidraw0    lp0           ppp     stderr    tty16 tty27  > tty38  tty49  tty6   ttyS12  ttyS23  ttyS6    vcs vcsa5  vda3         zram0 > console          hpet       lp1           ptmx    stdin     tty17 tty28  > tty39  tty5   tty60  ttyS13  ttyS24  ttyS7    vcs1  vcsa6  vfio > core             hugepages  lp2           pts     stdout    tty18 tty29  > tty4   tty50  tty61  ttyS14  ttyS25  ttyS8    vcs2  vcsu   vga_arbiter > cpu              hwrng      lp3           random  tty       tty19 tty3  >  tty40  tty51  tty62  ttyS15  ttyS26  ttyS9    vcs3  vcsu1  vhci > cpu_dma_latency  i2c-0      mapper        rfkill  tty0      tty2  tty30  > tty41  tty52  tty63  ttyS16  ttyS27  udmabuf  vcs4  vcsu2  vhost-net > cuse             input      mcelog        rtc     tty1      tty20 tty31  > tty42  tty53  tty7   ttyS17  ttyS28  uhid     vcs5  vcsu3  vhost-vsock > > > # tools/testing/selftests/vfio/scripts/setup.sh 0000:00:08.0 > > + echo "vfio-pci" > /sys/bus/pci/devices/0000:00:08.0/driver_override > + echo "0000:00:08.0" > /sys/bus/pci/drivers/vfio-pci/bind > tools/testing/selftests/vfio/scripts/lib.sh: line 9: echo: write error: > Invalid argument    <--- the error is here. > > > # lspci -vvv -s 0000:00:08.0 > > 00:08.0 Unclassified device [00ff]: Red Hat, Inc. QEMU PCI Test Device >         Subsystem: Red Hat, Inc. QEMU Virtual Machine >         Control: I/O+ Mem+ BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- > Stepping- SERR+ FastB2B- DisINTx- >         Status: Cap- 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- > SERR-         Region 0: Memory at fea1f000 (32-bit, non-prefetchable) [size=4K] >         Region 1: I/O ports at c000 [size=256] > > Hi, Vipin > > I worked with QEMU PCI Test Device. But the following error occur. > > "tools/testing/selftests/vfio/scripts/lib.sh: line 9: echo: write error: > Invalid argument" > > Is this a known problem? > Can you please check if you have passed iommu device in your QEMU command? This is what I pass to my QEMU command -device intel-iommu,intremap=on,caching-mode=on,device-iotlb=on Also, add the following to your guest kernel commandline intel_iommu=on This should fix the issue you are seeing. Alternatively, you can also enable noiommu mode in VFIO by executing: echo Y > /sys/module/vfio/parameters/enable_unsafe_noiommu_mode This should allow device to be bound to VFIO. If none of the above approach works can you please share your QEMU command and your guest VM /proc/cmdline. Thanks Vipin