From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dy1-f181.google.com (mail-dy1-f181.google.com [74.125.82.181]) (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 696B13A59A3 for ; Tue, 16 Jun 2026 11:59:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781611142; cv=none; b=sK8W1o8AvBhDGjt9KiV3HTXPVAL6uSzyATyMKe6EGzOfT+qDyxmYsyuEOFAyF3QNN0HkFxKny4/26HvIdD5JbAyMZ7DOd6EhylqXNrj7fU8UJNvdyEA0N9HoQDLmRB0tAw8/m29iIoYySthpUhU74tuINnTVCyj4M8I7I5Tc5T8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781611142; c=relaxed/simple; bh=YjyDwM56jj3ck9czMA3EKniiIiPNImL2Oy+lMeO7nTI=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=aYNuzXijO4twU+894qJl1OX7IydhzjQGWRiBo5LuEsfpV2+5BVVaUAdVbw6wpVVgPKIMVKV3aLWMwG/oARKvM/bZHAa8KLG6DYUO49FZcfOjzw9m6Efw8mxQ2NO0f39jmV01k8n7jNyNybtJgKOxeaFX5Qp99De4nOMuYgKtV4A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=RSqjkNkN; arc=none smtp.client-ip=74.125.82.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="RSqjkNkN" Received: by mail-dy1-f181.google.com with SMTP id 5a478bee46e88-304d8362a58so3288631eec.1 for ; Tue, 16 Jun 2026 04:59:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1781611140; x=1782215940; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to:subject :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=cOYpESX981Rq4adIIEfG1WpSNiPgBSeZzxBAEnkFj7o=; b=RSqjkNkN+5t9GXGQdzg4XxykC8/aiszMz5K7dgfBR2gKlQ3HUyrBPY0GYk/3wYPqr2 l/rTCjFuTCP+d4/7kEddgAShHdQmo0CXWA09rwPdCLfshe8jHu+twPXagab7ch5xzHDu JVWqpargrd+QKjwGDWQ4JZ88CQMqtW7VrXwGs45vTVVe5FITxejhOsJsEJW4bIEeAoF/ afZelZvMBwOgw/A9jVJjPjhIdkStc55+K+X1xiwcLOH8u7+xebTvEb6sUySKev/pEwE9 M5RLFSIhR65k6UeoP9RuUOD4g8kHxBupBd4yAzKJHTSf9UljNOPJQAE6S4YJPJPiviu5 K7ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781611140; x=1782215940; h=content-transfer-encoding:in-reply-to:from:references:cc:to:subject :user-agent:mime-version:date:message-id:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=cOYpESX981Rq4adIIEfG1WpSNiPgBSeZzxBAEnkFj7o=; b=In9SPukbzeRIfdJK+9728ufV+0iolE/fyjE7k7J6bw5L+sWT2RKj9y85NlaxfRDYnA Zo846jVzqEkhxoPIXnFGCQGAbcs8fX53M/EvYjpnM/YmjyKt/avB9uxePaosnj5YsNGI QOhe+bWGW6AwLQxklTH3ZlpWZrrJVQxt/Ymb3Yql6G6GGI5c2H8ROxr+FY6ZJANcBfMV xz982dEa0jGDCgma2PZuTHemi+z3LkOxTKt/lqxYGnG8rxMqc5kleu7Bg0cj3wqH3O3i 9s8LFAkHldeGt1M/8OqZRXi0+bw63vzPl2Ik9W0uZHJeWDoiYefAuGH3ijsQ9bTEtvRH r3Kg== X-Forwarded-Encrypted: i=1; AFNElJ+DCkqF6eu1prRmuBdt7E+x6Ym8ZfMyAnaXE68b/lLwdzQEexB1IxnAQJs2YLr1K5JDFrBm1CcT6OVPIJU=@vger.kernel.org X-Gm-Message-State: AOJu0YytrdOwqk793nmoyA2s/dwcslnH20hU+RRED3V3IQW1K202Mj8f eokMU8QoKAl9lvn0Bt63VxYTVRZXRjOCegOSu/i/XhHa20fY9pYvLj3+xEskgRPYj3A= X-Gm-Gg: Acq92OHkwBwv2q2fJEEZPIeCqzFciXoTn+844RO4BoWy5Gcg1YaWzuhn1i6l72CP0R2 VjSJbmshDp5ALmBp8/YB9jtbq8OxLi5QfkhBFXvHR2ONZxVyVZcWn2YTKxi8SAC7vDDfzjI9Cuq uwWjss4LkX/PfA07JT9312cqQPYX+CEdWjjXyD3ItYTFD7d0hmlEqxJ4VrV6yThbZcnnw2mhPJR EZvVQqOFfUzYQ8RDSxFaGv9UZbe1zdvf97PAEWVYPm5ZAR57IM1/4XW+4gfE585+WNOAOT2e4Xi Phwdc11zsYhnQlRy2uDuLIut5qMooHWeUWhj1k9VuZKppR7kTv2cYS7M//Brde+gGOKZ5w2Wt1E hNu94Oi4vSsJmodonQOUH0NdVvggizFds1dCq4/hmLZUcfFnEo/lbYXzgfglvljtbKxF3zHV5LU nhd0vNEbo/CDsMOPN8MHuOOPPeLt4pxuQd9l6pM5hnb+bnqOs= X-Received: by 2002:a05:7300:1802:b0:2ef:1d11:18b0 with SMTP id 5a478bee46e88-30ba3965b7amr1988800eec.17.1781611140293; Tue, 16 Jun 2026 04:59:00 -0700 (PDT) Received: from [100.82.100.73] ([63.216.146.178]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-3081ea447b4sm17473762eec.23.2026.06.16.04.58.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 16 Jun 2026 04:58:59 -0700 (PDT) Message-ID: Date: Tue, 16 Jun 2026 19:58:56 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] io_uring/register: preserve SQ array entries on resize To: Jens Axboe Cc: io-uring@vger.kernel.org, linux-kernel@vger.kernel.org References: <20260608133316.3656440-1-guzebing1612@gmail.com> From: guzebing In-Reply-To: <20260608133316.3656440-1-guzebing1612@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi Jens, A gentle ping on this patch. Please allow me to add some details about the root cause and the reproducer. There appear to be two related parts to how the resize path migrates pending SQ entries in regular SQ-array mode. 1. It copies SQEs by walking the logical SQ head/tail range directly. For a pending SQ entry in regular SQ-array mode, the resize path should first resolve the old sq_array[] entry to find the source physical SQE slot, and then copy that SQE into the new SQE array. 2. The old resize path switches ctx->sq_array to the SQ array in the new ring, but it does not initialize the SQ array entries for the pending submissions. And I reproduced this with a small test that: 1. creates a ring with IORING_SETUP_SINGLE_ISSUER | IORING_SETUP_DEFER_TASKRUN, 2. writes two NOP SQEs into physical slots 1 and 2, 3. queues two pending entries by setting sq_array[0] = 1 and sq_array[1] = 2 and advancing the SQ tail, 4. resizes the ring, 5. calls io_uring_enter() to submit those pending SQ entries. Without the fix, the subsequent submission path can consume the wrong SQE after resize and return a CQE with the wrong user_data. With the patch applied, pending SQ entries are migrated using the old SQ-array mapping, so they still refer to the intended SQEs after resize. Could you please take a look when you have a chance? I would also appreciate feedback if you think this is not the right direction, or if there is a better way to preserve pending SQ-array entries during resize. Thanks, guzebing