From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0BCF5C54E58 for ; Wed, 20 Mar 2024 17:15:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=jfH33yGLk6FfsDMtlX6IxvNLVSV1bzPNY9HTYhl0RNM=; b=bUB/Xf34PRUhS/ ZxGsCWdZzcc1MmXwnTeeervz8CRhxsaD7CuVRB92DbfaB3eCLhUFcQX8+PFzZLoGGxB07IIuGB1A2 1CjpHQCuEwxAu5ykPp4A34RW2FUJorlaz6Md44NqkyMwZQasGoDuUW6mbJQY/4PacPsKTodHC0CCl qyOWNska12mehT86gXcjfZbhzswdet76ATxGxOTnwRqTXnHyssfY0SPvfgQLAfuzVdWCOK9wydWhq EzgYNmE6/k75S/S91r7876fF0WTrDTEbwq+KTiB7bqveZgJgfJMWrT0kpl1/RWrSzPTFwVKV3iLXL TdzluqFCT+efPhh9YFnQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rmzX5-00000000Rxu-0mPS; Wed, 20 Mar 2024 17:15:19 +0000 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rmzWz-00000000RwW-3lzO for linux-arm-kernel@lists.infradead.org; Wed, 20 Mar 2024 17:15:17 +0000 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-4146f72e2dfso4125e9.1 for ; Wed, 20 Mar 2024 10:15:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1710954909; x=1711559709; darn=lists.infradead.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=NAfBGS9lgN4PadnDyLpBcUPMVu2nmn91giWvF5pQde0=; b=1EhueLI68z1vVRWmc/nhgoZOolKh6SwiPXzge1DgwNjSpTsO1/wQSezcfR8PLPNUTH AmuUW9LMHpqaKP9p+wSuPWYeYh5ojYslQfXfLhW9dWhmVpP3pFRhSJlHOE/vyTivZ9oa sa2JKc3sY0IhBxD7dOlwFGXwBNYN/PgZ4KmJts+M/22OB9EAqcX9Z15hsdyzLYa2wfeW URf8wcQc6hlPWlVinZqNzwh77aQx8/hSDmzwU9u1RAu3esrGV1jd9EaA6aaWtkmhZwxl soBtbIW2M7Zw7XZZm2tma/1T1VlFOlO4SwPAyP7/HAUDgiSXJMg5TXBvkHh26EGBb6wb o6hQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710954909; x=1711559709; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=NAfBGS9lgN4PadnDyLpBcUPMVu2nmn91giWvF5pQde0=; b=hD1el+fr6nw8GGQlM8bMeyLLj/O3z0Zcntm4E9fSPRLy+iqh5pO+4dkkrD0L4MsjyZ Bw4lCpVF7+jUbr5tmDIpt+MP8iY0RX1PcrC1l3m0Xs/HNzVbUmrR9pXx4flA0rMM+xCg r92o9jJAm7E7znpF1qWZaY1s80ErNGdXj+Kth+h2oS08uW9R0FOCsEDj0OIO3/YsHoOK Fbp+bt7X7IO4VkOGkIhiWUGZ80pJ6p4ak1W4Q7Vx7hK8mVVm88FPSpP6igg4CYIcBHSH OCEcTwFKSgL19CvuJLHavBLMj3rT97D2PVmzIDFAaSQUyf6WuBP8DbwVzhpK5X5bATgX JBng== X-Forwarded-Encrypted: i=1; AJvYcCXOEwTQ9TxHxs9LEwZcm7LqVTS70PrHlSzHugpxnDzgOfLOaMZZb8AkscqLmUiQPfU1S2PpLPDpuuxlnLcpDkNodJoywqPhYQCZ4UuEJJQWfhsZ+ww= X-Gm-Message-State: AOJu0YxnlajVFubTxYtzsHhYUK0ThaKd2r8oSxU64H5zKQhWVpjBLqyk xrv83HlwhKtwgF8EF86HMZ0HskC2cSE2YIA18/q4KEAsvuQxEGlTxgjCIovFvA== X-Google-Smtp-Source: AGHT+IHgsBic49slU1Dk0/+SnE9BsDw9Yb6LT7CDKzPy9+x6UIkDK3L0ju5RzzvzPPeg+Z8EmARnFQ== X-Received: by 2002:a05:600c:3b9e:b0:414:11:ec14 with SMTP id n30-20020a05600c3b9e00b004140011ec14mr271767wms.6.1710954909350; Wed, 20 Mar 2024 10:15:09 -0700 (PDT) Received: from google.com (105.93.155.104.bc.googleusercontent.com. [104.155.93.105]) by smtp.gmail.com with ESMTPSA id r6-20020a05600c458600b00414108a1c55sm2820774wmo.16.2024.03.20.10.15.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Mar 2024 10:15:08 -0700 (PDT) Date: Wed, 20 Mar 2024 17:15:02 +0000 From: Keir Fraser To: Gavin Shan Cc: "Michael S. Tsirkin" , Will Deacon , virtualization@lists.linux.dev, linux-kernel@vger.kernel.org, jasowang@redhat.com, xuanzhuo@linux.alibaba.com, yihyu@redhat.com, shan.gavin@gmail.com, linux-arm-kernel@lists.infradead.org, Catalin Marinas , mochs@nvidia.com Subject: Re: [PATCH] virtio_ring: Fix the stale index in available ring Message-ID: References: <20240314074923.426688-1-gshan@redhat.com> <20240318165924.GA1824@willie-the-truck> <35a6bcef-27cf-4626-a41d-9ec0a338fe28@redhat.com> <20240319182251.GB3121@willie-the-truck> <9500adaf-0075-4ae9-92db-7e310b6598b0@redhat.com> <20240319203540-mutt-send-email-mst@kernel.org> <3a6c8b23-af9c-47a7-8c22-8e0a78154bd3@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <3a6c8b23-af9c-47a7-8c22-8e0a78154bd3@redhat.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240320_101515_480250_033FDE08 X-CRM114-Status: GOOD ( 11.63 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Mar 20, 2024 at 03:24:16PM +1000, Gavin Shan wrote: > > Before this patch was posted, I had debugging code to record last 16 transactions > to the available and used queue from guest and host side. It did reveal the wrong > head was fetched from the available queue. > > [ 11.785745] ================ virtqueue_get_buf_ctx_split ================ > [ 11.786238] virtio_net virtio0: output.0:id 74 is not a head! > [ 11.786655] head to be released: 036 077 > [ 11.786952] > [ 11.786952] avail_idx: > [ 11.787234] 000 63985 <-- > [ 11.787237] 001 63986 > [ 11.787444] 002 63987 > [ 11.787632] 003 63988 > [ 11.787821] 004 63989 > [ 11.788006] 005 63990 > [ 11.788194] 006 63991 > [ 11.788381] 007 63992 > [ 11.788567] 008 63993 > [ 11.788772] 009 63994 > [ 11.788957] 010 63995 > [ 11.789141] 011 63996 > [ 11.789327] 012 63997 > [ 11.789515] 013 63998 > [ 11.789701] 014 63999 > [ 11.789886] 015 64000 Does the error always occur at such a round idx value? Here, 64000 == 0xFA00. Maybe coincidence but it's improbable enough to be interesting. This debug code seems rather useful! -- Keir > [ 11.790068] > [ 11.790068] avail_head: > [ 11.790529] 000 075 <-- > [ 11.790718] 001 036 > [ 11.790890] 002 077 > [ 11.791061] 003 129 > [ 11.791231] 004 072 > [ 11.791400] 005 130 > [ 11.791574] 006 015 > [ 11.791748] 007 074 > [ 11.791918] 008 130 > [ 11.792094] 009 130 > [ 11.792263] 010 074 > [ 11.792437] 011 015 > [ 11.792617] 012 072 > [ 11.792788] 013 129 > [ 11.792961] 014 077 // The last two heads from guest to host: 077, 036 > [ 11.793134] 015 036 > > [root@nvidia-grace-hopper-05 qemu.main]# cat /proc/vhost > > avail_idx > 000 63998 > 001 64000 > 002 63954 <--- > 003 63955 > 004 63956 > 005 63974 > 006 63981 > 007 63984 > 008 63986 > 009 63987 > 010 63988 > 011 63989 > 012 63992 > 013 63993 > 014 63995 > 015 63997 > > avail_head > 000 074 > 001 015 > 002 072 > 003 129 > 004 074 // The last two heads seen by vhost is: 074, 036 > 005 036 > 006 075 <--- > 007 036 > 008 077 > 009 129 > 010 072 > 011 130 > 012 015 > 013 074 > 014 130 > 015 130 > > used_idx > 000 64000 > 001 63882 <--- > 002 63889 > 003 63891 > 004 63898 > 005 63936 > 006 63942 > 007 63946 > 008 63949 > 009 63953 > 010 63957 > 011 63981 > 012 63990 > 013 63992 > 014 63993 > 015 63999 > > used_head > 000 072 > 001 129 > 002 074 // The last two heads published to guest is: 074, 036 > 003 036 > 004 075 <--- > 005 036 > 006 077 > 007 129 > 008 072 > 009 130 > 010 015 > 011 074 > 012 130 > 013 130 > 014 074 > 015 015 > > Thanks, > Gavin > > > > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel