Updated structs to use completion{} and wait_queue_head_t{} and added struct size checkes in hfi1_aio_write()

This commit is contained in:
Aram Santogidis
2017-08-08 17:07:00 +09:00
committed by Balazs Gerofi
parent 1c4a6568e6
commit 74a636a612
5 changed files with 24 additions and 36 deletions

View File

@ -1261,7 +1261,6 @@ struct hfi1_devdata {
};
#endif /* __HFI1_ORIG__ */
//TODO: double check the order
#ifndef __HFI1_ORIG__
/* Size on Linux side is 7360 Bytes */
@ -1319,7 +1318,7 @@ struct hfi1_devdata {
/* array of vl maps */
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;
u32 lcb_access_count;
@ -1538,7 +1537,7 @@ struct hfi1_devdata {
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;
@ -1552,7 +1551,7 @@ struct hfi1_devdata {
atomic_t user_refcount;
char user_comp[32]; //struct completion user_comp
struct completion user_comp;
bool eprom_available;
bool aspm_supported;
bool aspm_enabled;
@ -1592,31 +1591,11 @@ struct tid_rb_node;
struct mmu_rb_node;
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__ */
#ifndef __HFI1_ORIG__
/* Original size on linux is 96 bytes */
/* Private data for file operations */
struct hfi1_filedata {
struct hfi1_ctxtdata *uctxt;
unsigned subctxt;
@ -1635,8 +1614,6 @@ struct hfi1_filedata {
void *mm; //struct mm_struct *mm;
};
#endif /* __HFI1_ORIG__ */
#ifdef __HFI1_ORIG__
extern struct list_head hfi1_dev_list;

View File

@ -113,10 +113,11 @@ struct kref {
atomic_t refcount;
};
typedef struct {
struct wait_queue_head_t {
spinlock_t lock;
struct list_head task_list;
} wait_queue_head_t ;
};
typedef struct wait_queue_head_t wait_queue_head_t;
struct completion {
unsigned int done;

View File

@ -144,8 +144,8 @@ struct iowait {
void (*wakeup)(struct iowait *wait, int reason);
void (*sdma_drained)(struct iowait *wait);
seqlock_t *lock;
char wait_dma[24]; // wait_queue_head_t wait_dma;
char wait_pio[24]; // wait_queue_head_t wait_pio;
wait_queue_head_t wait_dma;
wait_queue_head_t wait_pio;
atomic_t sdma_busy;
atomic_t pio_busy;
u32 count;

View File

@ -127,7 +127,7 @@ struct hfi1_user_sdma_pkt_q {
unsigned long *req_in_use;
struct iowait busy;
unsigned state;
char wait[24]; //wait_queue_head_t wait;
wait_queue_head_t wait;
unsigned long unpinned;
void *handler; // struct mmu_rb_handler *handler;
atomic_t n_locked;