Updated structs to use completion{} and wait_queue_head_t{} and added struct size checkes in hfi1_aio_write()
This commit is contained in:
committed by
Balazs Gerofi
parent
1c4a6568e6
commit
74a636a612
@ -421,6 +421,11 @@ static ssize_t hfi1_aio_write(struct kiocb *kiocb, const struct iovec *iovec,
|
|||||||
{
|
{
|
||||||
struct hfi1_filedata *fd = kiocb->ki_filp->private_data;
|
struct hfi1_filedata *fd = kiocb->ki_filp->private_data;
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
|
||||||
|
#define WARN_IF_SIZE_DIFFERENT(type, size)\
|
||||||
|
if (sizeof(type) != size) kprintf("WARNING: sizeof( %s ) = %lu != %lu (on Linux)\n", #type, sizeof(type), size)
|
||||||
|
|
||||||
ssize_t hfi1_aio_write(void *private_data, const struct iovec *iovec, unsigned long dim)
|
ssize_t hfi1_aio_write(void *private_data, const struct iovec *iovec, unsigned long dim)
|
||||||
{
|
{
|
||||||
struct hfi1_filedata *fd = private_data;
|
struct hfi1_filedata *fd = private_data;
|
||||||
@ -428,10 +433,15 @@ ssize_t hfi1_aio_write(void *private_data, const struct iovec *iovec, unsigned l
|
|||||||
struct hfi1_user_sdma_pkt_q *pq = fd->pq;
|
struct hfi1_user_sdma_pkt_q *pq = fd->pq;
|
||||||
struct hfi1_user_sdma_comp_q *cq = fd->cq;
|
struct hfi1_user_sdma_comp_q *cq = fd->cq;
|
||||||
int done = 0, reqs = 0;
|
int done = 0, reqs = 0;
|
||||||
kprintf("sizeof(struct hfi1_filedata) = %lu\n", sizeof(struct hfi1_filedata));
|
|
||||||
kprintf("sizeof(struct hfi1_devdata) = %lu\n", sizeof(struct hfi1_devdata));
|
/* Double check the sizes */
|
||||||
kprintf("sizeof(struct iowait) = %lu\n", sizeof(struct iowait));
|
WARN_IF_SIZE_DIFFERENT(struct hfi1_filedata, 96);
|
||||||
kprintf("sizeof(struct hfi1_user_sdma_pkt_q) = %lu\n", sizeof(struct hfi1_user_sdma_pkt_q));
|
WARN_IF_SIZE_DIFFERENT(struct hfi1_devdata, 7360);
|
||||||
|
WARN_IF_SIZE_DIFFERENT(struct iowait, 240);
|
||||||
|
WARN_IF_SIZE_DIFFERENT(struct hfi1_user_sdma_pkt_q, 376);
|
||||||
|
WARN_IF_SIZE_DIFFERENT(struct sdma_engine, 1472);
|
||||||
|
WARN_IF_SIZE_DIFFERENT(struct sdma_state, 64);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
hfi1_cdbg(AIOWRITE, "+");
|
hfi1_cdbg(AIOWRITE, "+");
|
||||||
if (!cq || !pq)
|
if (!cq || !pq)
|
||||||
|
|||||||
@ -1261,7 +1261,6 @@ struct hfi1_devdata {
|
|||||||
};
|
};
|
||||||
#endif /* __HFI1_ORIG__ */
|
#endif /* __HFI1_ORIG__ */
|
||||||
|
|
||||||
//TODO: double check the order
|
|
||||||
#ifndef __HFI1_ORIG__
|
#ifndef __HFI1_ORIG__
|
||||||
|
|
||||||
/* Size on Linux side is 7360 Bytes */
|
/* Size on Linux side is 7360 Bytes */
|
||||||
@ -1319,7 +1318,7 @@ struct hfi1_devdata {
|
|||||||
/* array of vl maps */
|
/* array of vl maps */
|
||||||
struct sdma_vl_map __rcu *sdma_map; //struct sdma_vl_map __rc *sdma_map
|
struct sdma_vl_map __rcu *sdma_map; //struct sdma_vl_map __rc *sdma_map
|
||||||
|
|
||||||
char sdma_unfreeze_wq[24]; //wait_queue_head_t sdma_unfreeze_wq;
|
wait_queue_head_t sdma_unfreeze_wq;
|
||||||
atomic_t sdma_unfreeze_count;
|
atomic_t sdma_unfreeze_count;
|
||||||
|
|
||||||
u32 lcb_access_count;
|
u32 lcb_access_count;
|
||||||
@ -1538,7 +1537,7 @@ struct hfi1_devdata {
|
|||||||
|
|
||||||
char rcverr_timer[80]; //struct timer_list rcverr_timer
|
char rcverr_timer[80]; //struct timer_list rcverr_timer
|
||||||
|
|
||||||
char event_queue[24]; //wait_queue_head_t event_queue;
|
wait_queue_head_t event_queue;
|
||||||
|
|
||||||
|
|
||||||
__le64 *rcvhdrtail_dummy_kvaddr;
|
__le64 *rcvhdrtail_dummy_kvaddr;
|
||||||
@ -1552,7 +1551,7 @@ struct hfi1_devdata {
|
|||||||
|
|
||||||
atomic_t user_refcount;
|
atomic_t user_refcount;
|
||||||
|
|
||||||
char user_comp[32]; //struct completion user_comp
|
struct completion user_comp;
|
||||||
bool eprom_available;
|
bool eprom_available;
|
||||||
bool aspm_supported;
|
bool aspm_supported;
|
||||||
bool aspm_enabled;
|
bool aspm_enabled;
|
||||||
@ -1592,31 +1591,11 @@ struct tid_rb_node;
|
|||||||
struct mmu_rb_node;
|
struct mmu_rb_node;
|
||||||
struct mmu_rb_handler;
|
struct mmu_rb_handler;
|
||||||
|
|
||||||
/* Private data for file operations */
|
|
||||||
struct hfi1_filedata {
|
|
||||||
struct hfi1_ctxtdata *uctxt;
|
|
||||||
unsigned subctxt;
|
|
||||||
struct hfi1_user_sdma_comp_q *cq;
|
|
||||||
struct hfi1_user_sdma_pkt_q *pq;
|
|
||||||
/* for cpu affinity; -1 if none */
|
|
||||||
int rec_cpu_num;
|
|
||||||
u32 tid_n_pinned;
|
|
||||||
struct mmu_rb_handler *handler;
|
|
||||||
struct tid_rb_node **entry_to_rb;
|
|
||||||
spinlock_t tid_lock; /* protect tid_[limit,used] counters */
|
|
||||||
u32 tid_limit;
|
|
||||||
u32 tid_used;
|
|
||||||
u32 *invalid_tids;
|
|
||||||
u32 invalid_tid_idx;
|
|
||||||
/* protect invalid_tids array and invalid_tid_idx */
|
|
||||||
spinlock_t invalid_lock;
|
|
||||||
struct mm_struct *mm;
|
|
||||||
};
|
|
||||||
#endif /* __HFI1_ORIG__ */
|
#endif /* __HFI1_ORIG__ */
|
||||||
|
|
||||||
#ifndef __HFI1_ORIG__
|
|
||||||
/* Original size on linux is 96 bytes */
|
/* Original size on linux is 96 bytes */
|
||||||
/* Private data for file operations */
|
/* Private data for file operations */
|
||||||
|
|
||||||
struct hfi1_filedata {
|
struct hfi1_filedata {
|
||||||
struct hfi1_ctxtdata *uctxt;
|
struct hfi1_ctxtdata *uctxt;
|
||||||
unsigned subctxt;
|
unsigned subctxt;
|
||||||
@ -1635,8 +1614,6 @@ struct hfi1_filedata {
|
|||||||
void *mm; //struct mm_struct *mm;
|
void *mm; //struct mm_struct *mm;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __HFI1_ORIG__ */
|
|
||||||
|
|
||||||
#ifdef __HFI1_ORIG__
|
#ifdef __HFI1_ORIG__
|
||||||
|
|
||||||
extern struct list_head hfi1_dev_list;
|
extern struct list_head hfi1_dev_list;
|
||||||
|
|||||||
@ -113,10 +113,11 @@ struct kref {
|
|||||||
atomic_t refcount;
|
atomic_t refcount;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct {
|
struct wait_queue_head_t {
|
||||||
spinlock_t lock;
|
spinlock_t lock;
|
||||||
struct list_head task_list;
|
struct list_head task_list;
|
||||||
} wait_queue_head_t ;
|
};
|
||||||
|
typedef struct wait_queue_head_t wait_queue_head_t;
|
||||||
|
|
||||||
struct completion {
|
struct completion {
|
||||||
unsigned int done;
|
unsigned int done;
|
||||||
|
|||||||
@ -144,8 +144,8 @@ struct iowait {
|
|||||||
void (*wakeup)(struct iowait *wait, int reason);
|
void (*wakeup)(struct iowait *wait, int reason);
|
||||||
void (*sdma_drained)(struct iowait *wait);
|
void (*sdma_drained)(struct iowait *wait);
|
||||||
seqlock_t *lock;
|
seqlock_t *lock;
|
||||||
char wait_dma[24]; // wait_queue_head_t wait_dma;
|
wait_queue_head_t wait_dma;
|
||||||
char wait_pio[24]; // wait_queue_head_t wait_pio;
|
wait_queue_head_t wait_pio;
|
||||||
atomic_t sdma_busy;
|
atomic_t sdma_busy;
|
||||||
atomic_t pio_busy;
|
atomic_t pio_busy;
|
||||||
u32 count;
|
u32 count;
|
||||||
|
|||||||
@ -127,7 +127,7 @@ struct hfi1_user_sdma_pkt_q {
|
|||||||
unsigned long *req_in_use;
|
unsigned long *req_in_use;
|
||||||
struct iowait busy;
|
struct iowait busy;
|
||||||
unsigned state;
|
unsigned state;
|
||||||
char wait[24]; //wait_queue_head_t wait;
|
wait_queue_head_t wait;
|
||||||
unsigned long unpinned;
|
unsigned long unpinned;
|
||||||
void *handler; // struct mmu_rb_handler *handler;
|
void *handler; // struct mmu_rb_handler *handler;
|
||||||
atomic_t n_locked;
|
atomic_t n_locked;
|
||||||
|
|||||||
Reference in New Issue
Block a user