Re: [PATCH V5 1/3] tools/perf: Add text_end to "struct dso" to save .text section size

2023-10-02 Thread Namhyung Kim
Hello,

On Thu, Sep 28, 2023 at 12:52 AM Athira Rajeev
 wrote:
>
> Update "struct dso" to include new member "text_end".
> This new field will represent the offset for end of text
> section for a dso. For elf, this value is derived as:
> sh_size (Size of section in byes) + sh_offset (Section file
> offst) of the elf header for text.
>
> For bfd, this value is derived as:
> 1. For PE file,
> section->size + ( section->vma - dso->text_offset)
> 2. Other cases:
> section->filepos (file position) + section->size (size of
> section)
>
> To resolve the address from a sample, perf looks at the
> DSO maps. In case of address from a kernel module, there
> were some address found to be not resolved. This was
> observed while running perf test for "Object code reading".
> Though the ip falls beteen the start address of the loaded
> module (perf map->start ) and end address ( perf map->end),
> it was unresolved.
>
> Example:
>
> Reading object code for memory address: 0xc00807f0142c
> File is: /lib/modules/6.5.0-rc3+/kernel/fs/xfs/xfs.ko
> On file address is: 0x1114cc
> Objdump command is: objdump -z -d --start-address=0x11142c 
> --stop-address=0x1114ac /lib/modules/6.5.0-rc3+/kernel/fs/xfs/xfs.ko
> objdump read too few bytes: 128
> test child finished with -1
>
> Here, module is loaded at:
> # cat /proc/modules | grep xfs
> xfs 2228224 3 - Live 0xc00807d0
>
> From objdump for xfs module, text section is:
> text 0010f7bc    00a0 2**4
>
> Here the offset for 0xc00807f0142c ie  0x112074 falls out
> .text section which is up to 0x10f7bc.
>
> In this case for module, the address 0xc00807e11fd4 is pointing
> to stub instructions. This address range represents the module stubs
> which is allocated on module load and hence is not part of DSO offset.
>
> To identify such  address, which falls out of text
> section and within module end, added the new field "text_end" to
> "struct dso".
>
> Reported-by: Disha Goel 
> Signed-off-by: Athira Rajeev 
> Reviewed-by: Adrian Hunter 
> Reviewed-by: Kajol Jain 

For the series,
Acked-by: Namhyung Kim 

Thanks,
Namhyung


> ---
> Changelog:
> v2 -> v3:
>  Added Reviewed-by from Adrian
>
>  v1 -> v2:
>  Added text_end for bfd also by updating dso__load_bfd_symbols
>  as suggested by Adrian.
>
>  tools/perf/util/dso.h| 1 +
>  tools/perf/util/symbol-elf.c | 4 +++-
>  tools/perf/util/symbol.c | 2 ++
>  3 files changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/util/dso.h b/tools/perf/util/dso.h
> index b41c9782c754..70fe0fe69bef 100644
> --- a/tools/perf/util/dso.h
> +++ b/tools/perf/util/dso.h
> @@ -181,6 +181,7 @@ struct dso {
> u8   rel;
> struct build_id  bid;
> u64  text_offset;
> +   u64  text_end;
> const char   *short_name;
> const char   *long_name;
> u16  long_name_len;
> diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
> index 95e99c332d7e..9e7eeaf616b8 100644
> --- a/tools/perf/util/symbol-elf.c
> +++ b/tools/perf/util/symbol-elf.c
> @@ -1514,8 +1514,10 @@ dso__load_sym_internal(struct dso *dso, struct map 
> *map, struct symsrc *syms_ss,
> }
>
> if (elf_section_by_name(runtime_ss->elf, _ss->ehdr, ,
> -   ".text", NULL))
> +   ".text", NULL)) {
> dso->text_offset = tshdr.sh_addr - tshdr.sh_offset;
> +   dso->text_end = tshdr.sh_offset + tshdr.sh_size;
> +   }
>
> if (runtime_ss->opdsec)
> opddata = elf_rawdata(runtime_ss->opdsec, NULL);
> diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
> index 3f36675b7c8f..f25e4e62cf25 100644
> --- a/tools/perf/util/symbol.c
> +++ b/tools/perf/util/symbol.c
> @@ -1733,8 +1733,10 @@ int dso__load_bfd_symbols(struct dso *dso, const char 
> *debugfile)
> /* PE symbols can only have 4 bytes, so use .text 
> high bits */
> dso->text_offset = section->vma - (u32)section->vma;
> dso->text_offset += 
> (u32)bfd_asymbol_value(symbols[i]);
> +   dso->text_end = (section->vma - dso->text_offset) + 
> section->size;
> } else {
> dso->text_offset = section->vma - section->filepos;
> +   dso->text_end = section->filepos + section->size;
> }
> }
>
> --
> 2.31.1
>


[PATCH v2] powerpc/pseries/iommu: enable_ddw incorrectly returns direct mapping for SR-IOV device

2023-10-02 Thread Gaurav Batra
When a device is initialized, the driver invokes dma_supported() twice -
first for streaming mappings followed by coherent mappings. For an
SR-IOV device, default window is deleted and DDW created. With vPMEM
enabled, TCE mappings are dynamically created for both vPMEM and SR-IOV
device.  There are no direct mappings.

First time when dma_supported() is called with 64 bit mask, DDW is created
and marked as dynamic window. The second time dma_supported() is called,
enable_ddw() finds existing window for the device and incorrectly returns
it as "direct mapping".

This only happens when size of DDW is big enough to map max LPAR memory.

This results in streaming TCEs to not get dynamically mapped, since code
incorrently assumes these are already pre-mapped. The adapter initially
comes up but goes down due to EEH.

Fixes: 381ceda88c4c ("powerpc/pseries/iommu: Make use of DDW for indirect 
mapping")
Cc: sta...@vger.kernel.org
Signed-off-by: Gaurav Batra 
---
 arch/powerpc/platforms/pseries/iommu.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/iommu.c 
b/arch/powerpc/platforms/pseries/iommu.c
index 16d93b580f61..496e16c588aa 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -914,7 +914,8 @@ static int remove_ddw(struct device_node *np, bool 
remove_prop, const char *win_
return 0;
 }
 
-static bool find_existing_ddw(struct device_node *pdn, u64 *dma_addr, int 
*window_shift)
+static bool find_existing_ddw(struct device_node *pdn, u64 *dma_addr, int 
*window_shift,
+ bool *direct_mapping)
 {
struct dma_win *window;
const struct dynamic_dma_window_prop *dma64;
@@ -927,6 +928,7 @@ static bool find_existing_ddw(struct device_node *pdn, u64 
*dma_addr, int *windo
dma64 = window->prop;
*dma_addr = be64_to_cpu(dma64->dma_base);
*window_shift = be32_to_cpu(dma64->window_shift);
+   *direct_mapping = window->direct;
found = true;
break;
}
@@ -1270,10 +1272,8 @@ static bool enable_ddw(struct pci_dev *dev, struct 
device_node *pdn)
 
mutex_lock(_win_init_mutex);
 
-   if (find_existing_ddw(pdn, >dev.archdata.dma_offset, )) {
-   direct_mapping = (len >= max_ram_len);
+   if (find_existing_ddw(pdn, >dev.archdata.dma_offset, , 
_mapping))
goto out_unlock;
-   }
 
/*
 * If we already went through this for a previous function of
-- 
2.39.2 (Apple Git-143)



Re: [PATCH] powerpc/pseries/iommu: enable_ddw incorrectly returns direct mapping for SR-IOV device.

2023-10-02 Thread Madhavan Srinivasan



On 10/3/23 3:16 AM, Gaurav Batra wrote:

When a device is initialized, the driver invokes dma_supported() twice - first
for streaming mappings followed by coherent mappings. For an SR-IOV device,
default window is deleted and DDW created. With vPMEM enabled, TCE mappings
are dynamically created for both vPMEM and SR-IOV device. There are no direct
mappings.

First time when dma_supported() is called with 64 bit mask, DDW is created and
marked as dynamic window. The second time dma_supported() is called, 
enable_ddw()
finds existing window for the device and incorrectly returns it as "direct 
mapping".

This only happens when size of DDW is capable of mapping max LPAR memory.

This results in streaming TCEs to not get dynamically mapped, since code 
incorrently
assumes these are already pre-mapped. The adapter initially comes up but goes 
down
due to EEH.


Just checked for patch submission and it is missing "Signed-off-by:"
It is good to run once with checkpatch.pl before posting to mailing list

maddy


---
  arch/powerpc/platforms/pseries/iommu.c | 7 ---
  1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/iommu.c 
b/arch/powerpc/platforms/pseries/iommu.c
index 16d93b580f61..d8b4adcef1ad 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -914,7 +914,8 @@ static int remove_ddw(struct device_node *np, bool 
remove_prop, const char *win_
return 0;
  }

-static bool find_existing_ddw(struct device_node *pdn, u64 *dma_addr, int 
*window_shift)
+static bool find_existing_ddw(struct device_node *pdn, u64 *dma_addr, int 
*window_shift,
+ bool *direct_mapping)
  {
struct dma_win *window;
const struct dynamic_dma_window_prop *dma64;
@@ -927,6 +928,7 @@ static bool find_existing_ddw(struct device_node *pdn, u64 
*dma_addr, int *windo
dma64 = window->prop;
*dma_addr = be64_to_cpu(dma64->dma_base);
*window_shift = be32_to_cpu(dma64->window_shift);
+   *direct_mapping = window->direct;
found = true;
break;
}
@@ -1270,8 +1272,7 @@ static bool enable_ddw(struct pci_dev *dev, struct 
device_node *pdn)

mutex_lock(_win_init_mutex);

-   if (find_existing_ddw(pdn, >dev.archdata.dma_offset, )) {
-   direct_mapping = (len >= max_ram_len);
+   if (find_existing_ddw(pdn, >dev.archdata.dma_offset, , 
_mapping)) {
goto out_unlock;
}



Re: (subset) [PATCH 00/40] soc: Convert to platform remove callback returning void

2023-10-02 Thread Bjorn Andersson


On Mon, 25 Sep 2023 11:54:51 +0200, Uwe Kleine-König wrote:
> this series converts all platform drivers below drivers/soc to use
> .remove_new(). The motivation is to get rid of an integer return code
> that is (mostly) ignored by the platform driver core and error prone on
> the driver side.
> 
> See commit 5c5a7680e67b ("platform: Provide a remove callback that
> returns no value") for an extended explanation and the eventual goal.
> 
> [...]

Applied, thanks!

[18/40] soc/qcom: icc-bwmon: Convert to platform remove callback returning void
commit: dd714c568ed4e6f79017be45077de71e9908af03
[19/40] soc/qcom: llcc-qcom: Convert to platform remove callback returning void
commit: d85a9d18a58156fc8b5ab185e00e078adaaeefde
[20/40] soc/qcom: ocmem: Convert to platform remove callback returning void
commit: 0b742c498bcd7d215501b10fe9df72a16237735a
[21/40] soc/qcom: pmic_glink: Convert to platform remove callback returning void
commit: 4b3373e42dc2caa34394ac090c8c70bed49badd6
[22/40] soc/qcom: qcom_aoss: Convert to platform remove callback returning void
commit: ffbe84a514f863a46a85c1e47b2b6d930b1b463e
[23/40] soc/qcom: qcom_gsbi: Convert to platform remove callback returning void
commit: 57b31729bd2c72b00d400106e18db91e9d95d3c3
[24/40] soc/qcom: qcom_stats: Convert to platform remove callback returning void
commit: a47ff90bf2f93ce4ca99858948a74a0c10a2bc45
[25/40] soc/qcom: rmtfs_mem: Convert to platform remove callback returning void
commit: 7c93da5b8b69d4e4e7270c33ba3206af43930e1d
[26/40] soc/qcom: smem: Convert to platform remove callback returning void
commit: 4b8dee9a34d51a61f60add996fae6a7140a20ae5
[27/40] soc/qcom: smp2p: Convert to platform remove callback returning void
commit: 1cd966c2dc19654ed08c843e5c933db8c1349636
[28/40] soc/qcom: smsm: Convert to platform remove callback returning void
commit: bdd7cc62cf69fe989557445d65d6c8cb2f956518
[29/40] soc/qcom: socinfo: Convert to platform remove callback returning void
commit: c0989f7d1264b2b1885345a28a32fd5e1e61f9c7

Best regards,
-- 
Bjorn Andersson 


Re: [PATCH v8 20/24] iommu: Require a default_domain for all iommu drivers

2023-10-02 Thread Jason Gunthorpe
On Tue, Oct 03, 2023 at 12:21:59AM +0300, Dmitry Baryshkov wrote:
> On Wed, 13 Sept 2023 at 16:45, Jason Gunthorpe  wrote:
> >
> > At this point every iommu driver will cause a default_domain to be
> > selected, so we can finally remove this gap from the core code.
> >
> > The following table explains what each driver supports and what the
> > resulting default_domain will be:
> >
> > ops->defaut_domain
> > IDENTITY   DMA  PLATFORMv  ARM32  
> > dma-iommu  ARCH
> > amd/iommu.c Y   Y   N/A 
> > either
> > apple-dart.cY   Y   N/A 
> > either
> > arm-smmu.c  Y   Y   IDENTITY
> > either
> > qcom_iommu.cG   Y   IDENTITY
> > either
> > arm-smmu-v3.c   Y   Y   N/A 
> > either
> > exynos-iommu.c  G   Y   IDENTITY
> > either
> > fsl_pamu_domain.c   Y   Y   N/A N/A 
> > PLATFORM
> > intel/iommu.c   Y   Y   N/A 
> > either
> > ipmmu-vmsa.cG   Y   IDENTITY
> > either
> > msm_iommu.c G   IDENTITYN/A
> 
> Unfortunately this patch breaks msm_iommu platforms. This driver
> doesn't select ARM_DMA_USE_IOMMU, so iommu_get_default_domain_type()
> returns 0, bus_iommu_probe() fails with -ENODEV.
> If I make MSM_IOMMU select ARM_DMA_USE_IOMMU, then GPU probing fails
> with -EBUSY.

Oh, OK.

Does this fix it?

diff --git a/drivers/iommu/msm_iommu.c b/drivers/iommu/msm_iommu.c
index cdc7b730192a35..f7ef081c33dcb2 100644
--- a/drivers/iommu/msm_iommu.c
+++ b/drivers/iommu/msm_iommu.c
@@ -685,10 +685,16 @@ irqreturn_t msm_iommu_fault_handler(int irq, void *dev_id)
return 0;
 }
 
+static int msm_iommu_def_domain_type(struct device *dev)
+{
+   return IOMMU_DOMAIN_IDENTITY;
+}
+
 static struct iommu_ops msm_iommu_ops = {
.identity_domain = _iommu_identity_domain,
.domain_alloc_paging = msm_iommu_domain_alloc_paging,
.probe_device = msm_iommu_probe_device,
+   .def_domain_type = msm_iommu_def_domain_type,
.device_group = generic_device_group,
.pgsize_bitmap = MSM_IOMMU_PGSIZES,
.of_xlate = qcom_iommu_of_xlate,


Re: [net-next PATCH 1/4] netdev: replace simple napi_schedule_prep/__napi_schedule to napi_schedule

2023-10-02 Thread Jakub Kicinski
On Mon,  2 Oct 2023 17:10:20 +0200 Christian Marangi wrote:
>   queue_work(priv->xfer_wq, >rx_work);
> - else if (napi_schedule_prep(>napi))
> - __napi_schedule(>napi);
> + else
> + napi_schedule(>napi)

Missing semi-colon, please make sure each patch builds cleanly 
with allmodconfig.
-- 
pw-bot: cr


Re: [net-next PATCH 3/4] netdev: replace napi_reschedule with napi_schedule

2023-10-02 Thread Nick Child




On 10/2/23 10:10, Christian Marangi wrote:

Now that napi_schedule return a bool, we can drop napi_reschedule that
does the same exact function. The function comes from a very old commit
bfe13f54f502 ("ibm_emac: Convert to use napi_struct independent of struct
net_device") and the purpose is actually deprecated in favour of
different logic.

Convert every user of napi_reschedule to napi_schedule.

Signed-off-by: Christian Marangi 
---


For

  drivers/net/ethernet/ibm/ibmveth.c |  2 +-
  drivers/net/ethernet/ibm/ibmvnic.c |  2 +-


Acked-by: Nick Child 


Re: [net-next PATCH 2/4] netdev: make napi_schedule return bool on NAPI successful schedule

2023-10-02 Thread Jeff Johnson

On 10/2/2023 8:10 AM, Christian Marangi wrote:

Change napi_schedule to return a bool on NAPI successful schedule. This
might be useful for some driver to do additional step after a NAPI ahs


nit:s/ahs/has/


been scheduled.

Signed-off-by: Christian Marangi 
---
  include/linux/netdevice.h | 11 +--
  1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 7e520c14eb8c..2bead8e2a14d 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -490,11 +490,18 @@ bool napi_schedule_prep(struct napi_struct *n);
   *
   * Schedule NAPI poll routine to be called if it is not already
   * running.
+ * Return true if we schedule a NAPI or false if not.
+ * Refer to napi_schedule_prep() for additional reason on why
+ * a NAPI might not be scheduled.
   */
-static inline void napi_schedule(struct napi_struct *n)
+static inline bool napi_schedule(struct napi_struct *n)
  {
-   if (napi_schedule_prep(n))
+   if (napi_schedule_prep(n)) {
__napi_schedule(n);
+   return true;
+   }
+
+   return false;
  }
  
  /**




Re: [net-next PATCH 3/4] netdev: replace napi_reschedule with napi_schedule

2023-10-02 Thread Jeff Johnson

On 10/2/2023 8:10 AM, Christian Marangi wrote:

Now that napi_schedule return a bool, we can drop napi_reschedule that
does the same exact function. The function comes from a very old commit
bfe13f54f502 ("ibm_emac: Convert to use napi_struct independent of struct
net_device") and the purpose is actually deprecated in favour of
different logic.

Convert every user of napi_reschedule to napi_schedule.

Signed-off-by: Christian Marangi 
---


For

  drivers/net/wireless/ath/ath10k/pci.c  |  2 +-


Acked-by: Jeff Johnson 



[net-next PATCH 4/4] netdev: use napi_schedule bool instead of napi_schedule_prep/__napi_schedule

2023-10-02 Thread Christian Marangi
Replace if condition of napi_schedule_prep/__napi_schedule and use bool
from napi_schedule directly where possible.

Signed-off-by: Christian Marangi 
---
 drivers/net/ethernet/atheros/atlx/atl1.c | 4 +---
 drivers/net/ethernet/toshiba/tc35815.c   | 4 +---
 drivers/net/wireless/intel/iwlwifi/pcie/rx.c | 4 +---
 3 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/atheros/atlx/atl1.c 
b/drivers/net/ethernet/atheros/atlx/atl1.c
index 02aa6fd8ebc2..a9014d7932db 100644
--- a/drivers/net/ethernet/atheros/atlx/atl1.c
+++ b/drivers/net/ethernet/atheros/atlx/atl1.c
@@ -2446,7 +2446,7 @@ static int atl1_rings_clean(struct napi_struct *napi, int 
budget)
 
 static inline int atl1_sched_rings_clean(struct atl1_adapter* adapter)
 {
-   if (!napi_schedule_prep(>napi))
+   if (!napi_schedule(>napi))
/* It is possible in case even the RX/TX ints are disabled via 
IMR
 * register the ISR bits are set anyway (but do not produce 
IRQ).
 * To handle such situation the napi functions used to check is
@@ -2454,8 +2454,6 @@ static inline int atl1_sched_rings_clean(struct 
atl1_adapter* adapter)
 */
return 0;
 
-   __napi_schedule(>napi);
-
/*
 * Disable RX/TX ints via IMR register if it is
 * allowed. NAPI handler must reenable them in same
diff --git a/drivers/net/ethernet/toshiba/tc35815.c 
b/drivers/net/ethernet/toshiba/tc35815.c
index 14cf6ecf6d0d..a8b8a0e13f9a 100644
--- a/drivers/net/ethernet/toshiba/tc35815.c
+++ b/drivers/net/ethernet/toshiba/tc35815.c
@@ -1436,9 +1436,7 @@ static irqreturn_t tc35815_interrupt(int irq, void 
*dev_id)
if (!(dmactl & DMA_IntMask)) {
/* disable interrupts */
tc_writel(dmactl | DMA_IntMask, >DMA_Ctl);
-   if (napi_schedule_prep(>napi))
-   __napi_schedule(>napi);
-   else {
+   if (!napi_schedule(>napi)) {
printk(KERN_ERR "%s: interrupt taken in poll\n",
   dev->name);
BUG();
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c 
b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c
index 23b5a0adcbd6..146bc7bd14fb 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c
@@ -1660,9 +1660,7 @@ irqreturn_t iwl_pcie_irq_rx_msix_handler(int irq, void 
*dev_id)
IWL_DEBUG_ISR(trans, "[%d] Got interrupt\n", entry->entry);
 
local_bh_disable();
-   if (napi_schedule_prep(>napi))
-   __napi_schedule(>napi);
-   else
+   if (!napi_schedule(>napi))
iwl_pcie_clear_irq(trans, entry->entry);
local_bh_enable();
 
-- 
2.40.1



[net-next PATCH 3/4] netdev: replace napi_reschedule with napi_schedule

2023-10-02 Thread Christian Marangi
Now that napi_schedule return a bool, we can drop napi_reschedule that
does the same exact function. The function comes from a very old commit
bfe13f54f502 ("ibm_emac: Convert to use napi_struct independent of struct
net_device") and the purpose is actually deprecated in favour of
different logic.

Convert every user of napi_reschedule to napi_schedule.

Signed-off-by: Christian Marangi 
---
 drivers/infiniband/ulp/ipoib/ipoib_ib.c|  4 ++--
 drivers/net/can/dev/rx-offload.c   |  2 +-
 drivers/net/ethernet/chelsio/cxgb4/sge.c   |  2 +-
 drivers/net/ethernet/chelsio/cxgb4vf/sge.c |  2 +-
 drivers/net/ethernet/ezchip/nps_enet.c |  2 +-
 drivers/net/ethernet/google/gve/gve_main.c |  2 +-
 drivers/net/ethernet/ibm/ehea/ehea_main.c  |  2 +-
 drivers/net/ethernet/ibm/emac/mal.c|  2 +-
 drivers/net/ethernet/ibm/ibmveth.c |  2 +-
 drivers/net/ethernet/ibm/ibmvnic.c |  2 +-
 drivers/net/ethernet/mellanox/mlx4/en_rx.c |  2 +-
 drivers/net/ethernet/ni/nixge.c|  2 +-
 drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c |  2 +-
 drivers/net/ethernet/xscale/ixp4xx_eth.c   |  4 ++--
 drivers/net/fjes/fjes_main.c   |  2 +-
 drivers/net/wan/ixp4xx_hss.c   |  4 ++--
 drivers/net/wireless/ath/ath10k/pci.c  |  2 +-
 drivers/net/wwan/t7xx/t7xx_hif_dpmaif_rx.c |  2 +-
 include/linux/netdevice.h  | 10 --
 19 files changed, 21 insertions(+), 31 deletions(-)

diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c 
b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
index ed25061fac62..7f84d9866cef 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
@@ -488,7 +488,7 @@ int ipoib_rx_poll(struct napi_struct *napi, int budget)
if (unlikely(ib_req_notify_cq(priv->recv_cq,
  IB_CQ_NEXT_COMP |
  IB_CQ_REPORT_MISSED_EVENTS)) &&
-   napi_reschedule(napi))
+   napi_schedule(napi))
goto poll_more;
}
 
@@ -518,7 +518,7 @@ int ipoib_tx_poll(struct napi_struct *napi, int budget)
napi_complete(napi);
if (unlikely(ib_req_notify_cq(priv->send_cq, IB_CQ_NEXT_COMP |
  IB_CQ_REPORT_MISSED_EVENTS)) &&
-   napi_reschedule(napi))
+   napi_schedule(napi))
goto poll_more;
}
return n < 0 ? 0 : n;
diff --git a/drivers/net/can/dev/rx-offload.c b/drivers/net/can/dev/rx-offload.c
index 77091f7d1fa7..46e7b6db4a1e 100644
--- a/drivers/net/can/dev/rx-offload.c
+++ b/drivers/net/can/dev/rx-offload.c
@@ -67,7 +67,7 @@ static int can_rx_offload_napi_poll(struct napi_struct *napi, 
int quota)
 
/* Check if there was another interrupt */
if (!skb_queue_empty(>skb_queue))
-   napi_reschedule(>napi);
+   napi_schedule(>napi);
}
 
