[ofa-general] bitops take an unsigned long *

Ralph Campbell ralph.campbell at qlogic.com
Mon May 12 16:13:25 PDT 2008


This change looks fine to me.

ipath_sdma_status doesn't depend on hardware so changing
   #define IPATH_SDMA_RUNNING  62
   #define IPATH_SDMA_SHUTDOWN 63
to different values is fine.

Roland, do you want me to send a patch for this?

On Fri, 2008-05-09 at 22:37 -0700, Roland Dreier wrote:
>  > Most architectures could (and should) take an unsigned long * arg for their
>  > bitops.  x86 doesn't do this and it needs fixing.  I fixed it.  Infiniband
>  > is being a problem.
> 
>  > drivers/infiniband/hw/ipath/ipath_driver.c: In function 'decode_sdma_errs':
>  > drivers/infiniband/hw/ipath/ipath_driver.c:926: warning: passing argument 2 of 'constant_test_bit' from incompatible pointer type
>  > drivers/infiniband/hw/ipath/ipath_driver.c:926: warning: passing argument 2 of 'variable_test_bit' from incompatible pointer type
>  > drivers/infiniband/hw/ipath/ipath_driver.c: In function 'ipath_cancel_sends':
>  > drivers/infiniband/hw/ipath/ipath_driver.c:1901: warning: passing argument 2 of 'test_and_set_bit' from incompatible pointer type
>  > drivers/infiniband/hw/ipath/ipath_driver.c:1902: warning: passing argument 2 of 'constant_test_bit' from incompatible pointer type
>  > drivers/infiniband/hw/ipath/ipath_driver.c:1902: warning: passing argument 2 of 'variable_test_bit' from incompatible pointer type
>  > drivers/infiniband/hw/ipath/ipath_driver.c:1934: warning: passing argument 2 of 'set_bit' from incompatible pointer type
>  > drivers/infiniband/hw/ipath/ipath_driver.c:1949: warning: passing argument 2 of 'constant_test_bit' from incompatible pointer type
>  > drivers/infiniband/hw/ipath/ipath_driver.c:1949: warning: passing argument 2 of 'variable_test_bit' from incompatible pointer type
>  > drivers/infiniband/hw/ipath/ipath_driver.c:1950: warning: passing argument 2 of 'constant_test_bit' from incompatible pointer type
>  > drivers/infiniband/hw/ipath/ipath_driver.c:1950: warning: passing argument 2 of 'variable_test_bit' from incompatible pointer type
>  > drivers/infiniband/hw/ipath/ipath_driver.c:1955: warning: passing argument 2 of 'constant_test_bit' from incompatible pointer type
>  > drivers/infiniband/hw/ipath/ipath_driver.c:1955: warning: passing argument 2 of 'variable_test_bit' from incompatible pointer type
>  > drivers/infiniband/hw/ipath/ipath_intr.c: In function 'handle_sdma_errors':
>  > drivers/infiniband/hw/ipath/ipath_intr.c:553: warning: passing argument 2 of '__set_bit' from incompatible pointer type
>  > drivers/infiniband/hw/ipath/ipath_intr.c:554: warning: passing argument 2 of 'constant_test_bit' from incompatible pointer type
>  > drivers/infiniband/hw/ipath/ipath_intr.c:554: warning: passing argument 2 of 'variable_test_bit' from incompatible pointer type
>  > drivers/infiniband/hw/ipath/ipath_intr.c: In function 'handle_sdma_intr':
>  > drivers/infiniband/hw/ipath/ipath_intr.c:566: warning: passing argument 2 of 'constant_test_bit' from incompatible pointer type
>  > drivers/infiniband/hw/ipath/ipath_intr.c:566: warning: passing argument 2 of 'variable_test_bit' from incompatible pointer type
>  > drivers/infiniband/hw/ipath/ipath_intr.c:570: warning: passing argument 2 of 'constant_test_bit' from incompatible pointer type
>  > drivers/infiniband/hw/ipath/ipath_intr.c:570: warning: passing argument 2 of 'variable_test_bit' from incompatible pointer type
>  > drivers/infiniband/hw/ipath/ipath_intr.c:575: warning: passing argument 2 of '__set_bit' from incompatible pointer type
>  > drivers/infiniband/hw/ipath/ipath_intr.c:579: warning: passing argument 2 of 'constant_test_bit' from incompatible pointer type
>  > drivers/infiniband/hw/ipath/ipath_intr.c:579: warning: passing argument 2 of 'variable_test_bit' from incompatible pointer type
>  > drivers/infiniband/hw/ipath/ipath_sdma.c: In function 'sdma_notify_task':
>  > drivers/infiniband/hw/ipath/ipath_sdma.c:200: warning: passing argument 2 of 'constant_test_bit' from incompatible pointer type
>  > drivers/infiniband/hw/ipath/ipath_sdma.c:200: warning: passing argument 2 of 'variable_test_bit' from incompatible pointer type
>  > drivers/infiniband/hw/ipath/ipath_sdma.c: In function 'sdma_abort_task':
>  > drivers/infiniband/hw/ipath/ipath_sdma.c:236: warning: passing argument 2 of 'constant_test_bit' from incompatible pointer type
>  > drivers/infiniband/hw/ipath/ipath_sdma.c:236: warning: passing argument 2 of 'variable_test_bit' from incompatible pointer type
>  > drivers/infiniband/hw/ipath/ipath_sdma.c:253: warning: passing argument 2 of '__set_bit' from incompatible pointer type
>  > drivers/infiniband/hw/ipath/ipath_sdma.c:267: warning: passing argument 2 of 'constant_test_bit' from incompatible pointer type
>  > drivers/infiniband/hw/ipath/ipath_sdma.c:267: warning: passing argument 2 of 'variable_test_bit' from incompatible pointer type
>  > drivers/infiniband/hw/ipath/ipath_sdma.c:269: warning: passing argument 2 of 'constant_test_bit' from incompatible pointer type
>  > drivers/infiniband/hw/ipath/ipath_sdma.c:269: warning: passing argument 2 of 'variable_test_bit' from incompatible pointer type
>  > drivers/infiniband/hw/ipath/ipath_sdma.c:271: warning: passing argument 2 of 'constant_test_bit' from incompatible pointer type
>  > drivers/infiniband/hw/ipath/ipath_sdma.c:271: warning: passing argument 2 of 'variable_test_bit' from incompatible pointer type
>  > drivers/infiniband/hw/ipath/ipath_sdma.c:273: warning: passing argument 2 of 'constant_test_bit' from incompatible pointer type
>  > drivers/infiniband/hw/ipath/ipath_sdma.c:273: warning: passing argument 2 of 'variable_test_bit' from incompatible pointer type
>  > drivers/infiniband/hw/ipath/ipath_sdma.c:354: warning: passing argument 2 of 'constant_test_bit' from incompatible pointer type
>  > drivers/infiniband/hw/ipath/ipath_sdma.c:354: warning: passing argument 2 of 'variable_test_bit' from incompatible pointer type
>  > drivers/infiniband/hw/ipath/ipath_sdma.c: In function 'setup_sdma':
>  > drivers/infiniband/hw/ipath/ipath_sdma.c:504: warning: passing argument 2 of '__set_bit' from incompatible pointer type
>  > drivers/infiniband/hw/ipath/ipath_sdma.c: In function 'teardown_sdma':
>  > drivers/infiniband/hw/ipath/ipath_sdma.c:521: warning: passing argument 2 of '__clear_bit' from incompatible pointer type
>  > drivers/infiniband/hw/ipath/ipath_sdma.c:522: warning: passing argument 2 of '__set_bit' from incompatible pointer type
>  > drivers/infiniband/hw/ipath/ipath_sdma.c:523: warning: passing argument 2 of '__set_bit' from incompatible pointer type
>  > drivers/infiniband/hw/ipath/ipath_sdma.c: In function 'ipath_restart_sdma':
>  > drivers/infiniband/hw/ipath/ipath_sdma.c:608: warning: passing argument 2 of 'constant_test_bit' from incompatible pointer type
>  > drivers/infiniband/hw/ipath/ipath_sdma.c:608: warning: passing argument 2 of 'variable_test_bit' from incompatible pointer type
>  > drivers/infiniband/hw/ipath/ipath_sdma.c:609: warning: passing argument 2 of 'constant_test_bit' from incompatible pointer type
>  > drivers/infiniband/hw/ipath/ipath_sdma.c:609: warning: passing argument 2 of 'variable_test_bit' from incompatible pointer type
>  > drivers/infiniband/hw/ipath/ipath_sdma.c:612: warning: passing argument 2 of '__clear_bit' from incompatible pointer type
>  > drivers/infiniband/hw/ipath/ipath_sdma.c:613: warning: passing argument 2 of '__clear_bit' from incompatible pointer type
>  > drivers/infiniband/hw/ipath/ipath_sdma.c:614: warning: passing argument 2 of '__clear_bit' from incompatible pointer type
>  > drivers/infiniband/hw/ipath/ipath_sdma.c: In function 'ipath_sdma_verbs_send':
>  > drivers/infiniband/hw/ipath/ipath_sdma.c:691: warning: passing argument 2 of 'constant_test_bit' from incompatible pointer type
>  > drivers/infiniband/hw/ipath/ipath_sdma.c:691: warning: passing argument 2 of 'variable_test_bit' from incompatible pointer type
> 
> So all of these are ipath warnings, seemingly all because
> ipath_devdata.ipath_sdma_status is a u64.  The stupid fix is to change
> this declaration to unsigned long as below, but this sets a trap if the
> driver is ever fixed so that it doesn't depend on 64BIT, because of
> 
>     /* bit positions for sdma_status */
>     #define IPATH_SDMA_ABORTING  0
>     #define IPATH_SDMA_DISARMED  1
>     #define IPATH_SDMA_DISABLED  2
>     #define IPATH_SDMA_LAYERBUF  3
>     #define IPATH_SDMA_RUNNING  62
>     #define IPATH_SDMA_SHUTDOWN 63
> 
> I don't see that this status is shared with hardware, and I don't see
> why the RUNNING and SHUTDOWN bits need to be 62 and 63... converting to
> unsigned long and moving those to bits 4 and 5 seems like it might be a
> clean fix.
> 
> The other option is to convert to a bitmap and using the bitmap
> operations, which ends up being a bigger patch.
> 
> But since I don't really understand this part of the driver, some
> guidance would be helpful...
> 
>  - R.
> 
> 
> diff --git a/drivers/infiniband/hw/ipath/ipath_driver.c b/drivers/infiniband/hw/ipath/ipath_driver.c
> index ce7b7c3..7635ace 100644
> --- a/drivers/infiniband/hw/ipath/ipath_driver.c
> +++ b/drivers/infiniband/hw/ipath/ipath_driver.c
> @@ -1894,7 +1894,7 @@ void ipath_cancel_sends(struct ipath_devdata *dd, int restore_sendctrl)
>  	 */
>  	if (dd->ipath_flags & IPATH_HAS_SEND_DMA) {
>  		int skip_cancel;
> -		u64 *statp = &dd->ipath_sdma_status;
> +		unsigned long *statp = &dd->ipath_sdma_status;
>  
>  		spin_lock_irqsave(&dd->ipath_sdma_lock, flags);
>  		skip_cancel =
> diff --git a/drivers/infiniband/hw/ipath/ipath_kernel.h b/drivers/infiniband/hw/ipath/ipath_kernel.h
> index 02b24a3..a46f8ad 100644
> --- a/drivers/infiniband/hw/ipath/ipath_kernel.h
> +++ b/drivers/infiniband/hw/ipath/ipath_kernel.h
> @@ -483,7 +483,7 @@ struct ipath_devdata {
>  
>  	/* SendDMA related entries */
>  	spinlock_t            ipath_sdma_lock;
> -	u64                   ipath_sdma_status;
> +	unsigned long         ipath_sdma_status;
>  	unsigned long         ipath_sdma_abort_jiffies;
>  	unsigned long         ipath_sdma_abort_intr_timeout;
>  	unsigned long         ipath_sdma_buf_jiffies;
> 
> 




More information about the general mailing list