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 A209FC54E68 for ; Thu, 21 Mar 2024 12:06:46 +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-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=OHQTUQ2R+skFBZrWQZx7z48vV8BuRqlCra5YUD+athM=; b=03kdUS2TRyuhGP D9OboESaYOZnEm9+VrM7rwxFdUYHj9MdJM2yyI+uF9dOH8zZ3y1MmAYCmVEV0w3jrtrXqsgXN2/x+ /YRzGxFmYpvGR/nG/BqLaMh1wL6QVIImZYpsa4h3vjs1GCGmq6r9iazouhc9rAC5xzXaL9HMO6NDZ u3NIYYeQqw9ELO0FMKSbtnW4DkeHvzXrqsoeJyTOGMtJhxLlMn4Lc+2eeiShXMzNusWo788m8XQ/H 73HDUZ+TVTrhiN9tFuo+XGtHVZZnKZ/WpTA+WvQBvAOB7t1T3AwwU6DQZ0UNRjBFIBxbFTc5lggjH RrNVFYSD4shdE+Nlzzag==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rnHBo-00000002uGe-2AQE; Thu, 21 Mar 2024 12:06:32 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rnHBl-00000002uEu-3ATX for linux-arm-kernel@lists.infradead.org; Thu, 21 Mar 2024 12:06:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1711022787; 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; bh=MaftwFTntyTyuVDa9i6qNAWKdEHOXUZrSNQMfaI1f0M=; b=bG435YnPM3hHmlWiRk8D90J6ZXdbkH24hLF7wZ5GQIPR5uyxe+uJ7Nvtyp0L3+MSPFwpW0 AyADXGO9TMAn5A+h7JUiWYajSjsHkeDn/eD7WRPQaEfCXgVtvpSDOoXR491IPTY5Aqngfb LoQH9xSfUGoXk5HiT00MYoKa941p4TA= Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-597-CWGw8ezOOIaChxNXOu3naw-1; Thu, 21 Mar 2024 08:06:23 -0400 X-MC-Unique: CWGw8ezOOIaChxNXOu3naw-1 Received: by mail-pl1-f197.google.com with SMTP id d9443c01a7336-1def93f4fa7so6299055ad.1 for ; Thu, 21 Mar 2024 05:06:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711022782; x=1711627582; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=MaftwFTntyTyuVDa9i6qNAWKdEHOXUZrSNQMfaI1f0M=; b=IadRBkf2gPALh/jRiX0lIg6sreo/S2sVIgU7z10P5ezxOOLVgQ8BnyVLUoIdmlPd7n ihEL+2+ziZ6LKa74xgcqGgPS6PBSRX6/DbetIQ2R3TXXciv03eDskCZv8KiLIb+Qu7Aw YtU5dTCMmugR3pT45d4MSNyAqzhJOwiO7PgzaZ1z8+G9i+aSu+pHb77005CmN6tbaaWv 5NZvUfE+8yqX7tDuztDctipaSxCiqc8iR0T4l/+VBPn+knOh6h4B2NyDrI/4ZxFjhpL7 1IkzzSDhZxMTiJrLA5s9gtYqbLJwVKry/AkPYmNeGR4uAEgAp2L3lCrO1dT1RpwLFi/f cnCw== X-Forwarded-Encrypted: i=1; AJvYcCUOkBtC8BuMzReLkjgHyiReoGHlyrH03hRf4Kpioiz01XT/x7vo99NSK2WH38ZcB/LpqfDYGQp0E5NCJYGbDmwBsCcfr2AxIP8nQb0nVmuNhfxCJpg= X-Gm-Message-State: AOJu0YwXVPQxed1uFWnTHXvIPAfSCSPFEehEa4l4w6SeDuyGeHuUdSgp VB0enlzWmDhj/XfaHCJDOxHEJ8RpJIncfOetiAdOoGc6XSC1qgSiPK30VbijAR1hIVV1XkEntTb yG0rA3uM0Yp2svxjJLUXKgjkkIG6D4W52X9VA6oWFapo/D4aqbZKXarbs2KWfw9F+6jZTxfx7 X-Received: by 2002:a17:902:d549:b0:1dd:93f3:d575 with SMTP id z9-20020a170902d54900b001dd93f3d575mr5914479plf.30.1711022782345; Thu, 21 Mar 2024 05:06:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IECnTXS5JWKv1pXKbA06u3gvbc+DZ5MivOM5zLUIw9sRi+g/m+s1qUdZJQCXBTcImopf4ZsuA== X-Received: by 2002:a17:902:d549:b0:1dd:93f3:d575 with SMTP id z9-20020a170902d54900b001dd93f3d575mr5914451plf.30.1711022781958; Thu, 21 Mar 2024 05:06:21 -0700 (PDT) Received: from [192.168.68.51] ([43.252.115.31]) by smtp.gmail.com with ESMTPSA id j11-20020a17090276cb00b001dd88a5dc47sm5893220plt.290.2024.03.21.05.06.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 21 Mar 2024 05:06:21 -0700 (PDT) Message-ID: Date: Thu, 21 Mar 2024 22:06:15 +1000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] virtio_ring: Fix the stale index in available ring To: Keir Fraser 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 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> From: Gavin Shan In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240321_050629_945657_3731A115 X-CRM114-Status: GOOD ( 11.84 ) 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-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 3/21/24 03:15, Keir Fraser wrote: > 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, Nope, it's just coincidence. We don't have such kind of pattern. Thanks, Gavin > > >> [ 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