return work_done;
diff --git a/drivers/net/ethernet/chelsio/cxgb4/sge.c 
b/drivers/net/ethernet/chelsio/cxgb4/sge.c
index 98dd78551d89..b5ff2e1a9975 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/sge.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/sge.c
@@ -4261,7 +4261,7 @@ static void sge_rx_timer_cb(struct timer_list *t)
 
if (fl_starving(adap, fl)) {
rxq = container_of(fl, struct sge_eth_rxq, fl);
-   if (napi_reschedule(>rspq.napi))
+   if (napi_schedule(>rspq.napi))
fl->starving++;
else
set_bit(id, s->starving_fl);
diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/sge.c 
b/drivers/net/ethernet/chelsio/cxgb4vf/sge.c
index 2d0cf76fb3c5..5b1d746e6563 100644
--- a/drivers/net/ethernet/chelsio/cxgb4vf/sge.c
+++ b/drivers/net/ethernet/chelsio/cxgb4vf/sge.c
@@ -2094,7 +2094,7 @@ static void sge_rx_timer_cb(struct timer_list *t)
struct sge_eth_rxq *rxq;
 
rxq = container_of(fl, struct sge_eth_rxq, fl);
-   if (napi_reschedule(>rspq.napi))
+   if (napi_schedule(>rspq.napi))
fl->starving++;
else
set_bit(id, s->starving_fl);
diff --git a/drivers/net/ethernet/ezchip/nps_enet.c 
b/drivers/net/ethernet/ezchip/nps_enet.c
index edf000e7bab4..4d7184d46824 100644
--- a/drivers/net/ethernet/ezchip/nps_enet.c
+++ b/drivers/net/ethernet/ezchip/nps_enet.c
@@ -198,7 

[net-next PATCH 2/4] netdev: make napi_schedule return bool on NAPI successful schedule

2023-10-02 Thread Christian Marangi
Change napi_schedule to return a bool on NAPI successful schedule. This
might be useful for some driver to do additional step after a NAPI ahs
been scheduled.

Signed-off-by: Christian Marangi 
---
 include/linux/netdevice.h | 11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 7e520c14eb8c..2bead8e2a14d 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -490,11 +490,18 @@ bool napi_schedule_prep(struct napi_struct *n);
  *
  * Schedule NAPI poll routine to be called if it is not already
  * running.
+ * Return true if we schedule a NAPI or false if not.
+ * Refer to napi_schedule_prep() for additional reason on why
+ * a NAPI might not be scheduled.
  */
-static inline void napi_schedule(struct napi_struct *n)
+static inline bool napi_schedule(struct napi_struct *n)
 {
-   if (napi_schedule_prep(n))
+   if (napi_schedule_prep(n)) {
__napi_schedule(n);
+   return true;
+   }
+
+   return false;
 }
 
 /**
-- 
2.40.1



[net-next PATCH 1/4] netdev: replace simple napi_schedule_prep/__napi_schedule to napi_schedule

2023-10-02 Thread Christian Marangi
Replace drivers that still use napi_schedule_prep/__napi_schedule
with napi_schedule helper as it does the same exact check and call.

Signed-off-by: Christian Marangi 
---
 drivers/net/ethernet/ni/nixge.c | 3 +--
 drivers/net/ethernet/wiznet/w5100.c | 4 ++--
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/ni/nixge.c b/drivers/net/ethernet/ni/nixge.c
index 97f4798f4b42..f71a4f8bbb89 100644
--- a/drivers/net/ethernet/ni/nixge.c
+++ b/drivers/net/ethernet/ni/nixge.c
@@ -755,8 +755,7 @@ static irqreturn_t nixge_rx_irq(int irq, void *_ndev)
cr &= ~(XAXIDMA_IRQ_IOC_MASK | XAXIDMA_IRQ_DELAY_MASK);
nixge_dma_write_reg(priv, XAXIDMA_RX_CR_OFFSET, cr);
 
-   if (napi_schedule_prep(>napi))
-   __napi_schedule(>napi);
+   napi_schedule(>napi);
goto out;
}
if (!(status & XAXIDMA_IRQ_ALL_MASK)) {
diff --git a/drivers/net/ethernet/wiznet/w5100.c 
b/drivers/net/ethernet/wiznet/w5100.c
index 341ee2f249fd..5613fd6a9f0a 100644
--- a/drivers/net/ethernet/wiznet/w5100.c
+++ b/drivers/net/ethernet/wiznet/w5100.c
@@ -930,8 +930,8 @@ static irqreturn_t w5100_interrupt(int irq, void 
*ndev_instance)
 
if (priv->ops->may_sleep)
queue_work(priv->xfer_wq, >rx_work);
-   else if (napi_schedule_prep(>napi))
-   __napi_schedule(>napi);
+   else
+   napi_schedule(>napi)
}
 
return IRQ_HANDLED;
-- 
2.40.1



Re: [PATCH v3 1/3] crypto: mxs-dcp: Add support for hardware provided keys

2023-10-02 Thread Jarkko Sakkinen
On Wed Sep 27, 2023 at 9:25 AM EEST, David Gstir wrote:
> Jarkko,
>
> > On 25.09.2023, at 17:22, Jarkko Sakkinen  wrote:
> > 
> > On Mon Sep 18, 2023 at 5:18 PM EEST, David Gstir wrote:
> >> DCP is capable to performing AES with hardware-bound keys.
> >> These keys are not stored in main memory and are therefore not directly
> >> accessible by the operating system.
> >> 
> >> So instead of feeding the key into DCP, we need to place a
> >> reference to such a key before initiating the crypto operation.
> >> Keys are referenced by a one byte identifiers.
> > 
> > Not sure what the action of feeding key into DCP even means if such
> > action does not exists.
> > 
> > What you probably would want to describe here is how keys get created
> > and how they are referenced by the kernel.
> > 
> > For the "use" part please try to avoid academic paper style long
> > expression starting with "we" pronomine.
> > 
> > So the above paragraph would normalize into "The keys inside DCP
> > are referenced by one byte identifier". Here of course would be
> > for the context nice to know what is this set of DCP keys. E.g.
> > are total 256 keys or some subset?
> > 
> > When using too much prose there can be surprsingly little digestable
> > information, thus this nitpicking.
>
> Thanks for reviewing that in detail! I’ll rephrase the commit
> messages on all patches to get rid of the academic paper style.
>
>
> > 
> >> DCP supports 6 different keys: 4 slots in the secure memory area,
> >> a one time programmable key which can be burnt via on-chip fuses
> >> and an unique device key.
> >> 
> >> Using these keys is restricted to in-kernel users that use them as building
> >> block for other crypto tools such as trusted keys. Allowing userspace
> >> (e.g. via AF_ALG) to use these keys to crypt or decrypt data is a security
> >> risk, because there is no access control mechanism.
> > 
> > Unless this patch has anything else than trusted keys this should not
> > be an open-ended sentence. You want to say roughly that DCP hardware
> > keys are implemented for the sake to implement trusted keys support,
> > and exactly and only that.
> > 
> > This description also lacks actions taken by the code changes below,
> > which is really the beef of any commit description.
>
> You’re right. I’ll add that.

Yup, I'm just doing my part of the job, as I'm expected to do it :-)
Thanks for understanding.

> Thanks,
> - David

BR, Jarkko


[PATCH] powerpc/pseries/iommu: enable_ddw incorrectly returns direct mapping for SR-IOV device.

2023-10-02 Thread Gaurav Batra
When a device is initialized, the driver invokes dma_supported() twice - first
for streaming mappings followed by coherent mappings. For an SR-IOV device,
default window is deleted and DDW created. With vPMEM enabled, TCE mappings
are dynamically created for both vPMEM and SR-IOV device. There are no direct
mappings.

First time when dma_supported() is called with 64 bit mask, DDW is created and
marked as dynamic window. The second time dma_supported() is called, 
enable_ddw()
finds existing window for the device and incorrectly returns it as "direct 
mapping".

This only happens when size of DDW is capable of mapping max LPAR memory.

This results in streaming TCEs to not get dynamically mapped, since code 
incorrently
assumes these are already pre-mapped. The adapter initially comes up but goes 
down
due to EEH.
---
 arch/powerpc/platforms/pseries/iommu.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/iommu.c 
b/arch/powerpc/platforms/pseries/iommu.c
index 16d93b580f61..d8b4adcef1ad 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -914,7 +914,8 @@ static int remove_ddw(struct device_node *np, bool 
remove_prop, const char *win_
return 0;
 }
 
-static bool find_existing_ddw(struct device_node *pdn, u64 *dma_addr, int 
*window_shift)
+static bool find_existing_ddw(struct device_node *pdn, u64 *dma_addr, int 
*window_shift,
+ bool *direct_mapping)
 {
struct dma_win *window;
const struct dynamic_dma_window_prop *dma64;
@@ -927,6 +928,7 @@ static bool find_existing_ddw(struct device_node *pdn, u64 
*dma_addr, int *windo
dma64 = window->prop;
*dma_addr = be64_to_cpu(dma64->dma_base);
*window_shift = be32_to_cpu(dma64->window_shift);
+   *direct_mapping = window->direct;
found = true;
break;
}
@@ -1270,8 +1272,7 @@ static bool enable_ddw(struct pci_dev *dev, struct 
device_node *pdn)
 
mutex_lock(_win_init_mutex);
 
-   if (find_existing_ddw(pdn, >dev.archdata.dma_offset, )) {
-   direct_mapping = (len >= max_ram_len);
+   if (find_existing_ddw(pdn, >dev.archdata.dma_offset, , 
_mapping)) {
goto out_unlock;
}
 
-- 
2.39.2 (Apple Git-143)



Re: [PATCH v2 01/15] cdrom: Remove now superfluous sentinel element from ctl_table array

2023-10-02 Thread Phillip Potter
> From: Joel Granados 
>
> This commit comes at the tail end of a greater effort to remove the
> empty elements at the end of the ctl_table arrays (sentinels) which
> will reduce the overall build time size of the kernel and run time
> memory bloat by ~64 bytes per sentinel (further information Link :
> https://lore.kernel.org/all/zo5yx5jfoggi%2f...@bombadil.infradead.org/)
>
> Remove sentinel element from cdrom_table
>
> Signed-off-by: Joel Granados 
> ---
>  drivers/cdrom/cdrom.c | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c
> index cc2839805983..a5e07270e0d4 100644
> --- a/drivers/cdrom/cdrom.c
> +++ b/drivers/cdrom/cdrom.c
> @@ -3655,7 +3655,6 @@ static struct ctl_table cdrom_table[] = {
>   .mode   = 0644,
>   .proc_handler   = cdrom_sysctl_handler
>   },
> - { }
>  };
>  static struct ctl_table_header *cdrom_sysctl_header;
>
>
> -- 
> 2.30.2


Hi Joel,

Looks good to me, many thanks. I'll send on for inclusion.

Reviewed-by: Phillip Potter 

Regards,
Phil


Re: [PATCH v8 20/24] iommu: Require a default_domain for all iommu drivers

2023-10-02 Thread Dmitry Baryshkov
On Wed, 13 Sept 2023 at 16:45, Jason Gunthorpe  wrote:
>
> At this point every iommu driver will cause a default_domain to be
> selected, so we can finally remove this gap from the core code.
>
> The following table explains what each driver supports and what the
> resulting default_domain will be:
>
> ops->defaut_domain
> IDENTITY   DMA  PLATFORMv  ARM32  
> dma-iommu  ARCH
> amd/iommu.c Y   Y   N/A either
> apple-dart.cY   Y   N/A either
> arm-smmu.c  Y   Y   IDENTITYeither
> qcom_iommu.cG   Y   IDENTITYeither
> arm-smmu-v3.c   Y   Y   N/A either
> exynos-iommu.c  G   Y   IDENTITYeither
> fsl_pamu_domain.c   Y   Y   N/A N/A   
>   PLATFORM
> intel/iommu.c   Y   Y   N/A either
> ipmmu-vmsa.cG   Y   IDENTITYeither
> msm_iommu.c G   IDENTITYN/A

Unfortunately this patch breaks msm_iommu platforms. This driver
doesn't select ARM_DMA_USE_IOMMU, so iommu_get_default_domain_type()
returns 0, bus_iommu_probe() fails with -ENODEV.
If I make MSM_IOMMU select ARM_DMA_USE_IOMMU, then GPU probing fails
with -EBUSY.

> mtk_iommu.c G   Y   IDENTITYeither
> mtk_iommu_v1.c  G   IDENTITYN/A
> omap-iommu.cG   IDENTITYN/A
> rockchip-iommu.cG   Y   IDENTITYeither
> s390-iommu.cY   Y   N/A N/A   
>   PLATFORM
> sprd-iommu.cY   N/A DMA
> sun50i-iommu.c  G   Y   IDENTITYeither
> tegra-smmu.cG   Y   IDENTITY
> IDENTITY
> virtio-iommu.c  Y   Y   N/A either
> spapr   Y   Y   N/A N/A   
>   PLATFORM
>  * G means ops->identity_domain is used
>  * N/A means the driver will not compile in this configuration
>
> ARM32 drivers select an IDENTITY default domain through either the
> ops->identity_domain or directly requesting an IDENTIY domain through
> alloc_domain().
>
> In ARM64 mode tegra-smmu will still block the use of dma-iommu.c and
> forces an IDENTITY domain.
>
> S390 uses a PLATFORM domain to represent when the dma_ops are set to the
> s390 iommu code.
>
> fsl_pamu uses an PLATFORM domain.
>
> POWER SPAPR uses PLATFORM and blocking to enable its weird VFIO mode.
>
> The x86 drivers continue unchanged.
>
> After this patch group->default_domain is only NULL for a short period
> during bus iommu probing while all the groups are constituted. Otherwise
> it is always !NULL.
>
> This completes changing the iommu subsystem driver contract to a system
> where the current iommu_domain always represents some form of translation
> and the driver is continuously asserting a definable translation mode.
>
> It resolves the confusion that the original ops->detach_dev() caused
> around what translation, exactly, is the IOMMU performing after
> detach. There were at least three different answers to that question in
> the tree, they are all now clearly named with domain types.
>
> Tested-by: Heiko Stuebner 
> Tested-by: Niklas Schnelle 
> Tested-by: Steven Price 
> Tested-by: Marek Szyprowski 
> Tested-by: Nicolin Chen 
> Reviewed-by: Lu Baolu 
> Reviewed-by: Jerry Snitselaar 
> Signed-off-by: Jason Gunthorpe 
> ---
>  drivers/iommu/iommu.c | 22 +++---
>  1 file changed, 7 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
> index 42a4585dd76da6..cfb597751f5bad 100644
> --- a/drivers/iommu/iommu.c
> +++ b/drivers/iommu/iommu.c
> @@ -1865,7 +1865,6 @@ static int iommu_get_def_domain_type(struct iommu_group 
> *group,
>  static int iommu_get_default_domain_type(struct iommu_group *group,
>  int target_type)
>  {
> -   const struct iommu_ops *ops = group_iommu_ops(group);
> struct device *untrusted = NULL;
> struct group_device *gdev;
> int driver_type = 0;
> @@ -1876,11 +1875,13 @@ static int iommu_get_default_domain_type(struct 
> iommu_group *group,
>  * ARM32 drivers supporting CONFIG_ARM_DMA_USE_IOMMU can declare an
>  * identity_domain and it will automatically become their default
>  * domain. Later on ARM_DMA_USE_IOMMU will install its UNMANAGED 
> domain.
> -* Override the selection to IDENTITY if we are sure the driver 
> 

Re: [PATCH] uapi/auxvec: Define AT_HWCAP3 and AT_HWCAP4 aux vector, entries

2023-10-02 Thread Peter Bergner
Hi Adhemerval, sorry for the delay in replying, I was a little under the
weather last week.


On 9/27/23 11:03 AM, Adhemerval Zanella Netto wrote:
> On 26/09/23 19:02, Peter Bergner wrote:
>> The powerpc toolchain keeps a copy of the HWCAP bit masks in our TCB for fast
>> access by our __builtin_cpu_supports built-in function.  The TCB space for
>> the HWCAP entries - which are created in pairs - is an ABI extension, so
>> waiting to create the space for HWCAP3 and HWCAP4 until we need them is
>> problematical, given distro unwillingness to apply ABI modifying patches
>> to distro point releases.  Define AT_HWCAP3 and AT_HWCAP4 in the generic
>> uapi header so they can be used in GLIBC to reserve space in the powerpc
>> TCB for their future use.
> 
> This is different than previously exported auxv, where each AT_* constant
> would have a auxv entry. On glibc it would require changing _dl_parse_auxv
> to iterate over the auxv_values to find AT_HWCAP3/AT_HWCAP4 (not ideal, 
> but doable).

When you say different, do you mean because all AUXVs exported by the kernel
*will* have an AT_HWCAP and AT_HWCAP2 entry and AT_HWCAP3/AT_HWCAP4 won't?
I don't think that's a problem for either kernel or glibc side of things.
I'm not even sure there is a guarantee that every AT_* value *must* be
present in the exported AUXV.

The new AT_HWCAP3/AT_HWCAP4 defines are less than AT_MINSIGSTKSZ, so they
don't affect the size of _dl_parse_auxv's auxv_values array size and the
AT_HWCAP3 and AT_HWCAP4 entries in auxv_values[] are already initialized
to zero today.  Additionally, the loop in _dl_parse_auxv already parses
the entire AUXV, so there is no extra work for it to do, unless and until
AT_HWCAP3 and AT_HWCAP4 start being exported by the kernel.  Really, the
only extra work _dl_parse_auxv would need to do, is add two new stores:

  GLRO(dl_hwcap3) = auxv_values[AT_HWCAP3];
  GLRO(dl_hwcap4) = auxv_values[AT_HWCAP4];



> Wouldn't be better to always export it on fs/binfmt_elf.c, along with all 
> the machinery to setup it (ELF_HWCAP3, etc), along with proper documentation?

You mean modify the kernel now to export AT_HWCAP3 and AT_HWCAP4 as zero
masks?  Is that really necessary since we don't need or have any features
defined in them yet?  GLIBC's _dl_parse_auxv doesn't really need them to
be exported either, since in the absence of the entries, it will just end
up using zero masks for dl_hwcap3 and dl_hwcap4, so everything is copacetic
even without any kernel changes.

As I mentioned, our real problem is the lead time for getting changes that
affect the user ABI into a distro release, and ppc's copy/cache of the HWCAP
masks is an ABI change.  If we wait to add this support until when we
actually have a need for HWCAP3, then we won't have any support until
the next major distro release.  However, if we can add this support now,
which I don't think is an onerous change on glibc's part, then we can
start using it immediately when Linux starts exporting them.


Peter






Re: [PATCH v7 25/30] dt-bindings: net: Add the Lantiq PEF2256 E1/T1/J1 framer

2023-10-02 Thread Rob Herring


On Thu, 28 Sep 2023 09:06:43 +0200, Herve Codina wrote:
> The Lantiq PEF2256 is a framer and line interface component designed to
> fulfill all required interfacing between an analog E1/T1/J1 line and the
> digital PCM system highway/H.100 bus.
> 
> Signed-off-by: Herve Codina 
> Reviewed-by: Christophe Leroy 
> ---
>  .../bindings/net/lantiq,pef2256.yaml  | 213 ++
>  1 file changed, 213 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/net/lantiq,pef2256.yaml
> 

Reviewed-by: Rob Herring 



Re: [RFC PATCH v5 00/11] Add audio support in v4l2 framework

2023-10-02 Thread Mark Brown
On Thu, Sep 28, 2023 at 05:00:08PM +0800, Shengjiu Wang wrote:
> Audio signal processing also has the requirement for memory to
> memory similar as Video.

> This asrc memory to memory (memory ->asrc->memory) case is a non
> real time use case.

Other than the naming thing I sent in reply to one of the patches the
ASoC bits look fine.


signature.asc
Description: PGP signature


Re: [RFC PATCH v5 01/11] ASoC: fsl_asrc: define functions for memory to memory usage

2023-10-02 Thread Mark Brown
On Thu, Sep 28, 2023 at 05:00:09PM +0800, Shengjiu Wang wrote:

> m2m_start_part_one: first part of the start steps
> m2m_start_part_two: second part of the start steps
> m2m_stop_part_one: first part of stop steps
> m2m_stop_part_two: second part of stop steps, optional

The part_one/two naming isn't amazing here.  Looking at the rest of the
code it looks like this is a prepare/trigger type distinction where the
first part is configuring things prior to DMA setup and the second part
is actually starting the transfer.  Perhaps _config()/_start() instead?


signature.asc
Description: PGP signature


Re: [PATCH v2 11/15] sgi-xp: Remove the now superfluous sentinel element from ctl_table array

2023-10-02 Thread Steve Wahl
On Mon, Oct 02, 2023 at 10:55:28AM +0200, Joel Granados via B4 Relay wrote:
> From: Joel Granados 
> 
> This commit comes at the tail end of a greater effort to remove the
> empty elements at the end of the ctl_table arrays (sentinels) which
> will reduce the overall build time size of the kernel and run time
> memory bloat by ~64 bytes per sentinel (further information Link :
> https://lore.kernel.org/all/zo5yx5jfoggi%2f...@bombadil.infradead.org/)
> 
> Remove sentinel from xpc_sys_xpc_hb and xpc_sys_xpc
> 
> Signed-off-by: Joel Granados 
> ---
>  drivers/misc/sgi-xp/xpc_main.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/misc/sgi-xp/xpc_main.c b/drivers/misc/sgi-xp/xpc_main.c
> index 6da509d692bb..3186421e82c3 100644
> --- a/drivers/misc/sgi-xp/xpc_main.c
> +++ b/drivers/misc/sgi-xp/xpc_main.c
> @@ -110,7 +110,6 @@ static struct ctl_table xpc_sys_xpc_hb[] = {
>.proc_handler = proc_dointvec_minmax,
>.extra1 = _hb_check_min_interval,
>.extra2 = _hb_check_max_interval},
> - {}
>  };
>  static struct ctl_table xpc_sys_xpc[] = {
>   {
> @@ -121,7 +120,6 @@ static struct ctl_table xpc_sys_xpc[] = {
>.proc_handler = proc_dointvec_minmax,
>.extra1 = _disengage_min_timelimit,
>.extra2 = _disengage_max_timelimit},
> - {}
>  };
>  
>  static struct ctl_table_header *xpc_sysctl;
> 
> -- 
> 2.30.2
> 

Reviewed-by: Steve Wahl 

-- 
Steve Wahl, Hewlett Packard Enterprise


Re: (subset) [PATCH 00/40] soc: Convert to platform remove callback returning void

2023-10-02 Thread Nishanth Menon
Hi Uwe Kleine-König,

On Mon, 25 Sep 2023 11:54:51 +0200, Uwe Kleine-König wrote:
> this series converts all platform drivers below drivers/soc to use
> .remove_new(). The motivation is to get rid of an integer return code
> that is (mostly) ignored by the platform driver core and error prone on
> the driver side.
> 
> See commit 5c5a7680e67b ("platform: Provide a remove callback that
> returns no value") for an extended explanation and the eventual goal.
> 
> [...]

I have applied the following to branch ti-drivers-soc-next on [1].
Thank you!

[33/40] soc/ti: k3-ringacc: Convert to platform remove callback returning void
commit: f34b902c5ba67841902cd7f0e24e64bb82f69cb4
[34/40] soc/ti: knav_dma: Convert to platform remove callback returning void
commit: 3af4ec7c7dd39a2c4618f6536b2e7b73a19be169
[35/40] soc/ti: knav_qmss_queue: Convert to platform remove callback returning 
void
commit: af97160a0c5f1908c6f2830023fb93baac4451d3
[36/40] soc/ti: pm33xx: Convert to platform remove callback returning void
commit: 9eb950e9fffc5337bfe1798cf89ce4d97a4f1221
[37/40] soc/ti: pruss: Convert to platform remove callback returning void
commit: d183b20d340b7c098f44cb5c02f4ced01cfd0b16
[38/40] soc/ti: smartreflex: Convert to platform remove callback returning void
commit: ba03aab9bfb4c9d456419da3891375d45c6bfe15
[39/40] soc/ti: wkup_m3_ipc: Convert to platform remove callback returning void
commit: 82e83cb51c87b5bf3ab83f7c7b150c19400056c2

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent up the chain during
the next merge window (or sooner if it is a relevant bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/ti/linux.git
-- 
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 
849D 1736 249D



Re: [PATCH v2 10/15] vrf: Remove the now superfluous sentinel element from ctl_table array

2023-10-02 Thread David Ahern
On 10/2/23 2:55 AM, Joel Granados via B4 Relay wrote:
> From: Joel Granados 
> 
> This commit comes at the tail end of a greater effort to remove the
> empty elements at the end of the ctl_table arrays (sentinels) which
> will reduce the overall build time size of the kernel and run time
> memory bloat by ~64 bytes per sentinel (further information Link :
> https://lore.kernel.org/all/zo5yx5jfoggi%2f...@bombadil.infradead.org/)
> 
> Remove sentinel from vrf_table
> 
> Signed-off-by: Joel Granados 
> ---
>  drivers/net/vrf.c | 1 -
>  1 file changed, 1 deletion(-)
> 

Reviewed-by: David Ahern 




Re: [PATCH v2 00/15] sysctl: Remove sentinel elements from drivers

2023-10-02 Thread Christophe Leroy


Le 02/10/2023 à 10:55, Joel Granados via B4 Relay a écrit :
> From: Joel Granados 
> 
> What?
> These commits remove the sentinel element (last empty element) from the
> sysctl arrays of all the files under the "drivers/" directory that use a
> sysctl array for registration. The merging of the preparation patches
> (in https://lore.kernel.org/all/zo5yx5jfoggi%2f...@bombadil.infradead.org/)
> to mainline allows us to just remove sentinel elements without changing
> behavior (more info here [1]).
> 
> These commits are part of a bigger set (here
> https://github.com/Joelgranados/linux/tree/tag/sysctl_remove_empty_elem_V4)
> that remove the ctl_table sentinel. Make the review process easier by
> chunking the commits into manageable pieces. Each chunk can be reviewed
> separately without noise from parallel sets.
> 
> Now that the architecture chunk has been mostly reviewed [6], we send
> the "drivers/" directory. Once this one is done, it will be follwed by
> "fs/*", "kernel/*", "net/*" and miscellaneous. The final set will remove
> the unneeded check for ->procname == NULL.
> 
> Why?
> By removing the sysctl sentinel elements we avoid kernel bloat as
> ctl_table arrays get moved out of kernel/sysctl.c into their own
> respective subsystems. This move was started long ago to avoid merge
> conflicts; the sentinel removal bit came after Mathew Wilcox suggested
> it to avoid bloating the kernel by one element as arrays moved out. This
> patchset will reduce the overall build time size of the kernel and run
> time memory bloat by about ~64 bytes per declared ctl_table array. I
> have consolidated some links that shed light on the history of this
> effort [2].
> 
> Testing:
> * Ran sysctl selftests (./tools/testing/selftests/sysctl/sysctl.sh)
> * Ran this through 0-day with no errors or warnings
> 
> Size saving after removing all sentinels:
>These are the bytes that we save after removing all the sentinels
>(this plus all the other chunks). I included them to get an idea of
>how much memory we are talking about.
>  * bloat-o-meter:
>  - The "yesall" configuration results save 9158 bytes
>
> https://lore.kernel.org/all/20230621091000.424843-1-j.grana...@samsung.com/
>  - The "tiny" config + CONFIG_SYSCTL save 1215 bytes
>
> https://lore.kernel.org/all/20230809105006.1198165-1-j.grana...@samsung.com/
>  * memory usage:
>  In memory savings are measured to be 7296 bytes. (here is how to
>  measure [3])
> 
> Size saving after this patchset:
>  * bloat-o-meter
>  - The "yesall" config saves 2432 bytes [4]
>  - The "tiny" config saves 64 bytes [5]
>  * memory usage:
>  In this case there were no bytes saved because I do not have any
>  of the drivers in the patch. To measure it comment the printk in
>  `new_dir` and uncomment the if conditional in `new_links` [3].
> 
> ---
> Changes in v2:
> - Left the dangling comma in the ctl_table arrays.
> - Link to v1: 
> https://lore.kernel.org/r/20230928-jag-sysctl_remove_empty_elem_drivers-v1-0-e59120fca...@samsung.com
> 
> Comments/feedback greatly appreciated

Same problem on powerpc CI tests, all boot target failed, most of them 
with similar OOPS, see 
https://patchwork.ozlabs.org/project/linuxppc-dev/patch/20231002-jag-sysctl_remove_empty_elem_drivers-v2-15-02dd0d46f...@samsung.com/

What is strange is that I pushed your series into my github account, and 
got no failure, see https://github.com/chleroy/linux/actions/runs/6378951278

Christophe

> 
> Best
> 
> Joel
> 
> [1]
> We are able to remove a sentinel table without behavioral change by
> introducing a table_size argument in the same place where procname is
> checked for NULL. The idea is for it to keep stopping when it hits
> ->procname == NULL, while the sentinel is still present. And when the
> sentinel is removed, it will stop on the table_size. You can go to
> (https://lore.kernel.org/all/20230809105006.1198165-1-j.grana...@samsung.com/)
> for more information.
> 
> [2]
> Links Related to the ctl_table sentinel removal:
> * Good summary from Luis sent with the "pull request" for the
>preparation patches.
>https://lore.kernel.org/all/zo5yx5jfoggi%2f...@bombadil.infradead.org/
> * Another very good summary from Luis.
>https://lore.kernel.org/all/zmfizkfkvxuft...@bombadil.infradead.org/
> * This is a patch set that replaces register_sysctl_table with register_sysctl
>https://lore.kernel.org/all/20230302204612.782387-1-mcg...@kernel.org/
> * Patch set to deprecate register_sysctl_paths()
>https

Re: [PATCH v4] powerpc: Use shared font data

2023-10-02 Thread Dr. David Alan Gilbert
* Michael Ellerman (m...@ellerman.id.au) wrote:
> "Dr. David Alan Gilbert"  writes:
> > * li...@treblig.org (li...@treblig.org) wrote:
> >> From: "Dr. David Alan Gilbert" 
> >> 
> >> PowerPC has a 'btext' font used for the console which is almost identical
> >> to the shared font_sun8x16, so use it rather than duplicating the data.
> >
> > Hi Michael,
> >   Are you going to pick this up for 6.7?
> 
> Yes I will.

Thanks!

Dave

> cheers
-- 
 -Open up your eyes, open up your mind, open up your code ---   
/ Dr. David Alan Gilbert|   Running GNU/Linux   | Happy  \ 
\dave @ treblig.org |   | In Hex /
 \ _|_ http://www.treblig.org   |___/


Re: [PATCH v7 25/30] dt-bindings: net: Add the Lantiq PEF2256 E1/T1/J1 framer

2023-10-02 Thread Herve Codina
Hi Rob, all,

On Fri, 29 Sep 2023 20:04:44 +0800
kernel test robot  wrote:

> Hi Herve,
> 
> kernel test robot noticed the following build warnings:
> 
> [auto build test WARNING on linus/master]
> [also build test WARNING on v6.6-rc3 next-20230929]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch#_base_tree_information]
> 
> url:
> https://github.com/intel-lab-lkp/linux/commits/Herve-Codina/soc-fsl-cpm1-tsa-Fix-__iomem-addresses-declaration/20230928-151746
> base:   linus/master
> patch link:
> https://lore.kernel.org/r/20230928070652.330429-26-herve.codina%40bootlin.com
> patch subject: [PATCH v7 25/30] dt-bindings: net: Add the Lantiq PEF2256 
> E1/T1/J1 framer
> compiler: loongarch64-linux-gcc (GCC) 13.2.0
> reproduce: 
> (https://download.01.org/0day-ci/archive/20230929/202309291924.obfdyhxb-...@intel.com/reproduce)
> 
> If you fix the issue in a separate patch/commit (i.e. not just a new version 
> of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot 
> | Closes: 
> https://lore.kernel.org/oe-kbuild-all/202309291924.obfdyhxb-...@intel.com/
> 
> dtcheck warnings: (new ones prefixed by >>)
> >> Documentation/devicetree/bindings/net/lantiq,pef2256.yaml: 
> >> properties:lantiq,data-rate-bps: 'oneOf' conditional failed, one must be 
> >> fixed:  
>   'type' is a required property
>   hint: A vendor boolean property can use "type: boolean"
>   Additional properties are not allowed ('default', 'enum' were 
> unexpected)
>   hint: A vendor boolean property can use "type: boolean"
>   Additional properties are not allowed ('default' was unexpected)
>   hint: A vendor string property with exact values has an 
> implicit type
> >>Documentation/devicetree/bindings/net/lantiq,pef2256.yaml: 
> >> properties:lantiq,data-rate-bps: 'oneOf' conditional failed, one must be 
> >> fixed:  
>   '$ref' is a required property
>   'allOf' is a required property
>   hint: A vendor property needs a $ref to types.yaml
>   from schema $id: 
> http://devicetree.org/meta-schemas/vendor-props.yaml#
>   2048000 is not of type 'string'
>   hint: A vendor string property with exact values has an 
> implicit type
>   4096000 is not of type 'string'
>   hint: A vendor string property with exact values has an 
> implicit type
>   8192000 is not of type 'string'
>   hint: A vendor string property with exact values has an 
> implicit type
> 

This issue is related to '-bps' standard suffix not yet available in the
dt-schema release.
The commit adding '-pbs' suffix is
  commit 033d0b1 ("Add '-bps' as a standard unit suffix for bits per second")
present in https://github.com/devicetree-org/dt-schema/

This point was previously discussed with Rob [1] and mentioned in the cover
letter of the series.

[1]: 
https://lore.kernel.org/linux-kernel/CAL_JsqJTruTExc=uhcpcp3q-fo+fb-waj-ggpphpwchsoga...@mail.gmail.com/

Best regards,
Hervé



[PATCH v3 5/7] riscv: Remove now superfluous sentinel element from ctl_table array

2023-10-02 Thread Joel Granados via B4 Relay
From: Joel Granados 

This commit comes at the tail end of a greater effort to remove the
empty elements at the end of the ctl_table arrays (sentinels) which
will reduce the overall build time size of the kernel and run time
memory bloat by ~64 bytes per sentinel (further information Link :
https://lore.kernel.org/all/zo5yx5jfoggi%2f...@bombadil.infradead.org/)

Remove sentinel element from riscv_v_default_vstate_table. This removal
is safe because register_sysctl implicitly uses ARRAY_SIZE() in addition
to checking for the sentinel.

Signed-off-by: Joel Granados 
---
 arch/riscv/kernel/vector.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/riscv/kernel/vector.c b/arch/riscv/kernel/vector.c
index 8d92fb6c522c..578b6292487e 100644
--- a/arch/riscv/kernel/vector.c
+++ b/arch/riscv/kernel/vector.c
@@ -255,7 +255,6 @@ static struct ctl_table riscv_v_default_vstate_table[] = {
.mode   = 0644,
.proc_handler   = proc_dobool,
},
-   { }
 };
 
 static int __init riscv_v_sysctl_init(void)

-- 
2.30.2



[PATCH v3 2/7] arm: Remove now superfluous sentinel elem from ctl_table arrays

2023-10-02 Thread Joel Granados via B4 Relay
From: Joel Granados 

This commit comes at the tail end of a greater effort to remove the
empty elements at the end of the ctl_table arrays (sentinels) which
will reduce the overall build time size of the kernel and run time
memory bloat by ~64 bytes per sentinel (further information Link :
https://lore.kernel.org/all/zo5yx5jfoggi%2f...@bombadil.infradead.org/)

Removed the sentinel as well as the explicit size from ctl_isa_vars. The
size is redundant as the initialization sets it. Changed
insn_emulation->sysctl from a 2 element array of struct ctl_table to a
simple struct. This has no consequence for the sysctl registration as it
is forwarded as a pointer. Removed sentinel from sve_defatul_vl_table,
sme_default_vl_table, tagged_addr_sysctl_table and
armv8_pmu_sysctl_table.

This removal is safe because register_sysctl_sz and register_sysctl use
the array size in addition to checking for the sentinel.

Signed-off-by: Joel Granados 
---
 arch/arm/kernel/isa.c| 4 ++--
 arch/arm64/kernel/armv8_deprecated.c | 8 +++-
 arch/arm64/kernel/fpsimd.c   | 2 --
 arch/arm64/kernel/process.c  | 1 -
 drivers/perf/arm_pmuv3.c | 1 -
 5 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/arch/arm/kernel/isa.c b/arch/arm/kernel/isa.c
index 20218876bef2..905b1b191546 100644
--- a/arch/arm/kernel/isa.c
+++ b/arch/arm/kernel/isa.c
@@ -16,7 +16,7 @@
 
 static unsigned int isa_membase, isa_portbase, isa_portshift;
 
-static struct ctl_table ctl_isa_vars[4] = {
+static struct ctl_table ctl_isa_vars[] = {
{
.procname   = "membase",
.data   = _membase, 
@@ -35,7 +35,7 @@ static struct ctl_table ctl_isa_vars[4] = {
.maxlen = sizeof(isa_portshift),
.mode   = 0444,
.proc_handler   = proc_dointvec,
-   }, {}
+   },
 };
 
 static struct ctl_table_header *isa_sysctl_header;
diff --git a/arch/arm64/kernel/armv8_deprecated.c 
b/arch/arm64/kernel/armv8_deprecated.c
index e459cfd33711..dd6ce86d4332 100644
--- a/arch/arm64/kernel/armv8_deprecated.c
+++ b/arch/arm64/kernel/armv8_deprecated.c
@@ -52,10 +52,8 @@ struct insn_emulation {
int min;
int max;
 
-   /*
-* sysctl for this emulation + a sentinal entry.
-*/
-   struct ctl_table sysctl[2];
+   /* sysctl for this emulation */
+   struct ctl_table sysctl;
 };
 
 #define ARM_OPCODE_CONDTEST_FAIL   0
@@ -558,7 +556,7 @@ static void __init register_insn_emulation(struct 
insn_emulation *insn)
update_insn_emulation_mode(insn, INSN_UNDEF);
 
if (insn->status != INSN_UNAVAILABLE) {
-   sysctl = >sysctl[0];
+   sysctl = >sysctl;
 
sysctl->mode = 0644;
sysctl->maxlen = sizeof(int);
diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c
index 91e44ac7150f..9afd0eb0cf88 100644
--- a/arch/arm64/kernel/fpsimd.c
+++ b/arch/arm64/kernel/fpsimd.c
@@ -589,7 +589,6 @@ static struct ctl_table sve_default_vl_table[] = {
.proc_handler   = vec_proc_do_default_vl,
.extra1 = _info[ARM64_VEC_SVE],
},
-   { }
 };
 
 static int __init sve_sysctl_init(void)
@@ -613,7 +612,6 @@ static struct ctl_table sme_default_vl_table[] = {
.proc_handler   = vec_proc_do_default_vl,
.extra1 = _info[ARM64_VEC_SME],
},
-   { }
 };
 
 static int __init sme_sysctl_init(void)
diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
index 0fcc4eb1a7ab..610e13c3d41b 100644
--- a/arch/arm64/kernel/process.c
+++ b/arch/arm64/kernel/process.c
@@ -724,7 +724,6 @@ static struct ctl_table tagged_addr_sysctl_table[] = {
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE,
},
-   { }
 };
 
 static int __init tagged_addr_init(void)
