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=1796154076; b=D6uOb+MseFr6+fVzv6JvVXlYDkfcZNsUac8EO+ff72O+yXkQ6FLxzX63bZg4APctCaY4 0PXkEV7+5vnEAJjPftXsWL2+IxJxlE1Bf/ss66lkllqL7C6RnFJAvdpvwVr87a1cJTSKz WB09mOkyyU0NYlglBUu7/z+XbFY4IrZ0k4SjF84RQUAVE/nBQvYxd+byU5XOfIvVPZFuu aL4R1sP/GT3DRgj4UEYqVE2eIRcvL9c75vqzdysGXIMdwE1Q312ZOhAkRQ8coCvKhIbKK 8cgvh4mWwkxQWGvgveQhBlDbIqMklne03UPDuzNxEDRsO9f+T43yASgVoI/7KO1K9Hw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796154076; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=VocV1gJ84+Uyitbacu3OeGWzEXHsfRg1tqqokEX8KI4=; b=JYViC8yyWmzqgXdreYWPaYmNUvbMufLJ0LrLLPrHXH8JSo0qqdfq/Wq31RN0/aKNranf US5Re+kYD+kDsuWpUJk7y7NjsMRld+BeUv7e/qoQ8ia1S3qiXwHvsVj8olXuTi7PfCbrW 6XfUySZP4ptCSEMvWiCuVwOWZ9IA2gPbnuwEJg7xoR4aEY4fata+d7GH3Cx8ogWkAprWg O4DdaUjiBXj8NRNqByTDYHaAonpSvwrCvhMrRpGZl69oR4Af95k8fWIxeOeWgDLHcCxK5 mXKvh1U8cRoPmxRYv7kI2MD3IxEqOguFOLlF4ztIns+Fmpun/pHZdYT/Fp3II6SrIkw== 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=ACzdpF0m; 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 9BF17606A33C for ; Tue, 1 Dec 2026 19:41:16 +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=ACzdpF0m Received: by smtp.kernel.org (Postfix) with ESMTPSA id 514CF1F00893; Tue, 1 Dec 2026 19:41:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796154076; bh=VocV1gJ84+Uyitbacu3OeGWzEXHsfRg1tqqokEX8KI4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ACzdpF0mH6Bj+L2q2wrFeKnO3c/BWPkWDe9P+nSaY9Fg84WQHT4KYS1YTvxKslaWR yTRyw2Uif2Q8gJPFdedDMnR3fGb6JYMmLQ/V3B/5OSaqwa1V8nzZojzcoPIl3sQRFm CeZ3Yi9uxZpbrTM1rPANlnuv05R+20jKYKZAOEPhcAy7uZxhjqNV5VQ9YyiGwgGRyH y13XKw3YmPXU0YBS+CbZfoZuSx6w6fwv75HqVhCzWehM9K8KeCayn/vtOccyd+gS+W 5GN0CkCDW7hufWpz+2GxA5fBcij84RidcttXL25KCuryUJJY6AmcBSABmekgZHvgeK Rs/D6W+ay4oVQ== From: Imre Kaloz To: Takashi Sakamoto Cc: linux1394-devel@lists.sourceforge.net, stable@vger.kernel.org Subject: [PATCH 2/2] firewire: ohci: retry page batch allocation in ar_context_init() Date: Tue, 1 Dec 2026 20:41:09 +0100 Message-ID: <20261201194109.3566-3-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"). ar_context_init() treats any short count as failure, so the probe fails with -ENOMEM 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: f2ae92780ab9 ("firewire: ohci: split page allocation from dma mapping") Signed-off-by: Imre Kaloz --- drivers/firewire/ohci.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c index 2dd9b6bdca2b..5300623a6284 100644 --- a/drivers/firewire/ohci.c +++ b/drivers/firewire/ohci.c @@ -871,7 +871,15 @@ static int ar_context_init(struct ar_context *ctx, struct fw_ohci *ohci, // Retrieve noncontiguous pages. The descriptors for 1394 OHCI AR DMA contexts have a set // of address and length per each. The reason to use pages is to construct contiguous // address range in kernel virtual address space. - unsigned long nr_populated = alloc_pages_bulk(GFP_KERNEL | GFP_DMA32, AR_BUFFERS, pages); + // 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, AR_BUFFERS, pages); + } while (nr_populated != AR_BUFFERS && nr_populated != last); if (nr_populated != AR_BUFFERS) { release_pages(pages, nr_populated); -- 2.47.3