Skip to contentSkip to conversation

mlx5_core: Fix PowerPC support

DISCUSSION Dan Carpenter 2 participants 3 messages Oct 16, 2014 – Oct 20, 2014 InfiniBand

lore
Share & tools
lore
#0 lore raw

Hello Eli Cohen,

The patch 05bdb2ab6b09: "mlx5_core: Fix PowerPC support" from Jan 14, 2014, leads to the following static checker warning:

drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c:225 free_4k()
warn: right shifting to zero

drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
214 static void free_4k(struct mlx5_core_dev *dev, u64 addr) 215 {
216 struct fw_page *fwp;
217 int n;
218
219 fwp = find_fw_page(dev, addr & PAGE_MASK);
220 if (!fwp) {
221 mlx5_core_warn(dev, "page not found\n");
222 return;
223 }
224
225 n = (addr & ~PAGE_MASK) >> MLX5_ADAPTER_PAGE_SHIFT;

Maybe n = addr >> MLX5_ADAPTER_PAGE_SHIFT; was intended? (Totally random guess).

   226          fwp->free_count++;
   227          set_bit(n, &fwp->bitmask);

regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#1 lore raw
Quoted 22 lines · Dan Carpenter

Hello Eli Cohen,

The patch 05bdb2ab6b09: "mlx5_core: Fix PowerPC support" from Jan 14, 2014, leads to the following static checker warning:

drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c:225 free_4k()
warn: right shifting to zero

drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
214 static void free_4k(struct mlx5_core_dev *dev, u64 addr)

   215  {
   216          struct fw_page *fwp;
   217          int n;
   218  
   219          fwp = find_fw_page(dev, addr & PAGE_MASK);
   220          if (!fwp) {
   221                  mlx5_core_warn(dev, "page not found\n");
   222                  return;
   223          }
   224  
   225          n = (addr & ~PAGE_MASK) >> MLX5_ADAPTER_PAGE_SHIFT;
Quoted 3 lines

Maybe n = addr >> MLX5_ADAPTER_PAGE_SHIFT; was intended? (Totally random guess).

No, I need to find the index of the 4K fragment within the system page (64K in the case of PPC) so I need to mask out the higher bits. I assume you are seeing this when building on x86. When the system page size is 4K then n will always equal zero but in the case of larger page sizes (e.g. ppc), n could have non-zero values.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html