diff --git a/drivers/perf/arm_pmuv3.c b/drivers/perf/arm_pmuv3.c
index 8fcaa26f0f8a..c0307b9181c3 100644
--- a/drivers/perf/arm_pmuv3.c
+++ b/drivers/perf/arm_pmuv3.c
@@ -1175,7 +1175,6 @@ static struct ctl_table armv8_pmu_sysctl_table[] = {
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE,
},
-   { }
 };
 
 static void armv8_pmu_register_sysctl_table(void)

-- 
2.30.2



[PATCH v3 7/7] c-sky: Remove now superfluous sentinel element from ctl_talbe array

2023-10-02 Thread Joel Granados via B4 Relay
From: Joel Granados 

This commit comes at the tail end of a greater effort to remove the
empty elements at the end of the ctl_table arrays (sentinels) which
will reduce the overall build time size of the kernel and run time
memory bloat by ~64 bytes per sentinel (further information Link :
https://lore.kernel.org/all/zo5yx5jfoggi%2f...@bombadil.infradead.org/)

Remove sentinel from alignment_tbl ctl_table array. This removal is safe
because register_sysctl_init implicitly uses ARRAY_SIZE() in addition to
checking for the sentinel.

Acked-by: Guo Ren 
Signed-off-by: Joel Granados 
---
 arch/csky/abiv1/alignment.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/csky/abiv1/alignment.c b/arch/csky/abiv1/alignment.c
index b60259daed1b..e5b8b4b2109a 100644
--- a/arch/csky/abiv1/alignment.c
+++ b/arch/csky/abiv1/alignment.c
@@ -329,7 +329,6 @@ static struct ctl_table alignment_tbl[5] = {
.mode = 0666,
.proc_handler = _dointvec
},
-   {}
 };
 
 static int __init csky_alignment_init(void)

-- 
2.30.2



[PATCH v3 6/7] powerpc: Remove now superfluous sentinel element from ctl_table arrays

2023-10-02 Thread Joel Granados via B4 Relay
From: Joel Granados 

This commit comes at the tail end of a greater effort to remove the
empty elements at the end of the ctl_table arrays (sentinels) which
will reduce the overall build time size of the kernel and run time
memory bloat by ~64 bytes per sentinel (further information Link :
https://lore.kernel.org/all/zo5yx5jfoggi%2f...@bombadil.infradead.org/)

Remove sentinel from powersave_nap_ctl_table and nmi_wd_lpm_factor_ctl_table.
This removal is safe because register_sysctl implicitly uses ARRAY_SIZE()
in addition to checking for the sentinel.

Signed-off-by: Joel Granados 
---
 arch/powerpc/kernel/idle.c| 1 -
 arch/powerpc/platforms/pseries/mobility.c | 1 -
 2 files changed, 2 deletions(-)

diff --git a/arch/powerpc/kernel/idle.c b/arch/powerpc/kernel/idle.c
index b1c0418b25c8..30b56c67fa61 100644
--- a/arch/powerpc/kernel/idle.c
+++ b/arch/powerpc/kernel/idle.c
@@ -105,7 +105,6 @@ static struct ctl_table powersave_nap_ctl_table[] = {
.mode   = 0644,
.proc_handler   = proc_dointvec,
},
-   {}
 };
 
 static int __init
diff --git a/arch/powerpc/platforms/pseries/mobility.c 
b/arch/powerpc/platforms/pseries/mobility.c
index 0161226d8fec..1798f0f14d58 100644
--- a/arch/powerpc/platforms/pseries/mobility.c
+++ b/arch/powerpc/platforms/pseries/mobility.c
@@ -61,7 +61,6 @@ static struct ctl_table nmi_wd_lpm_factor_ctl_table[] = {
.mode   = 0644,
.proc_handler   = proc_douintvec_minmax,
},
-   {}
 };
 
 static int __init register_nmi_wd_lpm_factor_sysctl(void)

-- 
2.30.2



[PATCH v3 4/7] x86/vdso: Remove now superfluous sentinel element from ctl_table array

2023-10-02 Thread Joel Granados via B4 Relay
From: Joel Granados 

This commit comes at the tail end of a greater effort to remove the
empty elements at the end of the ctl_table arrays (sentinels) which
will reduce the overall build time size of the kernel and run time
memory bloat by ~64 bytes per sentinel (further information Link :
https://lore.kernel.org/all/zo5yx5jfoggi%2f...@bombadil.infradead.org/)

Remove sentinel element from abi_table2. This removal is safe because
register_sysctl implicitly uses ARRAY_SIZE() in addition to checking for
the sentinel.

Signed-off-by: Joel Granados 
---
 arch/x86/entry/vdso/vdso32-setup.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/x86/entry/vdso/vdso32-setup.c 
b/arch/x86/entry/vdso/vdso32-setup.c
index f3b3cacbcbb0..76e4e74f35b5 100644
--- a/arch/x86/entry/vdso/vdso32-setup.c
+++ b/arch/x86/entry/vdso/vdso32-setup.c
@@ -67,7 +67,6 @@ static struct ctl_table abi_table2[] = {
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE,
},
-   {}
 };
 
 static __init int ia32_binfmt_init(void)

-- 
2.30.2



[PATCH v3 3/7] arch/x86: Remove now superfluous sentinel elem from ctl_table arrays

2023-10-02 Thread Joel Granados via B4 Relay
From: Joel Granados 

This commit comes at the tail end of a greater effort to remove the
empty elements at the end of the ctl_table arrays (sentinels) which
will reduce the overall build time size of the kernel and run time
memory bloat by ~64 bytes per sentinel (further information Link :
https://lore.kernel.org/all/zo5yx5jfoggi%2f...@bombadil.infradead.org/)

Remove sentinel element from sld_sysctl and itmt_kern_table. This
removal is safe because register_sysctl_init and register_sysctl
implicitly use the array size in addition to checking for the sentinel.

Reviewed-by: Ingo Molnar 
Acked-by: Dave Hansen  # for x86
Signed-off-by: Joel Granados 
---
 arch/x86/kernel/cpu/intel.c | 1 -
 arch/x86/kernel/itmt.c  | 1 -
 2 files changed, 2 deletions(-)

diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
index be4045628fd3..d9bb53f49a4d 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -1016,7 +1016,6 @@ static struct ctl_table sld_sysctls[] = {
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE,
},
-   {}
 };
 
 static int __init sld_mitigate_sysctl_init(void)
diff --git a/arch/x86/kernel/itmt.c b/arch/x86/kernel/itmt.c
index ee4fe8cdb857..9a7c03d47861 100644
--- a/arch/x86/kernel/itmt.c
+++ b/arch/x86/kernel/itmt.c
@@ -74,7 +74,6 @@ static struct ctl_table itmt_kern_table[] = {
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE,
},
-   {}
 };
 
 static struct ctl_table_header *itmt_sysctl_header;

-- 
2.30.2



[PATCH v3 1/7] S390: Remove now superfluous sentinel elem from ctl_table arrays

2023-10-02 Thread Joel Granados via B4 Relay
From: Joel Granados 

This commit comes at the tail end of a greater effort to remove the
empty elements at the end of the ctl_table arrays (sentinels) which will
reduce the overall build time size of the kernel and run time memory
bloat by ~64 bytes per sentinel (further information Link :
https://lore.kernel.org/all/zo5yx5jfoggi%2f...@bombadil.infradead.org/)

Remove the sentinel element from appldata_table, s390dbf_table,
topology_ctl_table, cmm_table and page_table_sysctl. Reduced the memory
allocation in appldata_register_ops by 1 effectively removing the
sentinel from ops->ctl_table.

This removal is safe because register_sysctl_sz and register_sysctl use
the array size in addition to checking for the sentinel.

Tested-by: Alexander Gordeev 
Acked-by: Heiko Carstens 
Signed-off-by: Joel Granados 
---
 arch/s390/appldata/appldata_base.c | 4 +---
 arch/s390/kernel/debug.c   | 1 -
 arch/s390/kernel/topology.c| 1 -
 arch/s390/mm/cmm.c | 1 -
 arch/s390/mm/pgalloc.c | 1 -
 5 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/arch/s390/appldata/appldata_base.c 
b/arch/s390/appldata/appldata_base.c
index 3b0994625652..c2978cb03b36 100644
--- a/arch/s390/appldata/appldata_base.c
+++ b/arch/s390/appldata/appldata_base.c
@@ -63,7 +63,6 @@ static struct ctl_table appldata_table[] = {
.mode   = S_IRUGO | S_IWUSR,
.proc_handler   = appldata_interval_handler,
},
-   { },
 };
 
 /*
@@ -351,8 +350,7 @@ int appldata_register_ops(struct appldata_ops *ops)
if (ops->size > APPLDATA_MAX_REC_SIZE)
return -EINVAL;
 
-   /* The last entry must be an empty one */
-   ops->ctl_table = kcalloc(2, sizeof(struct ctl_table), GFP_KERNEL);
+   ops->ctl_table = kcalloc(1, sizeof(struct ctl_table), GFP_KERNEL);
if (!ops->ctl_table)
return -ENOMEM;
 
diff --git a/arch/s390/kernel/debug.c b/arch/s390/kernel/debug.c
index a85e0c3e7027..85328a0ef3b6 100644
--- a/arch/s390/kernel/debug.c
+++ b/arch/s390/kernel/debug.c
@@ -978,7 +978,6 @@ static struct ctl_table s390dbf_table[] = {
.mode   = S_IRUGO | S_IWUSR,
.proc_handler   = s390dbf_procactive,
},
-   { }
 };
 
 static struct ctl_table_header *s390dbf_sysctl_header;
diff --git a/arch/s390/kernel/topology.c b/arch/s390/kernel/topology.c
index 68adf1de..be8467b25953 100644
--- a/arch/s390/kernel/topology.c
+++ b/arch/s390/kernel/topology.c
@@ -636,7 +636,6 @@ static struct ctl_table topology_ctl_table[] = {
.mode   = 0644,
.proc_handler   = topology_ctl_handler,
},
-   { },
 };
 
 static int __init topology_init(void)
diff --git a/arch/s390/mm/cmm.c b/arch/s390/mm/cmm.c
index f47515313226..f8b13f247646 100644
--- a/arch/s390/mm/cmm.c
+++ b/arch/s390/mm/cmm.c
@@ -332,7 +332,6 @@ static struct ctl_table cmm_table[] = {
.mode   = 0644,
.proc_handler   = cmm_timeout_handler,
},
-   { }
 };
 
 #ifdef CONFIG_CMM_IUCV
diff --git a/arch/s390/mm/pgalloc.c b/arch/s390/mm/pgalloc.c
index 07fc660a24aa..75e1039f2ec5 100644
--- a/arch/s390/mm/pgalloc.c
+++ b/arch/s390/mm/pgalloc.c
@@ -30,7 +30,6 @@ static struct ctl_table page_table_sysctl[] = {
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE,
},
-   { }
 };
 
 static int __init page_table_register_sysctl(void)

-- 
2.30.2



[PATCH v3 0/7] sysctl: Remove sentinel elements from arch

2023-10-02 Thread Joel Granados via B4 Relay
From: Joel Granados 

What?
These commits remove the sentinel element (last empty element) from the
sysctl arrays of all the files under the "arch/" directory that use a
sysctl array for registration. The merging of the preparation patches
(in https://lore.kernel.org/all/zo5yx5jfoggi%2f...@bombadil.infradead.org/)
to mainline allows us to just remove sentinel elements without changing
behavior. This is now safe because the sysctl registration code
(register_sysctl() and friends) use the array size in addition to
checking for a sentinel ([1] for more info).

These commits are part of a bigger set (bigger patchset here
https://github.com/Joelgranados/linux/tree/tag/sysctl_remove_empty_elem_V4)
that remove the ctl_table sentinel. The idea is to make the review
process easier by chunking the 52 commits into manageable pieces. By
sending out one chunk at a time, they can be reviewed separately without
noise from parallel sets. After the "arch/" commits in this set are
reviewed, I will continue with drivers/*, fs/*, kernel/*, net/* and
miscellaneous. The final set will remove the unneeded check for
->procname == NULL.

Why?
By removing the sysctl sentinel elements we avoid kernel bloat as
ctl_table arrays get moved out of kernel/sysctl.c into their own
respective subsystems. This move was started long ago to avoid merge
conflicts; the sentinel removal bit came after Mathew Wilcox suggested
it to avoid bloating the kernel by one element as arrays moved out. This
patchset will reduce the overall build time size of the kernel and run
time memory bloat by about ~64 bytes per declared ctl_table array. I
have consolidated some links that shed light on the history of this
effort [2].

V2:
* Added clarification both in the commit messages and the coverletter as
  to why this patch is safe to apply.
* Added {Acked,Reviewed,Tested}-by from list
* Link to v1: 
https://lore.kernel.org/r/20230906-jag-sysctl_remove_empty_elem_arch-v1-0-3935d4854...@samsung.com

V3:
* Removed the ia64 patch to avoid conflicts with the ia64 removal
* Rebased onto v6.6-rc4
* Kept/added the trailing comma for the ctl_table arrays. This was a comment
  that we received "drivers/*" patch set.
* Link to v2: 
https://lore.kernel.org/r/20230913-jag-sysctl_remove_empty_elem_arch-v2-0-d1bd13a29...@samsung.com

Testing:
* Ran sysctl selftests (./tools/testing/selftests/sysctl/sysctl.sh)
* Ran this through 0-day with no errors or warnings

Size saving after removing all sentinels:
  A consequence of eventually removing all the sentinels (64 bytes per
  sentinel) is the bytes we save. These are *not* numbers that we will
  get after this patch set; these are the numbers that we will get after
  removing all the sentinels. I included them here because they are
  relevant and to get an idea of just how much memory we are talking
  about.
* bloat-o-meter:
- The "yesall" configuration results save 9158 bytes (bloat-o-meter 
output here
  
https://lore.kernel.org/all/20230621091000.424843-1-j.grana...@samsung.com/)
- The "tiny" config + CONFIG_SYSCTL save 1215 bytes (bloat-o-meter 
output here
  
https://lore.kernel.org/all/20230809105006.1198165-1-j.grana...@samsung.com/)
* memory usage:
we save some bytes in main memory as well. In my testing kernel
I measured a difference of 7296 bytes. I include the way to
measure in [3]

Size saving after this patchset:
  Here I give the values that I measured for the architecture that I'm
  running (x86_64). This can give an approximation of how many bytes are
  saved for each arch. I won't publish for all the archs because I don't
  have access to all of them.
* bloat-o-meter
- The "yesall" config saves 192 bytes (bloat-o-meter output [4])
- The "tiny" config saves 64 bytes (bloat-o-meter output [5])
* memory usage:
In this case there were no bytes saved. To measure it comment the
printk in `new_dir` and uncomment the if conditional in `new_links`
[3].

Comments/feedback greatly appreciated

Best
Joel

[1]
https://lore.kernel.org/all/20230809105006.1198165-1-j.grana...@samsung.com/

[2]
Links Related to the ctl_table sentinel removal:
* Good summary from Luis sent with the "pull request" for the
  preparation patches.
  https://lore.kernel.org/all/zo5yx5jfoggi%2f...@bombadil.infradead.org/
* Another very good summary from Luis.
  https://lore.kernel.org/all/zmfizkfkvxuft...@bombadil.infradead.org/
* This is a patch set that replaces register_sysctl_table with register_sysctl
  https://lore.kernel.org/all/20230302204612.782387-1-mcg...@kernel.org/
* Patch set to deprecate register_sysctl_paths()
  https://lore.kernel.org/all/20230302202826.776286-1-mcg...@kernel.org/
* Here there is an explicit expectation for the removal of the sentinel element.
  https://lore.kernel.org/all/20230321130908.6972-1-frank...@vivo.com
* The "ARRAY_SIZE" approach was mentioned (proposed?) in this thread
  

Re: [PATCH v6 4/9] mm: thp: Introduce anon_orders and anon_always_mask sysfs files

2023-10-02 Thread Ryan Roberts
On 29/09/2023 23:55, Andrew Morton wrote:
> On Fri, 29 Sep 2023 12:44:15 +0100 Ryan Roberts  wrote:
> 
>> In preparation for adding support for anonymous large folios that are
>> smaller than the PMD-size, introduce 2 new sysfs files that will be used
>> to control the new behaviours via the transparent_hugepage interface.
>> For now, the kernel still only supports PMD-order anonymous THP, so when
>> reading back anon_orders, it will reflect that. Therefore there are no
>> behavioural changes intended here.
> 
> powerpc strikes again.  ARCH=powerpc allmodconfig:
> 
> 
> In file included from ./include/linux/bits.h:6,
>  from ./include/linux/ratelimit_types.h:5,
>  from ./include/linux/printk.h:9,
>  from ./include/asm-generic/bug.h:22,
>  from ./arch/powerpc/include/asm/bug.h:116,
>  from ./include/linux/bug.h:5,
>  from ./include/linux/mmdebug.h:5,
>  from ./include/linux/mm.h:6,
>  from mm/huge_memory.c:8:
> ./include/vdso/bits.h:7:33: error: initializer element is not constant
> 7 | #define BIT(nr) (UL(1) << (nr))
>   | ^
> mm/huge_memory.c:77:47: note: in expansion of macro 'BIT'
>77 | unsigned int huge_anon_orders __read_mostly = BIT(PMD_ORDER);
>   |   ^~~

Ahh my bad, sorry about that - I built various configs and arches but not 
powerpc.

> 
> We keep tripping over this.  I wish there was a way to fix it.
> 
> 
> 
> Style whine: an all-caps identifier is supposed to be a constant,
> dammit.
> 
>   #define PTE_INDEX_SIZE  __pte_index_size
> 
> Nope.
> 
> 
> 
> I did this:
> 
> --- 
> a/mm/huge_memory.c~mm-thp-introduce-anon_orders-and-anon_always_mask-sysfs-files-fix
> +++ a/mm/huge_memory.c
> @@ -74,7 +74,7 @@ static unsigned long deferred_split_scan
>  static atomic_t huge_zero_refcount;
>  struct page *huge_zero_page __read_mostly;
>  unsigned long huge_zero_pfn __read_mostly = ~0UL;
> -unsigned int huge_anon_orders __read_mostly = BIT(PMD_ORDER);
> +unsigned int huge_anon_orders __read_mostly;
>  static unsigned int huge_anon_always_mask __read_mostly;
>  
>  /**
> @@ -528,6 +528,9 @@ static int __init hugepage_init_sysfs(st
>  {
>   int err;
>  
> + /* powerpc's PMD_ORDER isn't a compile-time constant */
> + huge_anon_orders = BIT(PMD_ORDER);
> +
>   *hugepage_kobj = kobject_create_and_add("transparent_hugepage", 
> mm_kobj);
>   if (unlikely(!*hugepage_kobj)) {
>   pr_err("failed to create transparent hugepage kobject\n");
> _
> 
> 
> I assume this is set up early enough.

Yes this should be fine.

> 
> I don't know why powerpc's PTE_INDEX_SIZE is variable.  Hopefully it
> has been set up by this time and it won't get altered.  

Looks that way from the code; its set during early_init_mmu().

Anyway, I'll take the fix into my next spin if I need to do one. I see you've
taken it into mm-unstable - thanks! But given I'm introducing UABI, I was
expecting some comments and a probably need for a new rev. I'd like to think we
are getting there though.

Thanks,
Ryan



Re: [PATCH 00/15] sysctl: Remove sentinel elements from drivers

2023-10-02 Thread Christophe Leroy


Le 02/10/2023 à 10:47, Joel Granados a écrit :
> On Thu, Sep 28, 2023 at 04:31:30PM +, Christophe Leroy wrote:

> I followed this trace and proc_handler is correctly defined in tty_table
> (struct ctl_table) in drivers/tty/tty_io.c:tty_init and there is not
> path that changes these values.
> Additionally, we then fail trying to print instead of continuing with
> the initialization. My conjecture is that this might be due to something
> different than tht sysctl register call.
> 
> Does this happen consistenly or is this just a one off issue?

Don't know.

> 
> To what branch are these patches being applied to?

As far as I understand from 
https://github.com/linuxppc/linux-snowpatch/commits/snowpatch/375319, 
it's being applied on 
https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/commit/?id=d774975


> 
> I'm going to post my V2 and keep working on this issue if it pops up
> again.
> 

Christophe


Re: [PATCH 04/15] tty: Remove now superfluous sentinel element from ctl_table array

2023-10-02 Thread Greg Kroah-Hartman
On Mon, Oct 02, 2023 at 08:47:53AM +, Christophe Leroy wrote:
> 
> 
> Le 02/10/2023 à 10:17, Jiri Slaby a écrit :
> > On 28. 09. 23, 15:21, Joel Granados via B4 Relay wrote:
> >> From: Joel Granados 
> >>
> >> This commit comes at the tail end of a greater effort to remove the
> >> empty elements at the end of the ctl_table arrays (sentinels) which
> >> will reduce the overall build time size of the kernel and run time
> >> memory bloat by ~64 bytes per sentinel (further information Link :
> >> https://lore.kernel.org/all/zo5yx5jfoggi%2f...@bombadil.infradead.org/)
> >>
> >> Remove sentinel from tty_table
> >>
> >> Signed-off-by: Joel Granados 
> >> ---
> >>   drivers/tty/tty_io.c | 3 +--
> >>   1 file changed, 1 insertion(+), 2 deletions(-)
> >>
> >> diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
> >> index 8a94e5a43c6d..2f925dc54a20 100644
> >> --- a/drivers/tty/tty_io.c
> >> +++ b/drivers/tty/tty_io.c
> >> @@ -3607,8 +3607,7 @@ static struct ctl_table tty_table[] = {
> >>   .proc_handler    = proc_dointvec,
> >>   .extra1    = SYSCTL_ZERO,
> >>   .extra2    = SYSCTL_ONE,
> >> -    },
> >> -    { }
> >> +    }
> > 
> > Why to remove the comma? One would need to add one when adding a new entry?
> 
> Does it make any difference at all ?
> 
> In one case you have:
> 
> @
>   something old,
>   },
> + {
> + something new,
> + },
>   }
> 
> In the other case you have:
> 
> @
>   something old,
> + },
> + {
> + something new,
>   }
>   }

Because that way it is obvious you are only touching the "something new"
lines and never have to touch the "something old" ones.

It's just a long-standing tradition in Linux, don't have an extra
character if you don't need it :)

thanks,

greg k-h


Re: [PATCH v2 04/15] tty: Remove now superfluous sentinel element from ctl_table array

2023-10-02 Thread Jiri Slaby

On 02. 10. 23, 10:55, Joel Granados via B4 Relay wrote:

From: Joel Granados 

