From: Albert H. <he...@us...> - 2008-04-12 17:32:45
|
Update of /cvsroot/gc-linux/linux/drivers/block In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv18366/drivers/block Modified Files: rvl-stsd.c Log Message: Use GFP_ATOMIC for request allocations during hardware register io. Use GFP_NOIO for command/reply allocations during block io. Properly size the small buffer to avoid discarding data located near the small buffer during cache invalidation operations. The small buffer is now at least a cache line long. Index: rvl-stsd.c =================================================================== RCS file: /cvsroot/gc-linux/linux/drivers/block/rvl-stsd.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- rvl-stsd.c 4 Apr 2008 19:30:40 -0000 1.1 +++ rvl-stsd.c 12 Apr 2008 17:32:50 -0000 1.2 @@ -649,7 +649,7 @@ /* * REVISIT maybe use a dma pool or small buffer for query data */ - query = starlet_kzalloc(sizeof(*query), GFP_KERNEL); + query = starlet_kzalloc(sizeof(*query), GFP_ATOMIC); if (!query) return -ENOMEM; @@ -683,7 +683,7 @@ * */ -static u32 stsd_small_buf[1] +static u32 stsd_small_buf[L1_CACHE_BYTES / sizeof(u32)] __attribute__ ((aligned(STARLET_IPC_DMA_ALIGN + 1))); static const size_t stsd_small_buf_size = sizeof(stsd_small_buf_size); static DEFINE_MUTEX(stsd_small_buf_lock); @@ -693,9 +693,11 @@ u32 *buf; if (!mutex_trylock(&stsd_small_buf_lock)) - buf = starlet_kzalloc(stsd_small_buf_size, GFP_KERNEL); - else + buf = starlet_kzalloc(stsd_small_buf_size, GFP_NOIO); + else { + memset(stsd_small_buf, 0, stsd_small_buf_size); buf = stsd_small_buf; + } return buf; } @@ -938,11 +940,11 @@ if (buf_len > reply_len) return -EINVAL; - cmd = starlet_kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = starlet_kzalloc(sizeof(*cmd), GFP_NOIO); if (!cmd) return -ENOMEM; - reply = starlet_kzalloc(reply_len, GFP_KERNEL); + reply = starlet_kzalloc(reply_len, GFP_NOIO); if (!reply) { starlet_kfree(cmd); return -ENOMEM; |