From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CFA1C244195 for ; Thu, 3 Apr 2025 09:44:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743673474; cv=none; b=PG6CRY4ASVb3q5DIQ5zSyoICFOFovt7BP+AFY83qZDg/ogWtUHbhg2jbkXGcYDBsj5ABMU3OC2unY3GwiD8Qcqtn33GoKjsRGDhWvhxfyxqsiKBRXnK4cEVov1bPq0bnpZxXYuHsQiTMSdDBGvlIqjsqaINpsjACyhfuaOkpiHM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743673474; c=relaxed/simple; bh=3RucRNF7f/0e4O35Hd5elBCl4Zt1WkVLOuvSALfHk/0=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=YSRK6H5m6WZCbFp7zVXHgVLJz6b9kbhLcPyGuGh7Sna653qkYwVlJiw/P0nJUk6RhFd6r7IypuVNGJq69LGsCwrkPiOoZZEx3KVy/4fN4+rQVwHoHdv8q+/z02twpoGnkM+JTAgXlik+sN84rtmmjLyZxX23iZOg3iZwlKYuNSQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=LpnyCEOC; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="LpnyCEOC" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1743673471; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=gSdqZyMN/qA57u0AZakL5zHE5rHAQPvR1lJKkRz1QYQ=; b=LpnyCEOCNh5AU+4CEQnDT5rxB+ELD30GViTTolzd1ROE/20ndaT9QFYafOqrMJetkVwKGV Y/1PrZGkNup5ocbtovf/THHfjo62zd8NzJ1CjWgnDAGxEyIhs7vP2c8GSX/MjOJVDGQnVe ur9hbrUSwMMBdonolkD4Kv04+deSUM4= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-638-92ykImUhMeKfgNOV8hGfxw-1; Thu, 03 Apr 2025 05:44:30 -0400 X-MC-Unique: 92ykImUhMeKfgNOV8hGfxw-1 X-Mimecast-MFC-AGG-ID: 92ykImUhMeKfgNOV8hGfxw_1743673469 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-43d51bd9b41so5493955e9.3 for ; Thu, 03 Apr 2025 02:44:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743673469; x=1744278269; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :from:references:cc:to:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=gSdqZyMN/qA57u0AZakL5zHE5rHAQPvR1lJKkRz1QYQ=; b=mu9Lb3iC1KvzxjUJVyWNGaWjJjC8YdruQz7rda9F5+sOPV83ZomAiJO1M89mIL3HOp aMs+RelezRg09fBHi8EaKhHIaV4pzyJ4+OUytw6GV8jozknjr5AGP8HF+oy4xVj6Q3/l c1vbhnFuG5eWwOWMzaKLpOlDPRUuQJDBKI/S/Z8aw7TLI7ZrdfH3iUT0rTAi1rXq1Ym7 gLcavxWEmqTzYNANtkwOwJCu5+li2oPL38flINL9hbPF/bxD9YhnN0z0YFT6nW1mjGtG s5SIUyWP6HRQ3uAAULaJodar7Wo2UqXWQTjQxP0ypNfmSAgDxtlF0pSn6rhr9Wx3+CJd Aafg== X-Forwarded-Encrypted: i=1; AJvYcCXSJkaJYgdVJ30jZWWSZpO+YLtvEJRC8wEVrkMyqDBn9ZPax3c0HUHU7ECaAmebfh08njg=@vger.kernel.org X-Gm-Message-State: AOJu0Yx83qB71RBFD7ZToLxaGZTMb6YwboIBhp2ngCFLYvZ71EEYy1yD MEgutdwRsh8Cm5w5LF3mJMJ1iHbbGNrAyh7TkBFTT3I2i2jpgMO4b6jYRPUmwgvPpGyswW/+HP3 9D2az7rmM/MsKvgPlMdAebGA7NDuRi8a+JEJAKYCDEhkM8eIDhw== X-Gm-Gg: ASbGnctw+EjhSLwEzAAITgvzmlUBPSwiUQ8cpc/UDfeOSSu/gXhakkWq9kk5j4lhe6T HfWF3J/7U4TY/SYzWQFT5ps4FOBKNPEf4xxYeBT81a2jcWq1Evt09etbARUNUQqcCNoRLE5EtnC mF1ySjqDBv9+7CP3YS5aUPf4FdvKjz9CuaQF6SgYJ2yAbG9llEgu6kziWrwIg3g+pwvAkTgfROX WJqbEMz+wHf+6nt474/VtFDABrHiwIhmA3ubByZx4nauxFbR+ZZjafY7GwIhnsctKy5vCVGkUui QZzXhs56NNGSXRYk9KtfKwFPNq4sQk7MH2WPUs9CiEsz X-Received: by 2002:a5d:6dab:0:b0:391:4889:5045 with SMTP id ffacd0b85a97d-39c12114fccmr17337052f8f.36.1743673468939; Thu, 03 Apr 2025 02:44:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG/7cEdSHfURTDRVGlG5T0lSpAh1Bd8WT5kQ0J3SBrbGbJ5bEbAFPspWelmdDFLWhEf9/DFjg== X-Received: by 2002:a5d:6dab:0:b0:391:4889:5045 with SMTP id ffacd0b85a97d-39c12114fccmr17337011f8f.36.1743673468511; Thu, 03 Apr 2025 02:44:28 -0700 (PDT) Received: from [192.168.0.7] (ip-109-42-51-76.web.vodafone.de. [109.42.51.76]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-39c30226e9asm1320216f8f.94.2025.04.03.02.44.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 03 Apr 2025 02:44:28 -0700 (PDT) Message-ID: <9daf03e4-4526-428c-b584-ede6cb77cada@redhat.com> Date: Thu, 3 Apr 2025 11:44:15 +0200 Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1] s390/virtio_ccw: don't allocate/assign airqs for non-existing queues To: David Hildenbrand , linux-kernel@vger.kernel.org Cc: linux-s390@vger.kernel.org, virtualization@lists.linux.dev, kvm@vger.kernel.org, Chandra Merla , Stable@vger.kernel.org, Cornelia Huck , Halil Pasic , Eric Farman , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , "Michael S. Tsirkin" , Wei Wang References: <20250402203621.940090-1-david@redhat.com> From: Thomas Huth Content-Language: en-US Autocrypt: addr=thuth@redhat.com; keydata= xsFNBFH7eUwBEACzyOXKU+5Pcs6wNpKzrlJwzRl3VGZt95VCdb+FgoU9g11m7FWcOafrVRwU yYkTm9+7zBUc0sW5AuPGR/dp3pSLX/yFWsA/UB4nJsHqgDvDU7BImSeiTrnpMOTXb7Arw2a2 4CflIyFqjCpfDM4MuTmzTjXq4Uov1giGE9X6viNo1pxyEpd7PanlKNnf4PqEQp06X4IgUacW tSGj6Gcns1bCuHV8OPWLkf4hkRnu8hdL6i60Yxz4E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k2Oylyexw3aOBsXg6ukN44vIFqPoc+YSU0+0QIdYJp/XFsgWxnFIMYwDpxSHS 5fdDxUjsk3UBHZx+IhFjs2siVZi5wnHIqM7eK9abr2cK2weInTBwXwqVWjsXZ4tq5+jQrwDK cvxIcwXdUTLGxc4/Z/VRH1PZSvfQxdxMGmNTGaXVNfdFZjm4fz0mz+OUi6AHC4CZpwnsliGV ODqwX8Y1zic9viSTbKS01ZNp175POyWViUk9qisPZB7ypfSIVSEULrL347qY/hm9ahhqmn17 Ng255syASv3ehvX7iwWDfzXbA0/TVaqwa1YIkec+/8miicV0zMP9siRcYQkyTqSzaTFBBmqD oiT+z+/E59qj/EKfyce3sbC9XLjXv3mHMrq1tKX4G7IJGnS989E/fg6crv6NHae9Ckm7+lSs IQu4bBP2GxiRQ+NV3iV/KU3ebMRzqIC//DCOxzQNFNJAKldPe/bKZMCxEqtVoRkuJtNdp/5a yXFZ6TfE1hGKrDBYAm4vrnZ4CXFSBDllL59cFFOJCkn4Xboj/aVxxJxF30bn In-Reply-To: <20250402203621.940090-1-david@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 02/04/2025 22.36, David Hildenbrand wrote: > If we finds a vq without a name in our input array in > virtio_ccw_find_vqs(), we treat it as "non-existing" and set the vq pointer > to NULL; we will not call virtio_ccw_setup_vq() to allocate/setup a vq. > > Consequently, we create only a queue if it actually exists (name != NULL) > and assign an incremental queue index to each such existing queue. > > However, in virtio_ccw_register_adapter_ind()->get_airq_indicator() we > will not ignore these "non-existing queues", but instead assign an airq > indicator to them. > > Besides never releasing them in virtio_ccw_drop_indicators() (because > there is no virtqueue), the bigger issue seems to be that there will be a > disagreement between the device and the Linux guest about the airq > indicator to be used for notifying a queue, because the indicator bit > for adapter I/O interrupt is derived from the queue index. > > The virtio spec states under "Setting Up Two-Stage Queue Indicators": > > ... indicator contains the guest address of an area wherein the > indicators for the devices are contained, starting at bit_nr, one > bit per virtqueue of the device. > > And further in "Notification via Adapter I/O Interrupts": > > For notifying the driver of virtqueue buffers, the device sets the > bit in the guest-provided indicator area at the corresponding > offset. > > For example, QEMU uses in virtio_ccw_notify() the queue index (passed as > "vector") to select the relevant indicator bit. If a queue does not exist, > it does not have a corresponding indicator bit assigned, because it > effectively doesn't have a queue index. > > Using a virtio-balloon-ccw device under QEMU with free-page-hinting > disabled ("free-page-hint=off") but free-page-reporting enabled > ("free-page-reporting=on") will result in free page reporting > not working as expected: in the virtio_balloon driver, we'll be stuck > forever in virtballoon_free_page_report()->wait_event(), because the > waitqueue will not be woken up as the notification from the device is > lost: it would use the wrong indicator bit. > > Free page reporting stops working and we get splats (when configured to > detect hung wqs) like: > > INFO: task kworker/1:3:463 blocked for more than 61 seconds. > Not tainted 6.14.0 #4 > "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. > task:kworker/1:3 [...] > Workqueue: events page_reporting_process > Call Trace: > [<000002f404e6dfb2>] __schedule+0x402/0x1640 > [<000002f404e6f22e>] schedule+0x3e/0xe0 > [<000002f3846a88fa>] virtballoon_free_page_report+0xaa/0x110 [virtio_balloon] > [<000002f40435c8a4>] page_reporting_process+0x2e4/0x740 > [<000002f403fd3ee2>] process_one_work+0x1c2/0x400 > [<000002f403fd4b96>] worker_thread+0x296/0x420 > [<000002f403fe10b4>] kthread+0x124/0x290 > [<000002f403f4e0dc>] __ret_from_fork+0x3c/0x60 > [<000002f404e77272>] ret_from_fork+0xa/0x38 > > There was recently a discussion [1] whether the "holes" should be > treated differently again, effectively assigning also non-existing > queues a queue index: that should also fix the issue, but requires other > workarounds to not break existing setups. > > Let's fix it without affecting existing setups for now by properly ignoring > the non-existing queues, so the indicator bits will match the queue > indexes. > > [1] https://lore.kernel.org/all/cover.1720611677.git.mst@redhat.com/ > > Fixes: a229989d975e ("virtio: don't allocate vqs when names[i] = NULL") > Reported-by: Chandra Merla > Cc: > Cc: Cornelia Huck > Cc: Thomas Huth > Cc: Halil Pasic > Cc: Eric Farman > Cc: Heiko Carstens > Cc: Vasily Gorbik > Cc: Alexander Gordeev > Cc: Christian Borntraeger > Cc: Sven Schnelle > Cc: "Michael S. Tsirkin" > Cc: Wei Wang > Signed-off-by: David Hildenbrand > --- > drivers/s390/virtio/virtio_ccw.c | 16 ++++++++++++---- > 1 file changed, 12 insertions(+), 4 deletions(-) Thanks for tackling this, David! I tested the patch and the problems are gone now, indeed! Tested-by: Thomas Huth Reviewed-by: Thomas Huth