This commit comes at the tail end of a greater effort to remove the
empty elements at the end of the ctl_table arrays (sentinels) which
will reduce the overall build time size of the kernel and run time
memory bloat by ~64 bytes per sentinel (further information Link :
https://lore.kernel.org/all/zo5yx5jfoggi%2f...@bombadil.infradead.org/)

Remove sentinel from tty_table

Signed-off-by: Joel Granados 


Reviewed-by: Jiri Slaby 

thanks,
--
js
suse labs



[PATCH v2 10/15] vrf: Remove the now superfluous sentinel element from ctl_table array

2023-10-02 Thread Joel Granados via B4 Relay
From: Joel Granados 

This commit comes at the tail end of a greater effort to remove the
empty elements at the end of the ctl_table arrays (sentinels) which
will reduce the overall build time size of the kernel and run time
memory bloat by ~64 bytes per sentinel (further information Link :
https://lore.kernel.org/all/zo5yx5jfoggi%2f...@bombadil.infradead.org/)

Remove sentinel from vrf_table

Signed-off-by: Joel Granados 
---
 drivers/net/vrf.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
index a3408e4e1491..db766941b78f 100644
--- a/drivers/net/vrf.c
+++ b/drivers/net/vrf.c
@@ -1963,7 +1963,6 @@ static const struct ctl_table vrf_table[] = {
/* set by the vrf_netns_init */
.extra1 = NULL,
},
-   { },
 };
 
 static int vrf_netns_init_sysctl(struct net *net, struct netns_vrf *nn_vrf)

-- 
2.30.2



[PATCH v2 14/15] Drivers: hv: Remove now superfluous sentinel element from ctl_table array

2023-10-02 Thread Joel Granados via B4 Relay
From: Joel Granados 

This commit comes at the tail end of a greater effort to remove the
empty elements at the end of the ctl_table arrays (sentinels) which
will reduce the overall build time size of the kernel and run time
memory bloat by ~64 bytes per sentinel (further information Link :
https://lore.kernel.org/all/zo5yx5jfoggi%2f...@bombadil.infradead.org/)

Remove sentinel from hv_ctl_table

Signed-off-by: Joel Granados 
---
 drivers/hv/hv_common.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/hv/hv_common.c b/drivers/hv/hv_common.c
index ccad7bca3fd3..4372f5d146ab 100644
--- a/drivers/hv/hv_common.c
+++ b/drivers/hv/hv_common.c
@@ -148,7 +148,6 @@ static struct ctl_table hv_ctl_table[] = {
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE
},
-   {}
 };
 
 static int hv_die_panic_notify_crash(struct notifier_block *self,

-- 
2.30.2



[PATCH v2 15/15] intel drm: Remove now superfluous sentinel element from ctl_table array

2023-10-02 Thread Joel Granados via B4 Relay
From: Joel Granados 

This commit comes at the tail end of a greater effort to remove the
empty elements at the end of the ctl_table arrays (sentinels) which
will reduce the overall build time size of the kernel and run time
memory bloat by ~64 bytes per sentinel (further information Link :
https://lore.kernel.org/all/zo5yx5jfoggi%2f...@bombadil.infradead.org/)

Remove sentinel from oa_table

Signed-off-by: Joel Granados 
---
 drivers/gpu/drm/i915/i915_perf.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c
index 04bc1f4a1115..23e769aa214c 100644
--- a/drivers/gpu/drm/i915/i915_perf.c
+++ b/drivers/gpu/drm/i915/i915_perf.c
@@ -4896,7 +4896,6 @@ static struct ctl_table oa_table[] = {
 .extra1 = SYSCTL_ZERO,
 .extra2 = _sample_rate_hard_limit,
 },
-   {}
 };
 
 static u32 num_perf_groups_per_gt(struct intel_gt *gt)

-- 
2.30.2



[PATCH v2 11/15] sgi-xp: Remove the now superfluous sentinel element from ctl_table array

2023-10-02 Thread Joel Granados via B4 Relay
From: Joel Granados 

This commit comes at the tail end of a greater effort to remove the
empty elements at the end of the ctl_table arrays (sentinels) which
will reduce the overall build time size of the kernel and run time
memory bloat by ~64 bytes per sentinel (further information Link :
https://lore.kernel.org/all/zo5yx5jfoggi%2f...@bombadil.infradead.org/)

Remove sentinel from xpc_sys_xpc_hb and xpc_sys_xpc

Signed-off-by: Joel Granados 
---
 drivers/misc/sgi-xp/xpc_main.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/misc/sgi-xp/xpc_main.c b/drivers/misc/sgi-xp/xpc_main.c
index 6da509d692bb..3186421e82c3 100644
--- a/drivers/misc/sgi-xp/xpc_main.c
+++ b/drivers/misc/sgi-xp/xpc_main.c
@@ -110,7 +110,6 @@ static struct ctl_table xpc_sys_xpc_hb[] = {
 .proc_handler = proc_dointvec_minmax,
 .extra1 = _hb_check_min_interval,
 .extra2 = _hb_check_max_interval},
-   {}
 };
 static struct ctl_table xpc_sys_xpc[] = {
{
@@ -121,7 +120,6 @@ static struct ctl_table xpc_sys_xpc[] = {
 .proc_handler = proc_dointvec_minmax,
 .extra1 = _disengage_min_timelimit,
 .extra2 = _disengage_max_timelimit},
-   {}
 };
 
 static struct ctl_table_header *xpc_sysctl;

-- 
2.30.2



[PATCH v2 13/15] raid: Remove now superfluous sentinel element from ctl_table array

2023-10-02 Thread Joel Granados via B4 Relay
From: Joel Granados 

This commit comes at the tail end of a greater effort to remove the
empty elements at the end of the ctl_table arrays (sentinels) which
will reduce the overall build time size of the kernel and run time
memory bloat by ~64 bytes per sentinel (further information Link :
https://lore.kernel.org/all/zo5yx5jfoggi%2f...@bombadil.infradead.org/)

Remove sentinel from raid_table

Signed-off-by: Joel Granados 
---
 drivers/md/md.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/md/md.c b/drivers/md/md.c
index a104a025084d..3bdff9e03188 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -305,7 +305,6 @@ static struct ctl_table raid_table[] = {
.mode   = S_IRUGO|S_IWUSR,
.proc_handler   = proc_dointvec,
},
-   { }
 };
 
 static int start_readonly;

-- 
2.30.2



[PATCH v2 12/15] fw loader: Remove the now superfluous sentinel element from ctl_table array

2023-10-02 Thread Joel Granados via B4 Relay
From: Joel Granados 

This commit comes at the tail end of a greater effort to remove the
empty elements at the end of the ctl_table arrays (sentinels) which
will reduce the overall build time size of the kernel and run time
memory bloat by ~64 bytes per sentinel (further information Link :
https://lore.kernel.org/all/zo5yx5jfoggi%2f...@bombadil.infradead.org/)

Remove sentinel from firmware_config_table

Signed-off-by: Joel Granados 
---
 drivers/base/firmware_loader/fallback_table.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/base/firmware_loader/fallback_table.c 
b/drivers/base/firmware_loader/fallback_table.c
index e5ac098d0742..8432ab2c3b3c 100644
--- a/drivers/base/firmware_loader/fallback_table.c
+++ b/drivers/base/firmware_loader/fallback_table.c
@@ -44,7 +44,6 @@ static struct ctl_table firmware_config_table[] = {
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE,
},
-   { }
 };
 
 static struct ctl_table_header *firmware_config_sysct_table_header;

-- 
2.30.2



[PATCH v2 04/15] tty: Remove now superfluous sentinel element from ctl_table array

2023-10-02 Thread Joel Granados via B4 Relay
From: Joel Granados 

This commit comes at the tail end of a greater effort to remove the
empty elements at the end of the ctl_table arrays (sentinels) which
will reduce the overall build time size of the kernel and run time
memory bloat by ~64 bytes per sentinel (further information Link :
https://lore.kernel.org/all/zo5yx5jfoggi%2f...@bombadil.infradead.org/)

Remove sentinel from tty_table

Signed-off-by: Joel Granados 
---
 drivers/tty/tty_io.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index 8a94e5a43c6d..b3ae062912f5 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -3608,7 +3608,6 @@ static struct ctl_table tty_table[] = {
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE,
},
-   { }
 };
 
 /*

-- 
2.30.2



[PATCH v2 05/15] scsi: Remove now superfluous sentinel element from ctl_table array

2023-10-02 Thread Joel Granados via B4 Relay
From: Joel Granados 

This commit comes at the tail end of a greater effort to remove the
empty elements at the end of the ctl_table arrays (sentinels) which
will reduce the overall build time size of the kernel and run time
memory bloat by ~64 bytes per sentinel (further information Link :
https://lore.kernel.org/all/zo5yx5jfoggi%2f...@bombadil.infradead.org/)

Remove sentinel from scsi_table and sg_sysctls.

Signed-off-by: Joel Granados 
---
 drivers/scsi/scsi_sysctl.c | 1 -
 drivers/scsi/sg.c  | 1 -
 2 files changed, 2 deletions(-)

diff --git a/drivers/scsi/scsi_sysctl.c b/drivers/scsi/scsi_sysctl.c
index 7f0914ea168f..093774d77534 100644
--- a/drivers/scsi/scsi_sysctl.c
+++ b/drivers/scsi/scsi_sysctl.c
@@ -18,7 +18,6 @@ static struct ctl_table scsi_table[] = {
  .maxlen   = sizeof(scsi_logging_level),
  .mode = 0644,
  .proc_handler = proc_dointvec },
-   { }
 };
 
 static struct ctl_table_header *scsi_table_header;
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index 0d8afffd1683..86210e4dd0d3 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -1650,7 +1650,6 @@ static struct ctl_table sg_sysctls[] = {
.mode   = 0444,
.proc_handler   = proc_dointvec,
},
-   {}
 };
 
 static struct ctl_table_header *hdr;

-- 
2.30.2



[PATCH v2 07/15] macintosh: Remove the now superfluous sentinel element from ctl_table array

2023-10-02 Thread Joel Granados via B4 Relay
From: Joel Granados 

This commit comes at the tail end of a greater effort to remove the
empty elements at the end of the ctl_table arrays (sentinels) which
will reduce the overall build time size of the kernel and run time
memory bloat by ~64 bytes per sentinel (further information Link :
https://lore.kernel.org/all/zo5yx5jfoggi%2f...@bombadil.infradead.org/)

Remove sentinel from mac_hid_files

Signed-off-by: Joel Granados 
---
 drivers/macintosh/mac_hid.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/macintosh/mac_hid.c b/drivers/macintosh/mac_hid.c
index d8c4d5664145..1ae3539beff5 100644
--- a/drivers/macintosh/mac_hid.c
+++ b/drivers/macintosh/mac_hid.c
@@ -236,7 +236,6 @@ static struct ctl_table mac_hid_files[] = {
.mode   = 0644,
.proc_handler   = proc_dointvec,
},
-   { }
 };
 
 static struct ctl_table_header *mac_hid_sysctl_header;

-- 
2.30.2



[PATCH v2 06/15] parport: Remove the now superfluous sentinel element from ctl_table array

2023-10-02 Thread Joel Granados via B4 Relay
From: Joel Granados 

This commit comes at the tail end of a greater effort to remove the
empty elements at the end of the ctl_table arrays (sentinels) which
will reduce the overall build time size of the kernel and run time
memory bloat by ~64 bytes per sentinel (further information Link :
https://lore.kernel.org/all/zo5yx5jfoggi%2f...@bombadil.infradead.org/)

Remove the unneeded ctl_tables that were used to register intermediate
parport directories; only the path is needed at this point. From
parport_device_sysctl_table we removed: devices_root_dir, port_dir,
parport_dir and dev_dir. From parport_default_sysctl_table we removed:
default_dir, parport_dir and dev_dir. Reduce the size by one of the
ctl_table arrays that were not removed

Assign different sizes to the vars array in parport_sysctl_table
depending on CONFIG_PARPORT_1284; this is necessary now that the sysctl
register function uses ARRAY_SIZE to calculate the elements within.
Remove the sentinel element from parport_sysctl_template,
parport_device_sysctl_table and parport_default_sysctl_table.

Signed-off-by: Joel Granados 
---
 drivers/parport/procfs.c | 28 +++-
 1 file changed, 11 insertions(+), 17 deletions(-)

diff --git a/drivers/parport/procfs.c b/drivers/parport/procfs.c
index 4e5b972c3e26..532d5cbbd344 100644
--- a/drivers/parport/procfs.c
+++ b/drivers/parport/procfs.c
@@ -259,8 +259,12 @@ PARPORT_MAX_SPINTIME_VALUE;
 struct parport_sysctl_table {
struct ctl_table_header *port_header;
struct ctl_table_header *devices_header;
-   struct ctl_table vars[12];
-   struct ctl_table device_dir[2];
+#ifdef CONFIG_PARPORT_1284
+   struct ctl_table vars[10];
+#else
+   struct ctl_table vars[5];
+#endif /* IEEE 1284 support */
+   struct ctl_table device_dir[1];
 };
 
 static const struct parport_sysctl_table parport_sysctl_template = {
@@ -341,7 +345,6 @@ static const struct parport_sysctl_table 
parport_sysctl_template = {
.proc_handler   = do_autoprobe
},
 #endif /* IEEE 1284 support */
-   {}
},
{
{
@@ -351,19 +354,14 @@ static const struct parport_sysctl_table 
parport_sysctl_template = {
.mode   = 0444,
.proc_handler   = do_active_device
},
-   {}
},
 };
 
 struct parport_device_sysctl_table
 {
struct ctl_table_header *sysctl_header;
-   struct ctl_table vars[2];
-   struct ctl_table device_dir[2];
-   struct ctl_table devices_root_dir[2];
-   struct ctl_table port_dir[2];
-   struct ctl_table parport_dir[2];
-   struct ctl_table dev_dir[2];
+   struct ctl_table vars[1];
+   struct ctl_table device_dir[1];
 };
 
 static const struct parport_device_sysctl_table
@@ -379,7 +377,6 @@ parport_device_sysctl_template = {
.extra1 = (void*) _min_timeslice_value,
.extra2 = (void*) _max_timeslice_value
},
-   {}
},
{
{
@@ -388,17 +385,13 @@ parport_device_sysctl_template = {
.maxlen = 0,
.mode   = 0555,
},
-   {}
}
 };
 
 struct parport_default_sysctl_table
 {
struct ctl_table_header *sysctl_header;
-   struct ctl_table vars[3];
-   struct ctl_table default_dir[2];
-   struct ctl_table parport_dir[2];
-   struct ctl_table dev_dir[2];
+   struct ctl_table vars[2];
 };
 
 static struct parport_default_sysctl_table
@@ -423,7 +416,6 @@ parport_default_sysctl_table = {
.extra1 = (void*) _min_spintime_value,
.extra2 = (void*) _max_spintime_value
},
-   {}
}
 };
 
@@ -443,7 +435,9 @@ int parport_proc_register(struct parport *port)
t->vars[0].data = >spintime;
for (i = 0; i < 5; i++) {
t->vars[i].extra1 = port;
+#ifdef CONFIG_PARPORT_1284
t->vars[5 + i].extra2 = >probe_info[i];
+#endif /* IEEE 1284 support */
}
 
port_name_len = strnlen(port->name, PARPORT_NAME_MAX_LEN);

-- 
2.30.2



[PATCH v2 02/15] hpet: Remove now superfluous sentinel element from ctl_table array

2023-10-02 Thread Joel Granados via B4 Relay
From: Joel Granados 

This commit comes at the tail end of a greater effort to remove the
empty elements at the end of the ctl_table arrays (sentinels) which
will reduce the overall build time size of the kernel and run time
memory bloat by ~64 bytes per sentinel (further information Link :
https://lore.kernel.org/all/zo5yx5jfoggi%2f...@bombadil.infradead.org/)

Remove the last empty element from hpet_table.

Signed-off-by: Joel Granados 
---
 drivers/char/hpet.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c
index ee71376f174b..f09c79081b01 100644
--- a/drivers/char/hpet.c
+++ b/drivers/char/hpet.c
@@ -728,7 +728,6 @@ static struct ctl_table hpet_table[] = {
 .mode = 0644,
 .proc_handler = proc_dointvec,
 },
-   {}
 };
 
 static struct ctl_table_header *sysctl_header;

-- 
2.30.2



[PATCH v2 08/15] infiniband: Remove the now superfluous sentinel element from ctl_table array

2023-10-02 Thread Joel Granados via B4 Relay
From: Joel Granados 

This commit comes at the tail end of a greater effort to remove the
empty elements at the end of the ctl_table arrays (sentinels) which
will reduce the overall build time size of the kernel and run time
memory bloat by ~64 bytes per sentinel (further information Link :
https://lore.kernel.org/all/zo5yx5jfoggi%2f...@bombadil.infradead.org/)

Remove sentinel from iwcm_ctl_table and ucma_ctl_table

Signed-off-by: Joel Granados 
---
 drivers/infiniband/core/iwcm.c | 1 -
 drivers/infiniband/core/ucma.c | 1 -
 2 files changed, 2 deletions(-)

diff --git a/drivers/infiniband/core/iwcm.c b/drivers/infiniband/core/iwcm.c
index 2b47073c61a6..0301fcad4b48 100644
--- a/drivers/infiniband/core/iwcm.c
+++ b/drivers/infiniband/core/iwcm.c
@@ -111,7 +111,6 @@ static struct ctl_table iwcm_ctl_table[] = {
.mode   = 0644,
.proc_handler   = proc_dointvec,
},
-   { }
 };
 
 /*
diff --git a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c
index bf42650f125b..5f5ad8faf86e 100644
--- a/drivers/infiniband/core/ucma.c
+++ b/drivers/infiniband/core/ucma.c
@@ -71,7 +71,6 @@ static struct ctl_table ucma_ctl_table[] = {
.mode   = 0644,
.proc_handler   = proc_dointvec,
},
-   { }
 };
 
 struct ucma_file {

-- 
2.30.2



[PATCH v2 03/15] xen: Remove now superfluous sentinel element from ctl_table array

2023-10-02 Thread Joel Granados via B4 Relay
From: Joel Granados 

This commit comes at the tail end of a greater effort to remove the
empty elements at the end of the ctl_table arrays (sentinels) which
will reduce the overall build time size of the kernel and run time
memory bloat by ~64 bytes per sentinel (further information Link :
https://lore.kernel.org/all/zo5yx5jfoggi%2f...@bombadil.infradead.org/)

Remove sentinel from balloon_table

Signed-off-by: Joel Granados 
---
 drivers/xen/balloon.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
index 586a1673459e..976c6cdf9ee6 100644
--- a/drivers/xen/balloon.c
+++ b/drivers/xen/balloon.c
@@ -94,7 +94,6 @@ static struct ctl_table balloon_table[] = {
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE,
},
-   { }
 };
 
 #else

-- 
2.30.2



[PATCH v2 00/15] sysctl: Remove sentinel elements from drivers

2023-10-02 Thread Joel Granados via B4 Relay
From: Joel Granados 

What?
These commits remove the sentinel element (last empty element) from the
sysctl arrays of all the files under the "drivers/" directory that use a
sysctl array for registration. The merging of the preparation patches
(in https://lore.kernel.org/all/zo5yx5jfoggi%2f...@bombadil.infradead.org/)
to mainline allows us to just remove sentinel elements without changing
behavior (more info here [1]).

These commits are part of a bigger set (here
https://github.com/Joelgranados/linux/tree/tag/sysctl_remove_empty_elem_V4)
that remove the ctl_table sentinel. Make the review process easier by
chunking the commits into manageable pieces. Each chunk can be reviewed
separately without noise from parallel sets.

Now that the architecture chunk has been mostly reviewed [6], we send
the "drivers/" directory. Once this one is done, it will be follwed by
"fs/*", "kernel/*", "net/*" and miscellaneous. The final set will remove
the unneeded check for ->procname == NULL.

Why?
By removing the sysctl sentinel elements we avoid kernel bloat as
ctl_table arrays get moved out of kernel/sysctl.c into their own
respective subsystems. This move was started long ago to avoid merge
conflicts; the sentinel removal bit came after Mathew Wilcox suggested
it to avoid bloating the kernel by one element as arrays moved out. This
patchset will reduce the overall build time size of the kernel and run
time memory bloat by about ~64 bytes per declared ctl_table array. I
have consolidated some links that shed light on the history of this
effort [2].

Testing:
* Ran sysctl selftests (./tools/testing/selftests/sysctl/sysctl.sh)
* Ran this through 0-day with no errors or warnings

Size saving after removing all sentinels:
  These are the bytes that we save after removing all the sentinels
  (this plus all the other chunks). I included them to get an idea of
  how much memory we are talking about.
* bloat-o-meter:
- The "yesall" configuration results save 9158 bytes
  
https://lore.kernel.org/all/20230621091000.424843-1-j.grana...@samsung.com/
- The "tiny" config + CONFIG_SYSCTL save 1215 bytes
  
https://lore.kernel.org/all/20230809105006.1198165-1-j.grana...@samsung.com/
* memory usage:
In memory savings are measured to be 7296 bytes. (here is how to
measure [3])

Size saving after this patchset:
* bloat-o-meter
- The "yesall" config saves 2432 bytes [4]
- The "tiny" config saves 64 bytes [5]
* memory usage:
In this case there were no bytes saved because I do not have any
of the drivers in the patch. To measure it comment the printk in
`new_dir` and uncomment the if conditional in `new_links` [3].

---
Changes in v2:
- Left the dangling comma in the ctl_table arrays.
- Link to v1: 
https://lore.kernel.org/r/20230928-jag-sysctl_remove_empty_elem_drivers-v1-0-e59120fca...@samsung.com

Comments/feedback greatly appreciated

Best

Joel

[1]
We are able to remove a sentinel table without behavioral change by
introducing a table_size argument in the same place where procname is
checked for NULL. The idea is for it to keep stopping when it hits
->procname == NULL, while the sentinel is still present. And when the
sentinel is removed, it will stop on the table_size. You can go to 
(https://lore.kernel.org/all/20230809105006.1198165-1-j.grana...@samsung.com/)
for more information.

[2]
Links Related to the ctl_table sentinel removal:
* Good summary from Luis sent with the "pull request" for the
  preparation patches.
  https://lore.kernel.org/all/zo5yx5jfoggi%2f...@bombadil.infradead.org/
* Another very good summary from Luis.
  https://lore.kernel.org/all/zmfizkfkvxuft...@bombadil.infradead.org/
* This is a patch set that replaces register_sysctl_table with register_sysctl
  https://lore.kernel.org/all/20230302204612.782387-1-mcg...@kernel.org/
* Patch set to deprecate register_sysctl_paths()
  https://lore.kernel.org/all/20230302202826.776286-1-mcg...@kernel.org/
* Here there is an explicit expectation for the removal of the sentinel element.
  https://lore.kernel.org/all/20230321130908.6972-1-frank...@vivo.com
* The "ARRAY_SIZE" approach was mentioned (proposed?) in this thread
  https://lore.kernel.org/all/20220220060626.15885-1-tangm...@uniontech.com

[3]
To measure the in memory savings apply this on top of this patchset.

"
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index c88854df0b62..e0073a627bac 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -976,6 +976,8 @@ static struct ctl_dir *new_dir(struct ctl_table_set *set,
table[0].procname = new_name;
table[0].mode = S_IFDIR|S_IRUGO|S_IXUGO;
init_header(>header, set->dir.header.root, set, node, table, 1);
+   // Counts additional sentinel used for each new dir.
+   printk("%ld sysctl saved mem kzalloc \n", sizeof(struct ctl_table));

return new;
 }
@@ -1199,6 +1201,9 @@ static struct ctl_table_header 

[PATCH v2 09/15] char-misc: Remove the now superfluous sentinel element from ctl_table array

2023-10-02 Thread Joel Granados via B4 Relay
From: Joel Granados 

This commit comes at the tail end of a greater effort to remove the
empty elements at the end of the ctl_table arrays (sentinels) which
will reduce the overall build time size of the kernel and run time
memory bloat by ~64 bytes per sentinel (further information Link :
https://lore.kernel.org/all/zo5yx5jfoggi%2f...@bombadil.infradead.org/)

Remove sentinel from impi_table and random_table

Signed-off-by: Joel Granados 
---
 drivers/char/ipmi/ipmi_poweroff.c | 1 -
 drivers/char/random.c | 1 -
 2 files changed, 2 deletions(-)

diff --git a/drivers/char/ipmi/ipmi_poweroff.c 
b/drivers/char/ipmi/ipmi_poweroff.c
index 870659d91db2..941d2dcc8c9d 100644
--- a/drivers/char/ipmi/ipmi_poweroff.c
+++ b/drivers/char/ipmi/ipmi_poweroff.c
@@ -656,7 +656,6 @@ static struct ctl_table ipmi_table[] = {
  .maxlen   = sizeof(poweroff_powercycle),
  .mode = 0644,
  .proc_handler = proc_dointvec },
-   { }
 };
 
 static struct ctl_table_header *ipmi_table_header;
diff --git a/drivers/char/random.c b/drivers/char/random.c
index 3cb37760dfec..4a9c79391dee 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -1683,7 +1683,6 @@ static struct ctl_table random_table[] = {
.mode   = 0444,
.proc_handler   = proc_do_uuid,
},
-   { }
 };
 
 /*

-- 
2.30.2



[PATCH v2 01/15] cdrom: Remove now superfluous sentinel element from ctl_table array

2023-10-02 Thread Joel Granados via B4 Relay
From: Joel Granados 

This commit comes at the tail end of a greater effort to remove the
empty elements at the end of the ctl_table arrays (sentinels) which
will reduce the overall build time size of the kernel and run time
memory bloat by ~64 bytes per sentinel (further information Link :
https://lore.kernel.org/all/zo5yx5jfoggi%2f...@bombadil.infradead.org/)

Remove sentinel element from cdrom_table

Signed-off-by: Joel Granados 
---
 drivers/cdrom/cdrom.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c
index cc2839805983..a5e07270e0d4 100644
--- a/drivers/cdrom/cdrom.c
+++ b/drivers/cdrom/cdrom.c
@@ -3655,7 +3655,6 @@ static struct ctl_table cdrom_table[] = {
.mode   = 0644,
.proc_handler   = cdrom_sysctl_handler
},
-   { }
 };
 static struct ctl_table_header *cdrom_sysctl_header;
 

-- 
2.30.2



Re: [PATCH 04/15] tty: Remove now superfluous sentinel element from ctl_table array

2023-10-02 Thread Christophe Leroy


Le 02/10/2023 à 10:17, Jiri Slaby a écrit :
> On 28. 09. 23, 15:21, Joel Granados via B4 Relay wrote:
>> From: Joel Granados 
>>
>> This commit comes at the tail end of a greater effort to remove the
>> empty elements at the end of the ctl_table arrays (sentinels) which
>> will reduce the overall build time size of the kernel and run time
>> memory bloat by ~64 bytes per sentinel (further information Link :
>> https://lore.kernel.org/all/zo5yx5jfoggi%2f...@bombadil.infradead.org/)
>>
>> Remove sentinel from tty_table
>>
>> Signed-off-by: Joel Granados 
>> ---
>>   drivers/tty/tty_io.c | 3 +--
>>   1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
>> index 8a94e5a43c6d..2f925dc54a20 100644
>> --- a/drivers/tty/tty_io.c
>> +++ b/drivers/tty/tty_io.c
>> @@ -3607,8 +3607,7 @@ static struct ctl_table tty_table[] = {
>>   .proc_handler    = proc_dointvec,
>>   .extra1    = SYSCTL_ZERO,
>>   .extra2    = SYSCTL_ONE,
>> -    },
>> -    { }
>> +    }
> 
> Why to remove the comma? One would need to add one when adding a new entry?

Does it make any difference at all ?

In one case you have:

@
something old,
},
+   {
+   something new,
+   },
  }

In the other case you have:

@
something old,
+   },
+   {
+   something new,
}
  }


Christophe


Re: [PATCH 00/15] sysctl: Remove sentinel elements from drivers

2023-10-02 Thread Joel Granados
On Thu, Sep 28, 2023 at 04:31:30PM +, Christophe Leroy wrote:
> 
> 
> Le 28/09/2023 à 15:21, Joel Granados via B4 Relay a écrit :
> > From: Joel Granados 
> 
> Automatic test fails on powerpc, see 
> https://patchwork.ozlabs.org/project/linuxppc-dev/patch/20230928-jag-sysctl_remove_empty_elem_drivers-v1-15-e59120fca...@samsung.com/
From this I got to this URL
https://github.com/linuxppc/linux-snowpatch/actions/runs/6339718136/job/17221399242
and saw this message "sysctl table check failed: dev/tty/ No proc_handler".
This means that we hit the check for entry->proc_handler in
sysctl_check_table.

> 
> Kernel attempted to read user page (1a111316) - exploit attempt? (uid: 0)
> BUG: Unable to handle kernel data access on read at 0x1a111316
> Faulting instruction address: 0xc0545338
> Oops: Kernel access of bad area, sig: 11 [#1]
> BE PAGE_SIZE=4K PowerPC 44x Platform
> Modules linked in:
> CPU: 0 PID: 1 Comm: swapper Not tainted 6.5.0-rc6-gdef13277bacb #1
> Hardware name: amcc,bamboo 440GR Rev. B 0x422218d3 PowerPC 44x Platform
> NIP:  c0545338 LR: c0548468 CTR: 
> REGS: c084fae0 TRAP: 0300   Not tainted  (6.5.0-rc6-gdef13277bacb)
> MSR:  00021000   CR: 84004288  XER: 
> DEAR: 1a111316 ESR: 
> GPR00: c0548468 c084fbd0 c0888000 c084fc99  c084fc7c 1a110316 
> 000a
> GPR08:  c084fd18 1a111316 04ff 22000282  c00027c0 
> 
> GPR16:   c004 c003d544 0001 c003eb2c 096023d4 
> 
> GPR24: c0636502 c0636502 c084fc74 c0588510 c084fc68 c084fc7c c084fc99 
> 0002
> NIP [c0545338] string+0x78/0x148
> LR [c0548468] vsnprintf+0x3d8/0x824
> Call Trace:
> [c084fbd0] [c084fc7c] 0xc084fc7c (unreliable)
> [c084fbe0] [c0548468] vsnprintf+0x3d8/0x824
> [c084fc30] [c0072dec] vprintk_store+0x17c/0x4c8
> [c084fcc0] [c007322c] vprintk_emit+0xf4/0x2a0
> [c084fd00] [c0073d04] _printk+0x60/0x88
> [c084fd40] [c01ab63c] sysctl_err+0x78/0xa4
> [c084fd80] [c01ab404] __register_sysctl_table+0x6a0/0x6c4
> [c084fde0] [c06a585c] __register_sysctl_init+0x30/0x78
> [c084fe00] [c06a8cc8] tty_init+0x44/0x168
> [c084fe30] [c00023c4] do_one_initcall+0x64/0x2a0
> [c084fea0] [c068f060] kernel_init_freeable+0x184/0x230
> [c084fee0] [c00027e4] kernel_init+0x24/0x124
> [c084ff00] [c000f1fc] ret_from_kernel_user_thread+0x14/0x1c
I followed this trace and proc_handler is correctly defined in tty_table
(struct ctl_table) in drivers/tty/tty_io.c:tty_init and there is not
path that changes these values.
Additionally, we then fail trying to print instead of continuing with
the initialization. My conjecture is that this might be due to something
different than tht sysctl register call.

Does this happen consistenly or is this just a one off issue?

To what branch are these patches being applied to?

I'm going to post my V2 and keep working on this issue if it pops up
again.

Thx for the report

Best

> --- interrupt: 0 at 0x0
> NIP:   LR:  CTR: 
> REGS: c084ff10 TRAP:    Not tainted  (6.5.0-rc6-gdef13277bacb)
> MSR:   <>  CR:   XER: 
> 
> GPR00:        
> 
> GPR08:        
> 
> GPR16:        
> 
> GPR24:        
> 
> NIP [] 0x0
> LR [] 0x0
> --- interrupt: 0
> Code: 91610008 90e1000c 4bffd0b5 80010014 38210010 7c0803a6 4e800020 
> 409d0008 9923 38630001 38840001 4240ffd0 <7d2a20ae> 7f851840 
> 5528063e 2c08
> ---[ end trace  ]---
> 
> note: swapper[1] exited with irqs disabled
> Kernel panic - not syncing: Attempted to kill init! exitcode=0x000b
> 
> 
> > 
> > What?
> > These commits remove the sentinel element (last empty element) from the
> > sysctl arrays of all the files under the "drivers/" directory that use a
> > sysctl array for registration. The merging of the preparation patches
> > (in https://lore.kernel.org/all/zo5yx5jfoggi%2f...@bombadil.infradead.org/)
> > to mainline allows us to just remove sentinel elements without changing
> > behavior (more info here [1]).
<--- snip --->
> >   drivers/macintosh/mac_hid.c   |  3 +-
> >   drivers/md/md.c   |  3 +-
> >   drivers/misc/sgi-xp/xpc_main.c|  6 ++--
> >   drivers/net/vrf.c |  3 +-
> >   drivers/parport/procfs.c  | 42 
> > ---
> >   drivers/scsi/scsi_sysctl.c|  3 +-
> >   drivers/scsi/sg.c |  3 +-
> >   drivers/tty/tty_io.c  |  3 +-
> >   drivers/xen/balloon.c |  3 +-
> >   18 files changed, 36 insertions(+), 60 deletions(-)
> > ---
> > base-commit: 0e945134b680040b8613e962f586d91b6d40292d
> > change-id: 

Re: [PATCH 04/15] tty: Remove now superfluous sentinel element from ctl_table array

2023-10-02 Thread Jiri Slaby

On 28. 09. 23, 15:21, Joel Granados via B4 Relay wrote:

From: Joel Granados 

This commit comes at the tail end of a greater effort to remove the
empty elements at the end of the ctl_table arrays (sentinels) which
will reduce the overall build time size of the kernel and run time
memory bloat by ~64 bytes per sentinel (further information Link :
https://lore.kernel.org/all/zo5yx5jfoggi%2f...@bombadil.infradead.org/)

Remove sentinel from tty_table

Signed-off-by: Joel Granados 
---
  drivers/tty/tty_io.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index 8a94e5a43c6d..2f925dc54a20 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -3607,8 +3607,7 @@ static struct ctl_table tty_table[] = {
.proc_handler   = proc_dointvec,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE,
-   },
-   { }
+   }


Why to remove the comma? One would need to add one when adding a new entry?

thanks,
--
js
suse labs



Re: [PATCH 01/15] cdrom: Remove now superfluous sentinel element from ctl_table array

2023-10-02 Thread Joel Granados
On Sat, Sep 30, 2023 at 05:52:17PM +0100, Phillip Potter wrote:
> On Fri, Sep 29, 2023 at 02:17:30PM +0200, Joel Granados wrote:
> > On Thu, Sep 28, 2023 at 03:36:55PM +0200, Greg Kroah-Hartman wrote:
> > > On Thu, Sep 28, 2023 at 03:21:26PM +0200, Joel Granados via B4 Relay 
> > > wrote:
> > > > From: Joel Granados 
> > > > 
> > > > This commit comes at the tail end of a greater effort to remove the
> > > > empty elements at the end of the ctl_table arrays (sentinels) which
> > > > will reduce the overall build time size of the kernel and run time
> > > > memory bloat by ~64 bytes per sentinel (further information Link :
> > > > https://lore.kernel.org/all/zo5yx5jfoggi%2f...@bombadil.infradead.org/)
> > > > 
> > > > Remove sentinel element from cdrom_table
> > > > 
> > > > Signed-off-by: Joel Granados 
> > > > ---
> > > >  drivers/cdrom/cdrom.c | 3 +--
> > > >  1 file changed, 1 insertion(+), 2 deletions(-)
> > > > 
> > > > diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c
> > > > index cc2839805983..451907ade389 100644
> > > > --- a/drivers/cdrom/cdrom.c
> > > > +++ b/drivers/cdrom/cdrom.c
> > > > @@ -3654,8 +3654,7 @@ static struct ctl_table cdrom_table[] = {
> > > > .maxlen = sizeof(int),
> > > > .mode   = 0644,
> > > > .proc_handler   = cdrom_sysctl_handler
> > > > -   },
> > > > -   { }
> > > > +   }
> > > 
> > > You should have the final entry as "}," so as to make any future
> > > additions to the list to only contain that entry, that's long been the
> > > kernel style for lists like this.
> > Will send a V2 with this included. Thx.
> > 
> > > 
> > > So your patches will just remove one line, not 2 and add 1, making it a
> > > smaller diff.
> > indeed.
> > 
> > > 
> > > thanks,
> > > 
> > > greg k-h
> > 
> > -- 
> > 
> > Joel Granados
> 
> Hi Joel,
> 
> Thank you for your patch. I look forward to seeing V2, and will be happy
> to review it.
Am following a reported oops. Once I straighten that out, I'll send out
a V2

Bet

> 
> Regards,
> Phil

-- 

Joel Granados


signature.asc
Description: PGP signature