diff options
author | Sebastian Ott <sebott@linux.vnet.ibm.com> | 2013-06-25 09:36:12 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2013-06-26 15:10:30 -0400 |
commit | a94f0fb1a256455489d475f21c1f902a9280bf9a (patch) | |
tree | 69cd52c8a51ad5bff511ac12727d2b07bc76cd1f /arch/s390/appldata | |
parent | 739737efb57d74c71355c56cf5538048c9510507 (diff) |
s390/appldata_mem: do not use static data
Using static data for fields which are accessed by HW will fail if
the driver is build as a module (since this would be vmalloc'ed
memory). This Bug was revealed via
"s390: remove virt_to_phys implementation" - the old virt_to_phys
implementation would have translated the address but it was not
guaranteed that the memory was contiguous.
Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Reviewed-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/appldata')
-rw-r--r-- | arch/s390/appldata/appldata_mem.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/arch/s390/appldata/appldata_mem.c b/arch/s390/appldata/appldata_mem.c index 7ef60b52d6e0..42be53743133 100644 --- a/arch/s390/appldata/appldata_mem.c +++ b/arch/s390/appldata/appldata_mem.c | |||
@@ -32,7 +32,7 @@ | |||
32 | * book: | 32 | * book: |
33 | * http://oss.software.ibm.com/developerworks/opensource/linux390/index.shtml | 33 | * http://oss.software.ibm.com/developerworks/opensource/linux390/index.shtml |
34 | */ | 34 | */ |
35 | static struct appldata_mem_data { | 35 | struct appldata_mem_data { |
36 | u64 timestamp; | 36 | u64 timestamp; |
37 | u32 sync_count_1; /* after VM collected the record data, */ | 37 | u32 sync_count_1; /* after VM collected the record data, */ |
38 | u32 sync_count_2; /* sync_count_1 and sync_count_2 should be the | 38 | u32 sync_count_2; /* sync_count_1 and sync_count_2 should be the |
@@ -63,7 +63,7 @@ static struct appldata_mem_data { | |||
63 | u64 pgmajfault; /* page faults (major only) */ | 63 | u64 pgmajfault; /* page faults (major only) */ |
64 | // <-- New in 2.6 | 64 | // <-- New in 2.6 |
65 | 65 | ||
66 | } __attribute__((packed)) appldata_mem_data; | 66 | } __packed; |
67 | 67 | ||
68 | 68 | ||
69 | /* | 69 | /* |
@@ -118,7 +118,6 @@ static struct appldata_ops ops = { | |||
118 | .record_nr = APPLDATA_RECORD_MEM_ID, | 118 | .record_nr = APPLDATA_RECORD_MEM_ID, |
119 | .size = sizeof(struct appldata_mem_data), | 119 | .size = sizeof(struct appldata_mem_data), |
120 | .callback = &appldata_get_mem_data, | 120 | .callback = &appldata_get_mem_data, |
121 | .data = &appldata_mem_data, | ||
122 | .owner = THIS_MODULE, | 121 | .owner = THIS_MODULE, |
123 | .mod_lvl = {0xF0, 0xF0}, /* EBCDIC "00" */ | 122 | .mod_lvl = {0xF0, 0xF0}, /* EBCDIC "00" */ |
124 | }; | 123 | }; |
@@ -131,7 +130,17 @@ static struct appldata_ops ops = { | |||
131 | */ | 130 | */ |
132 | static int __init appldata_mem_init(void) | 131 | static int __init appldata_mem_init(void) |
133 | { | 132 | { |
134 | return appldata_register_ops(&ops); | 133 | int ret; |
134 | |||
135 | ops.data = kzalloc(sizeof(struct appldata_mem_data), GFP_KERNEL); | ||
136 | if (!ops.data) | ||
137 | return -ENOMEM; | ||
138 | |||
139 | ret = appldata_register_ops(&ops); | ||
140 | if (ret) | ||
141 | kfree(ops.data); | ||
142 | |||
143 | return ret; | ||
135 | } | 144 | } |
136 | 145 | ||
137 | /* | 146 | /* |
@@ -142,6 +151,7 @@ static int __init appldata_mem_init(void) | |||
142 | static void __exit appldata_mem_exit(void) | 151 | static void __exit appldata_mem_exit(void) |
143 | { | 152 | { |
144 | appldata_unregister_ops(&ops); | 153 | appldata_unregister_ops(&ops); |
154 | kfree(ops.data); | ||
145 | } | 155 | } |
146 | 156 | ||
147 | 157 | ||