[ceph-client:binary_tracing 2/4] net/ceph/ceph_san_logger.c:508:21: sparse: sparse: incorrect type in initializer (different address spaces)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://github.com/ceph/ceph-client.git binary_tracing
head:   242b3aa593381c5ed2f425dbfb145bf7ca42e1fc
commit: 8a1cb95e58001067ea33908f1762ca31d6f93b69 [2/4] ceph_san code
config: x86_64-randconfig-r122-20250704 (https://download.01.org/0day-ci/archive/20250705/202507050653.f2vZWkeo-lkp@xxxxxxxxx/config)
compiler: clang version 20.1.7 (https://github.com/llvm/llvm-project 6146a88f60492b520a36f8f8f3231e15f3cc6082)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250705/202507050653.f2vZWkeo-lkp@xxxxxxxxx/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 <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202507050653.f2vZWkeo-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
>> net/ceph/ceph_san_logger.c:508:21: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected void const [noderef] __percpu *__vpp_verify @@     got struct ceph_san_tls_ctx [noderef] __percpu ** @@
   net/ceph/ceph_san_logger.c:508:21: sparse:     expected void const [noderef] __percpu *__vpp_verify
   net/ceph/ceph_san_logger.c:508:21: sparse:     got struct ceph_san_tls_ctx [noderef] __percpu **
>> net/ceph/ceph_san_logger.c:508:55: sparse: sparse: incompatible types in comparison expression (different address spaces):
   net/ceph/ceph_san_logger.c:508:55: sparse:    struct ceph_san_tls_ctx [noderef] __percpu *
   net/ceph/ceph_san_logger.c:508:55: sparse:    struct ceph_san_tls_ctx *
   net/ceph/ceph_san_logger.c:567:36: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected void const [noderef] __percpu *__vpp_verify @@     got struct ceph_san_tls_ctx [noderef] __percpu ** @@
>> net/ceph/ceph_san_logger.c:567:36: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected struct ceph_san_tls_ctx *ctx @@     got struct ceph_san_tls_ctx [noderef] __percpu *[assigned] pscr_ret__ @@
   net/ceph/ceph_san_logger.c:572:13: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected void const [noderef] __percpu *__vpp_verify @@     got struct ceph_san_tls_ctx [noderef] __percpu ** @@
   net/ceph/ceph_san_logger.c:589:5: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected void const [noderef] __percpu *__vpp_verify @@     got struct ceph_san_tls_ctx [noderef] __percpu ** @@
>> net/ceph/ceph_san_logger.c:589:5: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected struct ceph_san_tls_ctx [noderef] __percpu *pto_tmp__ @@     got struct ceph_san_tls_ctx *ctx @@
>> net/ceph/ceph_san_logger.c:589:5: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected struct ceph_san_tls_ctx [noderef] __percpu *pto_tmp__ @@     got struct ceph_san_tls_ctx *ctx @@
>> net/ceph/ceph_san_logger.c:589:5: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected struct ceph_san_tls_ctx [noderef] __percpu *pto_tmp__ @@     got struct ceph_san_tls_ctx *ctx @@
>> net/ceph/ceph_san_logger.c:589:5: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected struct ceph_san_tls_ctx [noderef] __percpu *pto_tmp__ @@     got struct ceph_san_tls_ctx *ctx @@

vim +508 net/ceph/ceph_san_logger.c

   482	
   483	    while (entry == NULL) {
   484	        ctx = ceph_san_get_ctx();
   485	        if (!ctx) {
   486	            pr_err("Failed to get TLS context\n");
   487	            return NULL;
   488	        }
   489	        if (!is_valid_kernel_addr(ctx)) {
   490	            pr_err("ceph_san_log: invalid TLS context address: %pK\n", ctx);
   491	            return NULL;
   492	        }
   493	        if (unlikely(retry_count)) {
   494	            pr_debug("[%d]Retrying allocation with ctx %llu (%s, pid %d) (retry %d, needed_size=%zu @ %d)\n",
   495	                     smp_processor_id(), ctx->id, ctx->comm, ctx->pid, retry_count, needed_size, source_id);
   496	        }
   497	
   498	        alloc = cephsan_pagefrag_alloc(&ctx->pf, needed_size);
   499	        if (alloc == (u64)-ENOMEM) {
   500	            pr_debug("[%d]ceph_san_log: pagefrag full for ctx %llu (%s, pid %d), refcount=%d. Alloc failed (retry=%d): pf head=%u active_elements=%d alloc_count=%u, needed_size=%zu, pagefrag_size=%u\n",
   501	                   smp_processor_id(),
   502	                   ctx->id, ctx->comm, ctx->pid, atomic_read(&ctx->refcount), retry_count, ctx->pf.head,
   503	                   ctx->pf.active_elements, ctx->pf.alloc_count,
   504	                   needed_size, CEPHSAN_PAGEFRAG_SIZE);
   505	
   506	            /* Invalidate the correct active context slot before releasing and retrying */
   507	            if (in_serving_softirq()) {
 > 508	                if (this_cpu_read(g_logger.napi_ctxs) == ctx) {
   509	                    pr_debug("[%d]ceph_san_log: Clearing NAPI slot for ctx %llu (CPU %d) due to ENOMEM.\n", smp_processor_id(), ctx->id, smp_processor_id());
   510	                    this_cpu_write(g_logger.napi_ctxs, NULL);
   511	                } else {
   512	                    pr_warn("[%d]ceph_san_log: ENOMEM for ctx %llu (%s, pid %d) in softirq, but it wasn't in current CPU's NAPI slot. NAPI slot holds %p. Refcount: %d.\n",
   513	                            smp_processor_id(), ctx->id, ctx->comm, ctx->pid, this_cpu_read(g_logger.napi_ctxs), atomic_read(&ctx->refcount));
   514	                }
   515	            } else {
   516	                if (current->tls_ctx == (void *)&ctx->release) {
   517	                    pr_debug("[%d]ceph_san_log: Clearing current->tls_ctx for TLS ctx %llu due to ENOMEM.\n", smp_processor_id(), ctx->id);
   518	                    current->tls_ctx = NULL;
   519	                } else {
   520	                    pr_warn("[%d]ceph_san_log: ENOMEM for ctx %llu (%s, pid %d) not in softirq, but it wasn't current->tls_ctx. current->tls_ctx is %p. Refcount: %d.\n",
   521	                            smp_processor_id(), ctx->id, ctx->comm, ctx->pid, current->tls_ctx, atomic_read(&ctx->refcount));
   522	                }
   523	            }
   524	
   525	            ++retry_count;
   526	            ceph_san_tls_release(ctx); /* This decrements refcount, ctx may be reused or freed */
   527	            entry = NULL; /* Ensure we loop to get a new context */
   528	            continue;
   529	        }
   530	        //TODO:: remove this shit alloc should return a ptr
   531	        entry = cephsan_pagefrag_get_ptr(&ctx->pf, alloc);
   532	        if (unlikely(!is_valid_kernel_addr(entry))) {
   533	            pr_debug("[%d]ceph_san_log: invalid log entry pointer: %llx from ctx %llu (%s, pid %d)\n",
   534	                     smp_processor_id(), (unsigned long long)entry, ctx->id, ctx->comm, ctx->pid);
   535	            ceph_san_tls_release(ctx); /* Release the context as we can't use the entry */
   536	            entry = NULL; /* force retry to get a new context and page */
   537	            continue;
   538	        }
   539	        if (unlikely(retry_count)) {
   540	            pr_debug("[%d]Successfully allocated with ctx %llu (%s, pid %d) after %d retries (needed_size=%zu @ %d)\n",
   541	                     smp_processor_id(), ctx->id, ctx->comm, ctx->pid, retry_count, needed_size, source_id);
   542	        }
   543	    }
   544	
   545	    /* Update last_entry pointer */
   546	    ctx->pf.last_entry = entry;
   547	
   548	    /* Fill in entry details */
   549	#if CEPH_SAN_DEBUG_POISON
   550	    entry->debug_poison = CEPH_SAN_LOG_ENTRY_POISON;
   551	#endif
   552	    entry->ts_delta = (u32)(jiffies - ctx->base_jiffies);
   553	    entry->source_id = (u16)source_id;
   554	    entry->client_id = (u8)client_id;
   555	    entry->len = (u8)needed_size;
   556	    return entry->buffer;
   557	}
   558	EXPORT_SYMBOL(ceph_san_log);
   559	
   560	/**
   561	 * ceph_san_get_napi_ctx - Get NAPI context for current CPU
   562	 *
   563	 * Returns pointer to NAPI context or NULL if not set
   564	 */
   565	struct ceph_san_tls_ctx *ceph_san_get_napi_ctx(void)
   566	{
 > 567	    struct ceph_san_tls_ctx *ctx = this_cpu_read(g_logger.napi_ctxs);
   568	
   569	    if (ctx) {
   570	        if (!is_valid_active_ctx(ctx, "NAPI")) {
   571	            pr_err("BUG: Invalid NAPI context found for CPU %d, clearing.\n", smp_processor_id());
   572	            this_cpu_write(g_logger.napi_ctxs, NULL);
   573	            return NULL;
   574	        }
   575	    }
   576	    return ctx;
   577	}
   578	EXPORT_SYMBOL(ceph_san_get_napi_ctx);
   579	
   580	/**
   581	 * ceph_san_set_napi_ctx - Set NAPI context for current CPU
   582	 * @ctx: Context to set
   583	 */
   584	void ceph_san_set_napi_ctx(struct ceph_san_tls_ctx *ctx)
   585	{
   586	    if (ctx && !is_valid_active_ctx(ctx, "New NAPI being set")) {
   587	        BUG(); /* Context should be valid and refcount 1 before being set */
   588	    }
 > 589	    this_cpu_write(g_logger.napi_ctxs, ctx);
   590	}
   591	EXPORT_SYMBOL(ceph_san_set_napi_ctx);
   592	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki




[Index of Archives]     [CEPH Users]     [Ceph Large]     [Ceph Dev]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux