From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796154075; b=Z+5een+Hh4ZU8mLTPtlnYP5SY4gbsxAI6+c2wvcmwaZ+UXOxr1flW3SS6me1b62mfANB VbLISgV2eW+D4Uy+X7DUg4U7FBzyBYJK7vTJSaXMn85NsoOO15VkNQ3yPGjxttyMABbsf gUO6InKTM/KKezl5B8sFCJn2FWSo5Xe4ukXUmNFNGXCfIjk0sd10Bgn/vXCIB4iM0TR+4 zXlDGHyLqal4kpMR+gfBciXfesW82O0tggO9ojBMueU6kNBjW11xLTqNHATGyqXYfdgGM DvtIW0mTC/C5B/QsoMoSUCsK6lWOAyiNWHz9JUQONJXOGz/5e6wqF8Z4Vdxh8o2j/Uw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796154075; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=AZVkuMCM+i0GC0uEjd2tw9+UxqrcN8z2zmXOZbPiQVM=; b=pk/3If8SZ1TuowPpaBXMfHsykia9QyoJDUtmDXdrSV5kS3R5ymumyIoNc3UPzwV2MqXQ neKKy1cQCz9vbMoYUs190ZEIgGO0cfaZcftPIvhuKtMBWOzc594Oh2yNdK0skCS4xIDPC tk5XM/R3uno+bzmkrToSBhQPuq3i3fjgVSWuSiNFC5SP6/HNhzkbookgyJETslgG1TIgL S/lW7xzrVb7pEB32v//8INW4n7tQdtckWvrQ8EWDvYEDHiInDrkuMDuGz1fT3aTFhnCCX LA5fWOL2uiR8geou7UUKJo513pWnHxk5kbZS+rT3eGtLK9iqoH7v8tDdLBic/G5g2Vg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=cDC603XH; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3868E606A685 for ; Tue, 1 Dec 2026 19:41:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=cDC603XH Received: by smtp.kernel.org (Postfix) with ESMTPSA id C44E91F000C1; Tue, 1 Dec 2026 19:41:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796154074; bh=AZVkuMCM+i0GC0uEjd2tw9+UxqrcN8z2zmXOZbPiQVM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=cDC603XHBuWn6Q0DtkUWUh2zzsrLik18JMNlMdEV5wKrB0zrqyEKtTTN7Vs3XUKNv CHRnaKDYr1ppsPy0BxLda8+m6wDJ/OmP3p6PwfJguGW5djijd2BIpmg+742+Z/tjzg ysTK94aPgkp105WqkLg5IGQdRGkCajv2d1P63tYWP/j5TbTzghOdy1FpUMfh01eU2D hQvtEKrduGCuLC5IgXxgcUzD9CSVypq3Z1b8LYsmQ6vRrRaRf26bhRjij+kOCszkW9 OL9CgLXiC0QUyxdwLuqSSbixgqLMw7FrkFIAQG4p2fcE1BuaWWanGwBS6GXyNZNGRy m8uJzrIbKmwOw== From: Imre Kaloz To: Takashi Sakamoto Cc: linux1394-devel@lists.sourceforge.net, stable@vger.kernel.org Subject: [PATCH 1/2] firewire: core: retry page batch allocation in fw_iso_buffer_alloc() Date: Tue, 1 Dec 2026 20:41:08 +0100 Message-ID: <20261201194109.3566-2-kaloz@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261201194109.3566-1-kaloz@kernel.org> References: <20261201194109.3566-1-kaloz@kernel.org> X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit alloc_pages_bulk() may return fewer pages than requested, e.g. a single page when the per-cpu page lists are not used on a CONFIG_SMP=n kernel since commit a373f371166d ("mm/page_alloc: effectively disable pcp with CONFIG_SMP=n"). fw_iso_buffer_alloc() treats any short count as failure, so isochronous buffers with more than one page cannot be allocated there. Call alloc_pages_bulk() again until the array is filled, and fail only when a call makes no progress. Cc: stable@vger.kernel.org # v7.1 Fixes: c2f60aa1602d ("firewire: core: use common kernel API to allocate and release a batch of pages") Signed-off-by: Imre Kaloz --- drivers/firewire/core-iso.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/firewire/core-iso.c b/drivers/firewire/core-iso.c index fd6cbbf79d0b..09fb213cfe4a 100644 --- a/drivers/firewire/core-iso.c +++ b/drivers/firewire/core-iso.c @@ -39,8 +39,17 @@ int fw_iso_buffer_alloc(struct fw_iso_buffer *buffer, int page_count) // Retrieve noncontiguous pages. The descriptors for 1394 OHCI isochronous DMA contexts // have a set of address and length per each, while the reason to use pages is the // convenience to map them into virtual address space of user process. - unsigned long nr_populated = alloc_pages_bulk(GFP_KERNEL | GFP_DMA32 | __GFP_ZERO, - page_count, page_array); + // A single call may return fewer pages than requested, e.g. when the per-cpu page lists + // are unavailable. Call again until the array is filled, or no progress is made. + unsigned long nr_populated = 0; + unsigned long last; + + do { + last = nr_populated; + nr_populated = alloc_pages_bulk(GFP_KERNEL | GFP_DMA32 | __GFP_ZERO, page_count, + page_array); + } while (nr_populated != page_count && nr_populated != last); + if (nr_populated != page_count) { // Assuming the above call fills page_array sequentially from the beginning. release_pages(page_array, nr_populated); -- 2.47.3