From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) (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 6FCFD26B973 for ; Mon, 3 Nov 2025 17:47:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762192053; cv=none; b=sMa35UcMclXfRJj9D/BdYCrAEQFGvQ/z3IMayu8yQLUj63djDExwkWkSdcCiSOX0KA2LQUUycwKMo4QUdqiD1B08uQHDNJ+EjdfINHK7dIuW4yXkO42Kg8ksstGpBmXBQ/7Bosdsv/FUYs1geluyPUq71DS+kgYbhNt/qP5N8Rs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762192053; c=relaxed/simple; bh=bh0yAI4guRADKICExO+ozJyyCC7NK4Wn9YrjOgiy/s0=; h=Message-ID:Date:MIME-Version:From:Subject:To:Cc:References: In-Reply-To:Content-Type; b=bxGKC263VqDsbVR1bjgMFLbbktwRDFo+//n0jmEi6RS2P7NVaisMfJ/fMk5FdKpSFenyC+B9zK/8ym3dzM8+d69fYgYIuMm3r6sjFY5MOPJrRY9W3HBsnRFRFD4uzhLopXf0Sn4eA24PG2+RQU9oVT+bx2ecqX+1JkMhR4MmVRI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=davidwei.uk; spf=none smtp.mailfrom=davidwei.uk; dkim=pass (2048-bit key) header.d=davidwei-uk.20230601.gappssmtp.com header.i=@davidwei-uk.20230601.gappssmtp.com header.b=Eibo1d5P; arc=none smtp.client-ip=209.85.214.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=davidwei.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=davidwei.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=davidwei-uk.20230601.gappssmtp.com header.i=@davidwei-uk.20230601.gappssmtp.com header.b="Eibo1d5P" Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-29599f08202so18838955ad.3 for ; Mon, 03 Nov 2025 09:47:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=davidwei-uk.20230601.gappssmtp.com; s=20230601; t=1762192052; x=1762796852; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:from:user-agent:mime-version:date:message-id:from:to :cc:subject:date:message-id:reply-to; bh=ALcsYF1OUvtb4WGfm5k6mvdAKsl5PnUMHIqpz80EbzE=; b=Eibo1d5PuX2TG8630QQflQQjhSAWR6tR1aOQNjKUqogU7yJTqOU0aevWoKIKysQuC8 RkLfKjHBV4AHBAH/KmersDqp93I3FegQcUbWzXeyNDk6Nx0k8r3o9AujfbKBj5H0LYK/ mdx/Y/MSjEblJ0aCPt54dXE5rqAzHoWn7or8ukev2MeB7ApgnhItjySAMsH1SqZhfuXJ gam/VdyXxUKS3SbhjzQZiqFd8tJPFxge579ut2GbeIfR4ecnJjCMTFvdRfaDlIsQ9eMj uuD8mWwZNUCIHY88Nm6zWc6i/W9Fiwmknq2bF0E/fkjnHzFvlNBvzNgekbVBmG/tbp5S JI9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762192052; x=1762796852; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:from:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ALcsYF1OUvtb4WGfm5k6mvdAKsl5PnUMHIqpz80EbzE=; b=SQWfcwfaoxej1+B5SF5nnW0ToYjv0cZJXevX42TJKPddZsrhGvJiVDo6ZUSG+859ir o7WpYcAs+XHpz8GJyVVZIXSaoJpUoBV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h2dnxcQekJr3lu/MmiZoAsEctjDvzQ== X-Received: by 2002:a17:902:e74e:b0:295:8db9:3059 with SMTP id d9443c01a7336-2958db9335emr85842325ad.38.1762192051708; Mon, 03 Nov 2025 09:47:31 -0800 (PST) Received: from [192.168.86.109] ([136.27.45.11]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2953f35bc28sm108579535ad.109.2025.11.03.09.47.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 03 Nov 2025 09:47:30 -0800 (PST) Message-ID: Date: Mon, 3 Nov 2025 09:47:28 -0800 Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: David Wei Subject: Re: [PATCH v3 2/2] net: io_uring/zcrx: call netdev_queue_get_dma_dev() under instance lock To: Pavel Begunkov , io-uring@vger.kernel.org, netdev@vger.kernel.org Cc: Jens Axboe , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman References: <20251101022449.1112313-1-dw@davidwei.uk> <20251101022449.1112313-3-dw@davidwei.uk> Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2025-11-03 05:51, Pavel Begunkov wrote: > On 11/1/25 02:24, David Wei wrote: >> netdev ops must be called under instance lock or rtnl_lock, but >> io_register_zcrx_ifq() isn't doing this for netdev_queue_get_dma_dev(). >> Fix this by taking the instance lock using netdev_get_by_index_lock(). >> >> Extended the instance lock section to include attaching a memory >> provider. Could not move io_zcrx_create_area() outside, since the dmabuf >> codepath IORING_ZCRX_AREA_DMABUF requires ifq->dev. > > It's probably fine for now, but this nested waiting feels > uncomfortable considering that it could be waiting for other > devices to finish IO via dmabuf fences. > Only the dmabuf path requires ifq->dev in io_zcrx_create_area(); I could split this into two and then unlock netdev instance lock between holding a ref and calling net_mp_open_rxq(). So the new ordering would be: 1. io_zcrx_create_area() for !IORING_ZCRX_AREA_DMABUF 2. netdev_get_by_index_lock(), hold netdev ref, unlock netdev 3. io_zcrx_create_area() for IORING_ZCRX_AREA_DMABUF 4. net_mp_open_rxq() Jakub, do you see any problems in relocking?