From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) (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 864DA2E1F06 for ; Mon, 2 Feb 2026 22:45:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.65 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770072342; cv=none; b=iXngY4tGtenVPdMCmF1FHh+Rexw/submiqavsdiIUYAMchX4gdEbeUQLbw1H82ugUohL28JdtAw96sNKY5ZwqJkFHW/egFQdWC5COpUkc934LT0+RXDoa3cjff/S+haceCDJ9qp0AeR9/kludhaDHv8M93TUWhc1yFqAakId7io= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770072342; c=relaxed/simple; bh=5Kb5krIsfIdKzbY4UbV0w0i93VHuDl4UPIOiaxALKbg=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=uW8bYGMwwq1w+QYrMi6Du0bCm6K/HtagqhEWifQut74jaZRZFAxeJnly68LHygjlIJdIcJcSG6jneEpRJ/BCjZ5NgMg7xAW0I12WF5ku4tE4FyiQ4RzUmTWokKFfurP3bmugwIdKWTp2nXYpQwd0TtT4FbBNaZDRbYrgD4iM0Xg= 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=YI8KWJqU; arc=none smtp.client-ip=209.85.128.65 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="YI8KWJqU" Received: by mail-wm1-f65.google.com with SMTP id 5b1f17b1804b1-482f454be5bso1656975e9.0 for ; Mon, 02 Feb 2026 14:45:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1770072339; x=1770677139; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=JGqAdrVHnFu6PnnaHfHKQoFDoCwgyHq7ziHIdTjOCQs=; b=YI8KWJqUC0UQfYhst3EmtYqnqMbtMocelTGoFCn5ICZaG1YrEV/4+ldRx5gQP2aTe3 +jsKB2nrkgLIgvETdfjQM8fn7115QlK4jj+YzLKYw+a+TGqjeZ7NHqqxrcTSDhX2RyiV FVG4bdZR1NJRpmGXiRg3yXfjHBzeEnwtYCb9tywXndb56SQ16DUbqwY2XEpn9i98nslg h2vsWy7E5/vTrQOiYeXnHuhK26CD23pJJt42dAFR+pSOJzgEescMsEorT7hAN6nICu6u j99WD+/C2Qotx+ZPXxI+AfzgoOjZxRNMvA75Hi3rZVS/LRPI7vNaBUa0lFVndkldXVZe L5vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770072339; x=1770677139; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=JGqAdrVHnFu6PnnaHfHKQoFDoCwgyHq7ziHIdTjOCQs=; b=gcO+0j0rkup3P+L/Okr0pXQ4CG8yctq6U/T83lEF5VPxA7GyEPzStiLmUaF/kQHwYk x9rTtsTfnxTDLWnXCW15oor0M6WHD+5MHjxx+Wq/tGJvjRnRWN7JrES97wuLWLJZ2QZV +G20vEBseWkEtCuXCOJssNhiad7fKhf7Ty523UkIckhMgSf/f/iMJRF8UK7+QF2z1ggF 71jZlarYwo7Z5VzuLru5EQANmLvvxbmud97BLnqfWQIjMKsLBIiVR3goMft2SkVglXt3 OJ+GNtmYVb/27/SGgbHcLI2BIgweIxuuL8jdXAALb/Tu2TuL52YAkXL2tZ3l70HW0+r8 dAhg== X-Forwarded-Encrypted: i=1; AJvYcCXL/QfFN6MzAQZjC68ORhqdhaxbEhW96uXKqtB5lyFVmSB0bJ45ZdH9L2g4r4rMm7nsKwD/SKaPgwiY2A==@vger.kernel.org X-Gm-Message-State: AOJu0Yx1sBn/MhT0vjpX8LG+KxO1burIuihvpWN/x1bC8jswVZcWADVy npOIZYjZ9xMvC6fd21XKmpIN1GDbTZbBZ7bo8MzmSKqAKFoaa+p0Bg3j X-Gm-Gg: AZuq6aLSReIpcDxhrfPGo2/GgRgmakk8VdLzMy4Rnh9C9w30Advo2+iqzowCCCODTxa FOcGmT9IlHOR18WCQLsvnkyLsvkGIqpwGCoBbHQmi8dPhBIEUjV7TMAl7ur0zAgffP4FnS0eMMV u1clW2hQi/DBz6QHmJHcZmygSBtizeJ4jQ8hHJtTisZTgNQCXrI4vBiRfLCDD9OuS9YY50bjHxR iEIW3GpWfjzY8oAu0U01chM1gBdEC+urBJ5mvRWXKSJ/npabfQ6ALbNWXF3Ki5xW9yfSsuU08qc L12VIMx80mk9aZpx4MoBx5Dtjicr1DDKV+lCa/DYJe/8dm8zBGOjQpRSOnH6+w9yN4HfBWwFs/k 5VsPQKOr6fxJyu/h+Gp2ApfQirc19k/YJRut9Xp5dtPl85lsyQHOOV2NQQ0/vOJ/V7kDAGpeHyt EptFa9IrroN2ECU5sE4oRz/b+mYfoFs5Zp0Hka+mZ+dW0/usBdtvuN X-Received: by 2002:a05:600c:6303:b0:47e:e59c:67c5 with SMTP id 5b1f17b1804b1-4830513aed8mr18382505e9.8.1770072338747; Mon, 02 Feb 2026 14:45:38 -0800 (PST) Received: from pumpkin (82-69-66-36.dsl.in-addr.zen.co.uk. [82.69.66.36]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-482e2973d57sm100080575e9.18.2026.02.02.14.45.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Feb 2026 14:45:38 -0800 (PST) Date: Mon, 2 Feb 2026 22:45:37 +0000 From: David Laight To: "Arnd Bergmann" Cc: "Nicolas Dufresne" , "Arnd Bergmann" , "Detlev Casanova" , "Ezequiel Garcia" , "Mauro Carvalho Chehab" , Heiko =?UTF-8?B?U3TDvGJuZXI=?= , "Nathan Chancellor" , "Hans Verkuil" , "Nick Desaulniers" , "Bill Wendling" , "Justin Stitt" , linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: Re: [PATCH 1/2] media: rkvdec: reduce excessive stack usage in assemble_hw_pps() Message-ID: <20260202224537.16c16e13@pumpkin> In-Reply-To: <070cebc8-3cab-4f32-a203-9456506dfcc5@app.fastmail.com> References: <20260202094804.1231706-1-arnd@kernel.org> <16baade123f563ea92e6117bf78c56e8617daf14.camel@collabora.com> <3b89635f-1c1c-4e4e-b0a9-2bbd0f21bc90@app.fastmail.com> <070cebc8-3cab-4f32-a203-9456506dfcc5@app.fastmail.com> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; arm-unknown-linux-gnueabihf) Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Mon, 02 Feb 2026 16:59:05 +0100 "Arnd Bergmann" wrote: ... > - Since most of the fields are exactly 6 bits offset from a word > boundary, you can try assembling all the *_field_order_cnt* > fields in an array first that has all the bits in the correct > order, but then shift the entire array six bits. How are they being written to the hardware? It would be very unusual for hardware not to have things 'reasonably aligned'. This makes me think that the data buffer is actually being 'bit-bashed' down some serial data interface. In which case the simple solution is to give the function that writes the data a 'bit offset' for the first word. And to re-iterate C bit-fields are completely non portable and entirely inappropriate for mapping onto device registers. You can use C structures (arranged with everything on its natural boundary so there are no holes) with members declared with the correct endianness. Indeed that is actually preferable to using numeric constants as the offsets are tied to the correct structure. David > > Arnd >