diff options
Diffstat (limited to 'include')
59 files changed, 2196 insertions, 407 deletions
diff --git a/include/acpi/acexcep.h b/include/acpi/acexcep.h index eda04546cdf..473d584b1d3 100644 --- a/include/acpi/acexcep.h +++ b/include/acpi/acexcep.h | |||
@@ -103,8 +103,9 @@ | |||
103 | #define AE_BAD_OCTAL_CONSTANT (acpi_status) (0x0006 | AE_CODE_PROGRAMMER) | 103 | #define AE_BAD_OCTAL_CONSTANT (acpi_status) (0x0006 | AE_CODE_PROGRAMMER) |
104 | #define AE_BAD_DECIMAL_CONSTANT (acpi_status) (0x0007 | AE_CODE_PROGRAMMER) | 104 | #define AE_BAD_DECIMAL_CONSTANT (acpi_status) (0x0007 | AE_CODE_PROGRAMMER) |
105 | #define AE_MISSING_ARGUMENTS (acpi_status) (0x0008 | AE_CODE_PROGRAMMER) | 105 | #define AE_MISSING_ARGUMENTS (acpi_status) (0x0008 | AE_CODE_PROGRAMMER) |
106 | #define AE_BAD_ADDRESS (acpi_status) (0x0009 | AE_CODE_PROGRAMMER) | ||
106 | 107 | ||
107 | #define AE_CODE_PGM_MAX 0x0008 | 108 | #define AE_CODE_PGM_MAX 0x0009 |
108 | 109 | ||
109 | /* | 110 | /* |
110 | * Acpi table exceptions | 111 | * Acpi table exceptions |
@@ -224,7 +225,8 @@ char const *acpi_gbl_exception_names_pgm[] = { | |||
224 | "AE_BAD_HEX_CONSTANT", | 225 | "AE_BAD_HEX_CONSTANT", |
225 | "AE_BAD_OCTAL_CONSTANT", | 226 | "AE_BAD_OCTAL_CONSTANT", |
226 | "AE_BAD_DECIMAL_CONSTANT", | 227 | "AE_BAD_DECIMAL_CONSTANT", |
227 | "AE_MISSING_ARGUMENTS" | 228 | "AE_MISSING_ARGUMENTS", |
229 | "AE_BAD_ADDRESS" | ||
228 | }; | 230 | }; |
229 | 231 | ||
230 | char const *acpi_gbl_exception_names_tbl[] = { | 232 | char const *acpi_gbl_exception_names_tbl[] = { |
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index e9f6574930e..a2228511d4b 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h | |||
@@ -88,44 +88,30 @@ struct acpi_device; | |||
88 | 88 | ||
89 | typedef int (*acpi_op_add) (struct acpi_device * device); | 89 | typedef int (*acpi_op_add) (struct acpi_device * device); |
90 | typedef int (*acpi_op_remove) (struct acpi_device * device, int type); | 90 | typedef int (*acpi_op_remove) (struct acpi_device * device, int type); |
91 | typedef int (*acpi_op_lock) (struct acpi_device * device, int type); | ||
92 | typedef int (*acpi_op_start) (struct acpi_device * device); | 91 | typedef int (*acpi_op_start) (struct acpi_device * device); |
93 | typedef int (*acpi_op_stop) (struct acpi_device * device, int type); | 92 | typedef int (*acpi_op_stop) (struct acpi_device * device, int type); |
94 | typedef int (*acpi_op_suspend) (struct acpi_device * device, | 93 | typedef int (*acpi_op_suspend) (struct acpi_device * device, |
95 | pm_message_t state); | 94 | pm_message_t state); |
96 | typedef int (*acpi_op_resume) (struct acpi_device * device); | 95 | typedef int (*acpi_op_resume) (struct acpi_device * device); |
97 | typedef int (*acpi_op_scan) (struct acpi_device * device); | ||
98 | typedef int (*acpi_op_bind) (struct acpi_device * device); | 96 | typedef int (*acpi_op_bind) (struct acpi_device * device); |
99 | typedef int (*acpi_op_unbind) (struct acpi_device * device); | 97 | typedef int (*acpi_op_unbind) (struct acpi_device * device); |
100 | typedef int (*acpi_op_shutdown) (struct acpi_device * device); | 98 | typedef void (*acpi_op_notify) (struct acpi_device * device, u32 event); |
101 | 99 | ||
102 | struct acpi_bus_ops { | 100 | struct acpi_bus_ops { |
103 | u32 acpi_op_add:1; | 101 | u32 acpi_op_add:1; |
104 | u32 acpi_op_remove:1; | ||
105 | u32 acpi_op_lock:1; | ||
106 | u32 acpi_op_start:1; | 102 | u32 acpi_op_start:1; |
107 | u32 acpi_op_stop:1; | ||
108 | u32 acpi_op_suspend:1; | ||
109 | u32 acpi_op_resume:1; | ||
110 | u32 acpi_op_scan:1; | ||
111 | u32 acpi_op_bind:1; | ||
112 | u32 acpi_op_unbind:1; | ||
113 | u32 acpi_op_shutdown:1; | ||
114 | u32 reserved:21; | ||
115 | }; | 103 | }; |
116 | 104 | ||
117 | struct acpi_device_ops { | 105 | struct acpi_device_ops { |
118 | acpi_op_add add; | 106 | acpi_op_add add; |
119 | acpi_op_remove remove; | 107 | acpi_op_remove remove; |
120 | acpi_op_lock lock; | ||
121 | acpi_op_start start; | 108 | acpi_op_start start; |
122 | acpi_op_stop stop; | 109 | acpi_op_stop stop; |
123 | acpi_op_suspend suspend; | 110 | acpi_op_suspend suspend; |
124 | acpi_op_resume resume; | 111 | acpi_op_resume resume; |
125 | acpi_op_scan scan; | ||
126 | acpi_op_bind bind; | 112 | acpi_op_bind bind; |
127 | acpi_op_unbind unbind; | 113 | acpi_op_unbind unbind; |
128 | acpi_op_shutdown shutdown; | 114 | acpi_op_notify notify; |
129 | }; | 115 | }; |
130 | 116 | ||
131 | struct acpi_driver { | 117 | struct acpi_driver { |
diff --git a/include/acpi/acpi_drivers.h b/include/acpi/acpi_drivers.h index 5fc1bb0f4a9..0352c8f0b05 100644 --- a/include/acpi/acpi_drivers.h +++ b/include/acpi/acpi_drivers.h | |||
@@ -67,6 +67,16 @@ | |||
67 | #define ACPI_BAY_HID "LNXIOBAY" | 67 | #define ACPI_BAY_HID "LNXIOBAY" |
68 | #define ACPI_DOCK_HID "LNXDOCK" | 68 | #define ACPI_DOCK_HID "LNXDOCK" |
69 | 69 | ||
70 | /* | ||
71 | * For fixed hardware buttons, we fabricate acpi_devices with HID | ||
72 | * ACPI_BUTTON_HID_POWERF or ACPI_BUTTON_HID_SLEEPF. Fixed hardware | ||
73 | * signals only an event; it doesn't supply a notification value. | ||
74 | * To allow drivers to treat notifications from fixed hardware the | ||
75 | * same as those from real devices, we turn the events into this | ||
76 | * notification value. | ||
77 | */ | ||
78 | #define ACPI_FIXED_HARDWARE_EVENT 0x100 | ||
79 | |||
70 | /* -------------------------------------------------------------------------- | 80 | /* -------------------------------------------------------------------------- |
71 | PCI | 81 | PCI |
72 | -------------------------------------------------------------------------- */ | 82 | -------------------------------------------------------------------------- */ |
@@ -99,24 +109,6 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_device *device, int domain, | |||
99 | int bus); | 109 | int bus); |
100 | 110 | ||
101 | /* -------------------------------------------------------------------------- | 111 | /* -------------------------------------------------------------------------- |
102 | Power Resource | ||
103 | -------------------------------------------------------------------------- */ | ||
104 | |||
105 | int acpi_device_sleep_wake(struct acpi_device *dev, | ||
106 | int enable, int sleep_state, int dev_state); | ||
107 | int acpi_enable_wakeup_device_power(struct acpi_device *dev, int sleep_state); | ||
108 | int acpi_disable_wakeup_device_power(struct acpi_device *dev); | ||
109 | int acpi_power_get_inferred_state(struct acpi_device *device); | ||
110 | int acpi_power_transition(struct acpi_device *device, int state); | ||
111 | extern int acpi_power_nocheck; | ||
112 | |||
113 | /* -------------------------------------------------------------------------- | ||
114 | Embedded Controller | ||
115 | -------------------------------------------------------------------------- */ | ||
116 | int acpi_ec_ecdt_probe(void); | ||
117 | int acpi_boot_ec_enable(void); | ||
118 | |||
119 | /* -------------------------------------------------------------------------- | ||
120 | Processor | 112 | Processor |
121 | -------------------------------------------------------------------------- */ | 113 | -------------------------------------------------------------------------- */ |
122 | 114 | ||
@@ -165,9 +157,4 @@ static inline void unregister_hotplug_dock_device(acpi_handle handle) | |||
165 | } | 157 | } |
166 | #endif | 158 | #endif |
167 | 159 | ||
168 | /*-------------------------------------------------------------------------- | ||
169 | Suspend/Resume | ||
170 | -------------------------------------------------------------------------- */ | ||
171 | extern int acpi_sleep_init(void); | ||
172 | |||
173 | #endif /*__ACPI_DRIVERS_H__*/ | 160 | #endif /*__ACPI_DRIVERS_H__*/ |
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h index ab0b85cf21f..3e798593b17 100644 --- a/include/acpi/acpiosxf.h +++ b/include/acpi/acpiosxf.h | |||
@@ -242,10 +242,6 @@ acpi_os_derive_pci_id(acpi_handle rhandle, | |||
242 | acpi_status acpi_os_validate_interface(char *interface); | 242 | acpi_status acpi_os_validate_interface(char *interface); |
243 | acpi_status acpi_osi_invalidate(char* interface); | 243 | acpi_status acpi_osi_invalidate(char* interface); |
244 | 244 | ||
245 | acpi_status | ||
246 | acpi_os_validate_address(u8 space_id, acpi_physical_address address, | ||
247 | acpi_size length, char *name); | ||
248 | |||
249 | u64 acpi_os_get_timer(void); | 245 | u64 acpi_os_get_timer(void); |
250 | 246 | ||
251 | acpi_status acpi_os_signal(u32 function, void *info); | 247 | acpi_status acpi_os_signal(u32 function, void *info); |
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index cc40102fe2f..aeaf7cd41dc 100644 --- a/include/acpi/acpixf.h +++ b/include/acpi/acpixf.h | |||
@@ -47,7 +47,7 @@ | |||
47 | 47 | ||
48 | /* Current ACPICA subsystem version in YYYYMMDD format */ | 48 | /* Current ACPICA subsystem version in YYYYMMDD format */ |
49 | 49 | ||
50 | #define ACPI_CA_VERSION 0x20081204 | 50 | #define ACPI_CA_VERSION 0x20090320 |
51 | 51 | ||
52 | #include "actypes.h" | 52 | #include "actypes.h" |
53 | #include "actbl.h" | 53 | #include "actbl.h" |
@@ -349,17 +349,15 @@ acpi_resource_to_address64(struct acpi_resource *resource, | |||
349 | */ | 349 | */ |
350 | acpi_status acpi_reset(void); | 350 | acpi_status acpi_reset(void); |
351 | 351 | ||
352 | acpi_status acpi_get_register(u32 register_id, u32 * return_value); | 352 | acpi_status acpi_read_bit_register(u32 register_id, u32 *return_value); |
353 | 353 | ||
354 | acpi_status acpi_get_register_unlocked(u32 register_id, u32 *return_value); | 354 | acpi_status acpi_write_bit_register(u32 register_id, u32 value); |
355 | 355 | ||
356 | acpi_status acpi_set_register(u32 register_id, u32 value); | 356 | acpi_status acpi_set_firmware_waking_vector(u32 physical_address); |
357 | 357 | ||
358 | acpi_status | 358 | #if ACPI_MACHINE_WIDTH == 64 |
359 | acpi_set_firmware_waking_vector(u32 physical_address); | 359 | acpi_status acpi_set_firmware_waking_vector64(u64 physical_address); |
360 | 360 | #endif | |
361 | acpi_status | ||
362 | acpi_set_firmware_waking_vector64(u64 physical_address); | ||
363 | 361 | ||
364 | acpi_status acpi_read(u32 *value, struct acpi_generic_address *reg); | 362 | acpi_status acpi_read(u32 *value, struct acpi_generic_address *reg); |
365 | 363 | ||
diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h index bf8d4cfd8cf..222733d01f3 100644 --- a/include/acpi/actbl.h +++ b/include/acpi/actbl.h | |||
@@ -214,11 +214,11 @@ struct acpi_table_fadt { | |||
214 | u16 flush_size; /* Processor's memory cache line width, in bytes */ | 214 | u16 flush_size; /* Processor's memory cache line width, in bytes */ |
215 | u16 flush_stride; /* Number of flush strides that need to be read */ | 215 | u16 flush_stride; /* Number of flush strides that need to be read */ |
216 | u8 duty_offset; /* Processor duty cycle index in processor's P_CNT reg */ | 216 | u8 duty_offset; /* Processor duty cycle index in processor's P_CNT reg */ |
217 | u8 duty_width; /* Processor duty cycle value bit width in P_CNT register. */ | 217 | u8 duty_width; /* Processor duty cycle value bit width in P_CNT register */ |
218 | u8 day_alarm; /* Index to day-of-month alarm in RTC CMOS RAM */ | 218 | u8 day_alarm; /* Index to day-of-month alarm in RTC CMOS RAM */ |
219 | u8 month_alarm; /* Index to month-of-year alarm in RTC CMOS RAM */ | 219 | u8 month_alarm; /* Index to month-of-year alarm in RTC CMOS RAM */ |
220 | u8 century; /* Index to century in RTC CMOS RAM */ | 220 | u8 century; /* Index to century in RTC CMOS RAM */ |
221 | u16 boot_flags; /* IA-PC Boot Architecture Flags. See Table 5-10 for description */ | 221 | u16 boot_flags; /* IA-PC Boot Architecture Flags (see below for individual flags) */ |
222 | u8 reserved; /* Reserved, must be zero */ | 222 | u8 reserved; /* Reserved, must be zero */ |
223 | u32 flags; /* Miscellaneous flag bits (see below for individual flags) */ | 223 | u32 flags; /* Miscellaneous flag bits (see below for individual flags) */ |
224 | struct acpi_generic_address reset_register; /* 64-bit address of the Reset register */ | 224 | struct acpi_generic_address reset_register; /* 64-bit address of the Reset register */ |
@@ -236,32 +236,41 @@ struct acpi_table_fadt { | |||
236 | struct acpi_generic_address xgpe1_block; /* 64-bit Extended General Purpose Event 1 Reg Blk address */ | 236 | struct acpi_generic_address xgpe1_block; /* 64-bit Extended General Purpose Event 1 Reg Blk address */ |
237 | }; | 237 | }; |
238 | 238 | ||
239 | /* FADT Boot Architecture Flags (boot_flags) */ | ||
240 | |||
241 | #define ACPI_FADT_LEGACY_DEVICES (1) /* 00: [V2] System has LPC or ISA bus devices */ | ||
242 | #define ACPI_FADT_8042 (1<<1) /* 01: [V3] System has an 8042 controller on port 60/64 */ | ||
243 | #define ACPI_FADT_NO_VGA (1<<2) /* 02: [V4] It is not safe to probe for VGA hardware */ | ||
244 | #define ACPI_FADT_NO_MSI (1<<3) /* 03: [V4] Message Signaled Interrupts (MSI) must not be enabled */ | ||
245 | #define ACPI_FADT_NO_ASPM (1<<4) /* 04: [V4] PCIe ASPM control must not be enabled */ | ||
246 | |||
247 | #define FADT2_REVISION_ID 3 | ||
248 | |||
239 | /* FADT flags */ | 249 | /* FADT flags */ |
240 | 250 | ||
241 | #define ACPI_FADT_WBINVD (1) /* 00: The wbinvd instruction works properly */ | 251 | #define ACPI_FADT_WBINVD (1) /* 00: [V1] The wbinvd instruction works properly */ |
242 | #define ACPI_FADT_WBINVD_FLUSH (1<<1) /* 01: The wbinvd flushes but does not invalidate */ | 252 | #define ACPI_FADT_WBINVD_FLUSH (1<<1) /* 01: [V1] wbinvd flushes but does not invalidate caches */ |
243 | #define ACPI_FADT_C1_SUPPORTED (1<<2) /* 02: All processors support C1 state */ | 253 | #define ACPI_FADT_C1_SUPPORTED (1<<2) /* 02: [V1] All processors support C1 state */ |
244 | #define ACPI_FADT_C2_MP_SUPPORTED (1<<3) /* 03: C2 state works on MP system */ | 254 | #define ACPI_FADT_C2_MP_SUPPORTED (1<<3) /* 03: [V1] C2 state works on MP system */ |
245 | #define ACPI_FADT_POWER_BUTTON (1<<4) /* 04: Power button is handled as a generic feature */ | 255 | #define ACPI_FADT_POWER_BUTTON (1<<4) /* 04: [V1] Power button is handled as a control method device */ |
246 | #define ACPI_FADT_SLEEP_BUTTON (1<<5) /* 05: Sleep button is handled as a generic feature, or not present */ | 256 | #define ACPI_FADT_SLEEP_BUTTON (1<<5) /* 05: [V1] Sleep button is handled as a control method device */ |
247 | #define ACPI_FADT_FIXED_RTC (1<<6) /* 06: RTC wakeup stat not in fixed register space */ | 257 | #define ACPI_FADT_FIXED_RTC (1<<6) /* 06: [V1] RTC wakeup status not in fixed register space */ |
248 | #define ACPI_FADT_S4_RTC_WAKE (1<<7) /* 07: RTC wakeup possible from S4 */ | 258 | #define ACPI_FADT_S4_RTC_WAKE (1<<7) /* 07: [V1] RTC alarm can wake system from S4 */ |
249 | #define ACPI_FADT_32BIT_TIMER (1<<8) /* 08: tmr_val is 32 bits 0=24-bits */ | 259 | #define ACPI_FADT_32BIT_TIMER (1<<8) /* 08: [V1] ACPI timer width is 32-bit (0=24-bit) */ |
250 | #define ACPI_FADT_DOCKING_SUPPORTED (1<<9) /* 09: Docking supported */ | 260 | #define ACPI_FADT_DOCKING_SUPPORTED (1<<9) /* 09: [V1] Docking supported */ |
251 | #define ACPI_FADT_RESET_REGISTER (1<<10) /* 10: System reset via the FADT RESET_REG supported */ | 261 | #define ACPI_FADT_RESET_REGISTER (1<<10) /* 10: [V2] System reset via the FADT RESET_REG supported */ |
252 | #define ACPI_FADT_SEALED_CASE (1<<11) /* 11: No internal expansion capabilities and case is sealed */ | 262 | #define ACPI_FADT_SEALED_CASE (1<<11) /* 11: [V3] No internal expansion capabilities and case is sealed */ |
253 | #define ACPI_FADT_HEADLESS (1<<12) /* 12: No local video capabilities or local input devices */ | 263 | #define ACPI_FADT_HEADLESS (1<<12) /* 12: [V3] No local video capabilities or local input devices */ |
254 | #define ACPI_FADT_SLEEP_TYPE (1<<13) /* 13: Must execute native instruction after writing SLP_TYPx register */ | 264 | #define ACPI_FADT_SLEEP_TYPE (1<<13) /* 13: [V3] Must execute native instruction after writing SLP_TYPx register */ |
255 | #define ACPI_FADT_PCI_EXPRESS_WAKE (1<<14) /* 14: System supports PCIEXP_WAKE (STS/EN) bits (ACPI 3.0) */ | 265 | #define ACPI_FADT_PCI_EXPRESS_WAKE (1<<14) /* 14: [V4] System supports PCIEXP_WAKE (STS/EN) bits (ACPI 3.0) */ |
256 | #define ACPI_FADT_PLATFORM_CLOCK (1<<15) /* 15: OSPM should use platform-provided timer (ACPI 3.0) */ | 266 | #define ACPI_FADT_PLATFORM_CLOCK (1<<15) /* 15: [V4] OSPM should use platform-provided timer (ACPI 3.0) */ |
257 | #define ACPI_FADT_S4_RTC_VALID (1<<16) /* 16: Contents of RTC_STS valid after S4 wake (ACPI 3.0) */ | 267 | #define ACPI_FADT_S4_RTC_VALID (1<<16) /* 16: [V4] Contents of RTC_STS valid after S4 wake (ACPI 3.0) */ |
258 | #define ACPI_FADT_REMOTE_POWER_ON (1<<17) /* 17: System is compatible with remote power on (ACPI 3.0) */ | 268 | #define ACPI_FADT_REMOTE_POWER_ON (1<<17) /* 17: [V4] System is compatible with remote power on (ACPI 3.0) */ |
259 | #define ACPI_FADT_APIC_CLUSTER (1<<18) /* 18: All local APICs must use cluster model (ACPI 3.0) */ | 269 | #define ACPI_FADT_APIC_CLUSTER (1<<18) /* 18: [V4] All local APICs must use cluster model (ACPI 3.0) */ |
260 | #define ACPI_FADT_APIC_PHYSICAL (1<<19) /* 19: All local x_aPICs must use physical dest mode (ACPI 3.0) */ | 270 | #define ACPI_FADT_APIC_PHYSICAL (1<<19) /* 19: [V4] All local x_aPICs must use physical dest mode (ACPI 3.0) */ |
271 | |||
272 | /* FADT Prefered Power Management Profiles */ | ||
261 | 273 | ||
262 | /* | ||
263 | * FADT Prefered Power Management Profiles | ||
264 | */ | ||
265 | enum acpi_prefered_pm_profiles { | 274 | enum acpi_prefered_pm_profiles { |
266 | PM_UNSPECIFIED = 0, | 275 | PM_UNSPECIFIED = 0, |
267 | PM_DESKTOP = 1, | 276 | PM_DESKTOP = 1, |
@@ -272,16 +281,6 @@ enum acpi_prefered_pm_profiles { | |||
272 | PM_APPLIANCE_PC = 6 | 281 | PM_APPLIANCE_PC = 6 |
273 | }; | 282 | }; |
274 | 283 | ||
275 | /* FADT Boot Arch Flags */ | ||
276 | |||
277 | #define BAF_LEGACY_DEVICES 0x0001 | ||
278 | #define BAF_8042_KEYBOARD_CONTROLLER 0x0002 | ||
279 | #define BAF_MSI_NOT_SUPPORTED 0x0008 | ||
280 | #define BAF_PCIE_ASPM_CONTROL 0x0010 | ||
281 | |||
282 | #define FADT2_REVISION_ID 3 | ||
283 | #define FADT2_MINUS_REVISION_ID 2 | ||
284 | |||
285 | /* Reset to default packing */ | 284 | /* Reset to default packing */ |
286 | 285 | ||
287 | #pragma pack() | 286 | #pragma pack() |
@@ -310,8 +309,9 @@ struct acpi_table_desc { | |||
310 | #define ACPI_TABLE_ORIGIN_UNKNOWN (0) | 309 | #define ACPI_TABLE_ORIGIN_UNKNOWN (0) |
311 | #define ACPI_TABLE_ORIGIN_MAPPED (1) | 310 | #define ACPI_TABLE_ORIGIN_MAPPED (1) |
312 | #define ACPI_TABLE_ORIGIN_ALLOCATED (2) | 311 | #define ACPI_TABLE_ORIGIN_ALLOCATED (2) |
313 | #define ACPI_TABLE_ORIGIN_MASK (3) | 312 | #define ACPI_TABLE_ORIGIN_OVERRIDE (4) |
314 | #define ACPI_TABLE_IS_LOADED (4) | 313 | #define ACPI_TABLE_ORIGIN_MASK (7) |
314 | #define ACPI_TABLE_IS_LOADED (8) | ||
315 | 315 | ||
316 | /* | 316 | /* |
317 | * Get the remaining ACPI tables | 317 | * Get the remaining ACPI tables |
diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h index 18963b96811..59ade075247 100644 --- a/include/acpi/actbl1.h +++ b/include/acpi/actbl1.h | |||
@@ -1016,9 +1016,9 @@ struct acpi_madt_interrupt_source { | |||
1016 | struct acpi_madt_local_x2apic { | 1016 | struct acpi_madt_local_x2apic { |
1017 | struct acpi_subtable_header header; | 1017 | struct acpi_subtable_header header; |
1018 | u16 reserved; /* Reserved - must be zero */ | 1018 | u16 reserved; /* Reserved - must be zero */ |
1019 | u32 local_apic_id; /* Processor X2_APIC ID */ | 1019 | u32 local_apic_id; /* Processor x2APIC ID */ |
1020 | u32 lapic_flags; | 1020 | u32 lapic_flags; |
1021 | u32 uid; /* Extended X2_APIC processor ID */ | 1021 | u32 uid; /* ACPI processor UID */ |
1022 | }; | 1022 | }; |
1023 | 1023 | ||
1024 | /* 10: Local X2APIC NMI (07/2008) */ | 1024 | /* 10: Local X2APIC NMI (07/2008) */ |
@@ -1026,7 +1026,7 @@ struct acpi_madt_local_x2apic { | |||
1026 | struct acpi_madt_local_x2apic_nmi { | 1026 | struct acpi_madt_local_x2apic_nmi { |
1027 | struct acpi_subtable_header header; | 1027 | struct acpi_subtable_header header; |
1028 | u16 inti_flags; | 1028 | u16 inti_flags; |
1029 | u32 uid; /* Processor X2_APIC ID */ | 1029 | u32 uid; /* ACPI processor UID */ |
1030 | u8 lint; /* LINTn to which NMI is connected */ | 1030 | u8 lint; /* LINTn to which NMI is connected */ |
1031 | u8 reserved[3]; | 1031 | u8 reserved[3]; |
1032 | }; | 1032 | }; |
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h index a20aab51017..f555d927f7c 100644 --- a/include/acpi/actypes.h +++ b/include/acpi/actypes.h | |||
@@ -777,17 +777,25 @@ typedef u8 acpi_adr_space_type; | |||
777 | #define ACPI_BITREG_SCI_ENABLE 0x0E | 777 | #define ACPI_BITREG_SCI_ENABLE 0x0E |
778 | #define ACPI_BITREG_BUS_MASTER_RLD 0x0F | 778 | #define ACPI_BITREG_BUS_MASTER_RLD 0x0F |
779 | #define ACPI_BITREG_GLOBAL_LOCK_RELEASE 0x10 | 779 | #define ACPI_BITREG_GLOBAL_LOCK_RELEASE 0x10 |
780 | #define ACPI_BITREG_SLEEP_TYPE_A 0x11 | 780 | #define ACPI_BITREG_SLEEP_TYPE 0x11 |
781 | #define ACPI_BITREG_SLEEP_TYPE_B 0x12 | 781 | #define ACPI_BITREG_SLEEP_ENABLE 0x12 |
782 | #define ACPI_BITREG_SLEEP_ENABLE 0x13 | ||
783 | 782 | ||
784 | /* PM2 Control register */ | 783 | /* PM2 Control register */ |
785 | 784 | ||
786 | #define ACPI_BITREG_ARB_DISABLE 0x14 | 785 | #define ACPI_BITREG_ARB_DISABLE 0x13 |
787 | 786 | ||
788 | #define ACPI_BITREG_MAX 0x14 | 787 | #define ACPI_BITREG_MAX 0x13 |
789 | #define ACPI_NUM_BITREG ACPI_BITREG_MAX + 1 | 788 | #define ACPI_NUM_BITREG ACPI_BITREG_MAX + 1 |
790 | 789 | ||
790 | /* Status register values. A 1 clears a status bit. 0 = no effect */ | ||
791 | |||
792 | #define ACPI_CLEAR_STATUS 1 | ||
793 | |||
794 | /* Enable and Control register values */ | ||
795 | |||
796 | #define ACPI_ENABLE_EVENT 1 | ||
797 | #define ACPI_DISABLE_EVENT 0 | ||
798 | |||
791 | /* | 799 | /* |
792 | * External ACPI object definition | 800 | * External ACPI object definition |
793 | */ | 801 | */ |
diff --git a/include/acpi/processor.h b/include/acpi/processor.h index 0574add2a1e..b09c4fde972 100644 --- a/include/acpi/processor.h +++ b/include/acpi/processor.h | |||
@@ -322,7 +322,7 @@ static inline int acpi_processor_ppc_has_changed(struct acpi_processor *pr) | |||
322 | int acpi_processor_tstate_has_changed(struct acpi_processor *pr); | 322 | int acpi_processor_tstate_has_changed(struct acpi_processor *pr); |
323 | int acpi_processor_get_throttling_info(struct acpi_processor *pr); | 323 | int acpi_processor_get_throttling_info(struct acpi_processor *pr); |
324 | extern int acpi_processor_set_throttling(struct acpi_processor *pr, int state); | 324 | extern int acpi_processor_set_throttling(struct acpi_processor *pr, int state); |
325 | extern struct file_operations acpi_processor_throttling_fops; | 325 | extern const struct file_operations acpi_processor_throttling_fops; |
326 | extern void acpi_processor_throttling_init(void); | 326 | extern void acpi_processor_throttling_init(void); |
327 | /* in processor_idle.c */ | 327 | /* in processor_idle.c */ |
328 | int acpi_processor_power_init(struct acpi_processor *pr, | 328 | int acpi_processor_power_init(struct acpi_processor *pr, |
@@ -336,7 +336,7 @@ extern struct cpuidle_driver acpi_idle_driver; | |||
336 | 336 | ||
337 | /* in processor_thermal.c */ | 337 | /* in processor_thermal.c */ |
338 | int acpi_processor_get_limit_info(struct acpi_processor *pr); | 338 | int acpi_processor_get_limit_info(struct acpi_processor *pr); |
339 | extern struct file_operations acpi_processor_limit_fops; | 339 | extern const struct file_operations acpi_processor_limit_fops; |
340 | extern struct thermal_cooling_device_ops processor_cooling_ops; | 340 | extern struct thermal_cooling_device_ops processor_cooling_ops; |
341 | #ifdef CONFIG_CPU_FREQ | 341 | #ifdef CONFIG_CPU_FREQ |
342 | void acpi_thermal_cpufreq_init(void); | 342 | void acpi_thermal_cpufreq_init(void); |
diff --git a/include/acpi/video.h b/include/acpi/video.h new file mode 100644 index 00000000000..f0275bb79ce --- /dev/null +++ b/include/acpi/video.h | |||
@@ -0,0 +1,11 @@ | |||
1 | #ifndef __ACPI_VIDEO_H | ||
2 | #define __ACPI_VIDEO_H | ||
3 | |||
4 | #if (defined CONFIG_ACPI_VIDEO || defined CONFIG_ACPI_VIDEO_MODULE) | ||
5 | extern int acpi_video_register(void); | ||
6 | #else | ||
7 | static inline int acpi_video_register(void) { return 0; } | ||
8 | #endif | ||
9 | |||
10 | #endif | ||
11 | |||
diff --git a/include/asm-frv/ftrace.h b/include/asm-frv/ftrace.h new file mode 100644 index 00000000000..40a8c178f10 --- /dev/null +++ b/include/asm-frv/ftrace.h | |||
@@ -0,0 +1 @@ | |||
/* empty */ | |||
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index a654d724d3b..7fa660fd449 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h | |||
@@ -61,6 +61,30 @@ | |||
61 | #define BRANCH_PROFILE() | 61 | #define BRANCH_PROFILE() |
62 | #endif | 62 | #endif |
63 | 63 | ||
64 | #ifdef CONFIG_EVENT_TRACER | ||
65 | #define FTRACE_EVENTS() VMLINUX_SYMBOL(__start_ftrace_events) = .; \ | ||
66 | *(_ftrace_events) \ | ||
67 | VMLINUX_SYMBOL(__stop_ftrace_events) = .; | ||
68 | #else | ||
69 | #define FTRACE_EVENTS() | ||
70 | #endif | ||
71 | |||
72 | #ifdef CONFIG_TRACING | ||
73 | #define TRACE_PRINTKS() VMLINUX_SYMBOL(__start___trace_bprintk_fmt) = .; \ | ||
74 | *(__trace_printk_fmt) /* Trace_printk fmt' pointer */ \ | ||
75 | VMLINUX_SYMBOL(__stop___trace_bprintk_fmt) = .; | ||
76 | #else | ||
77 | #define TRACE_PRINTKS() | ||
78 | #endif | ||
79 | |||
80 | #ifdef CONFIG_FTRACE_SYSCALLS | ||
81 | #define TRACE_SYSCALLS() VMLINUX_SYMBOL(__start_syscalls_metadata) = .; \ | ||
82 | *(__syscalls_metadata) \ | ||
83 | VMLINUX_SYMBOL(__stop_syscalls_metadata) = .; | ||
84 | #else | ||
85 | #define TRACE_SYSCALLS() | ||
86 | #endif | ||
87 | |||
64 | /* .data section */ | 88 | /* .data section */ |
65 | #define DATA_DATA \ | 89 | #define DATA_DATA \ |
66 | *(.data) \ | 90 | *(.data) \ |
@@ -86,7 +110,10 @@ | |||
86 | *(__verbose) \ | 110 | *(__verbose) \ |
87 | VMLINUX_SYMBOL(__stop___verbose) = .; \ | 111 | VMLINUX_SYMBOL(__stop___verbose) = .; \ |
88 | LIKELY_PROFILE() \ | 112 | LIKELY_PROFILE() \ |
89 | BRANCH_PROFILE() | 113 | BRANCH_PROFILE() \ |
114 | TRACE_PRINTKS() \ | ||
115 | FTRACE_EVENTS() \ | ||
116 | TRACE_SYSCALLS() | ||
90 | 117 | ||
91 | #define RO_DATA(align) \ | 118 | #define RO_DATA(align) \ |
92 | . = ALIGN((align)); \ | 119 | . = ALIGN((align)); \ |
diff --git a/include/asm-m32r/ftrace.h b/include/asm-m32r/ftrace.h new file mode 100644 index 00000000000..40a8c178f10 --- /dev/null +++ b/include/asm-m32r/ftrace.h | |||
@@ -0,0 +1 @@ | |||
/* empty */ | |||
diff --git a/include/asm-mn10300/ftrace.h b/include/asm-mn10300/ftrace.h new file mode 100644 index 00000000000..40a8c178f10 --- /dev/null +++ b/include/asm-mn10300/ftrace.h | |||
@@ -0,0 +1 @@ | |||
/* empty */ | |||
diff --git a/include/linux/acpi.h b/include/linux/acpi.h index d047f846c3e..6586cbd0d4a 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h | |||
@@ -97,6 +97,7 @@ void acpi_table_print_madt_entry (struct acpi_subtable_header *madt); | |||
97 | /* the following four functions are architecture-dependent */ | 97 | /* the following four functions are architecture-dependent */ |
98 | void acpi_numa_slit_init (struct acpi_table_slit *slit); | 98 | void acpi_numa_slit_init (struct acpi_table_slit *slit); |
99 | void acpi_numa_processor_affinity_init (struct acpi_srat_cpu_affinity *pa); | 99 | void acpi_numa_processor_affinity_init (struct acpi_srat_cpu_affinity *pa); |
100 | void acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa); | ||
100 | void acpi_numa_memory_affinity_init (struct acpi_srat_mem_affinity *ma); | 101 | void acpi_numa_memory_affinity_init (struct acpi_srat_mem_affinity *ma); |
101 | void acpi_numa_arch_fixup(void); | 102 | void acpi_numa_arch_fixup(void); |
102 | 103 | ||
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h index 6e915878e88..d960889e92e 100644 --- a/include/linux/blktrace_api.h +++ b/include/linux/blktrace_api.h | |||
@@ -144,6 +144,9 @@ struct blk_user_trace_setup { | |||
144 | 144 | ||
145 | #ifdef __KERNEL__ | 145 | #ifdef __KERNEL__ |
146 | #if defined(CONFIG_BLK_DEV_IO_TRACE) | 146 | #if defined(CONFIG_BLK_DEV_IO_TRACE) |
147 | |||
148 | #include <linux/sysfs.h> | ||
149 | |||
147 | struct blk_trace { | 150 | struct blk_trace { |
148 | int trace_state; | 151 | int trace_state; |
149 | struct rchan *rchan; | 152 | struct rchan *rchan; |
@@ -194,6 +197,8 @@ extern int blk_trace_setup(struct request_queue *q, char *name, dev_t dev, | |||
194 | extern int blk_trace_startstop(struct request_queue *q, int start); | 197 | extern int blk_trace_startstop(struct request_queue *q, int start); |
195 | extern int blk_trace_remove(struct request_queue *q); | 198 | extern int blk_trace_remove(struct request_queue *q); |
196 | 199 | ||
200 | extern struct attribute_group blk_trace_attr_group; | ||
201 | |||
197 | #else /* !CONFIG_BLK_DEV_IO_TRACE */ | 202 | #else /* !CONFIG_BLK_DEV_IO_TRACE */ |
198 | #define blk_trace_ioctl(bdev, cmd, arg) (-ENOTTY) | 203 | #define blk_trace_ioctl(bdev, cmd, arg) (-ENOTTY) |
199 | #define blk_trace_shutdown(q) do { } while (0) | 204 | #define blk_trace_shutdown(q) do { } while (0) |
diff --git a/include/linux/compat.h b/include/linux/compat.h index 9723edd6455..f2ded21f9a3 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h | |||
@@ -193,10 +193,10 @@ asmlinkage ssize_t compat_sys_writev(unsigned long fd, | |||
193 | const struct compat_iovec __user *vec, unsigned long vlen); | 193 | const struct compat_iovec __user *vec, unsigned long vlen); |
194 | asmlinkage ssize_t compat_sys_preadv(unsigned long fd, | 194 | asmlinkage ssize_t compat_sys_preadv(unsigned long fd, |
195 | const struct compat_iovec __user *vec, | 195 | const struct compat_iovec __user *vec, |
196 | unsigned long vlen, u32 pos_high, u32 pos_low); | 196 | unsigned long vlen, u32 pos_low, u32 pos_high); |
197 | asmlinkage ssize_t compat_sys_pwritev(unsigned long fd, | 197 | asmlinkage ssize_t compat_sys_pwritev(unsigned long fd, |
198 | const struct compat_iovec __user *vec, | 198 | const struct compat_iovec __user *vec, |
199 | unsigned long vlen, u32 pos_high, u32 pos_low); | 199 | unsigned long vlen, u32 pos_low, u32 pos_high); |
200 | 200 | ||
201 | int compat_do_execve(char * filename, compat_uptr_t __user *argv, | 201 | int compat_do_execve(char * filename, compat_uptr_t __user *argv, |
202 | compat_uptr_t __user *envp, struct pt_regs * regs); | 202 | compat_uptr_t __user *envp, struct pt_regs * regs); |
diff --git a/include/linux/compiler.h b/include/linux/compiler.h index d95da1020f1..6faa7e549de 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h | |||
@@ -68,6 +68,7 @@ struct ftrace_branch_data { | |||
68 | unsigned long miss; | 68 | unsigned long miss; |
69 | unsigned long hit; | 69 | unsigned long hit; |
70 | }; | 70 | }; |
71 | unsigned long miss_hit[2]; | ||
71 | }; | 72 | }; |
72 | }; | 73 | }; |
73 | 74 | ||
@@ -125,10 +126,7 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect); | |||
125 | .line = __LINE__, \ | 126 | .line = __LINE__, \ |
126 | }; \ | 127 | }; \ |
127 | ______r = !!(cond); \ | 128 | ______r = !!(cond); \ |
128 | if (______r) \ | 129 | ______f.miss_hit[______r]++; \ |
129 | ______f.hit++; \ | ||
130 | else \ | ||
131 | ______f.miss++; \ | ||
132 | ______r; \ | 130 | ______r; \ |
133 | })) | 131 | })) |
134 | #endif /* CONFIG_PROFILE_ALL_BRANCHES */ | 132 | #endif /* CONFIG_PROFILE_ALL_BRANCHES */ |
diff --git a/include/linux/connector.h b/include/linux/connector.h index fc65d219d88..b9966e64604 100644 --- a/include/linux/connector.h +++ b/include/linux/connector.h | |||
@@ -39,8 +39,10 @@ | |||
39 | #define CN_IDX_V86D 0x4 | 39 | #define CN_IDX_V86D 0x4 |
40 | #define CN_VAL_V86D_UVESAFB 0x1 | 40 | #define CN_VAL_V86D_UVESAFB 0x1 |
41 | #define CN_IDX_BB 0x5 /* BlackBoard, from the TSP GPL sampling framework */ | 41 | #define CN_IDX_BB 0x5 /* BlackBoard, from the TSP GPL sampling framework */ |
42 | #define CN_DST_IDX 0x6 | ||
43 | #define CN_DST_VAL 0x1 | ||
42 | 44 | ||
43 | #define CN_NETLINK_USERS 6 | 45 | #define CN_NETLINK_USERS 7 |
44 | 46 | ||
45 | /* | 47 | /* |
46 | * Maximum connector's message size. | 48 | * Maximum connector's message size. |
diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h index af0e01d4c66..eb5c2ba2f81 100644 --- a/include/linux/debugfs.h +++ b/include/linux/debugfs.h | |||
@@ -71,6 +71,9 @@ struct dentry *debugfs_create_bool(const char *name, mode_t mode, | |||
71 | struct dentry *debugfs_create_blob(const char *name, mode_t mode, | 71 | struct dentry *debugfs_create_blob(const char *name, mode_t mode, |
72 | struct dentry *parent, | 72 | struct dentry *parent, |
73 | struct debugfs_blob_wrapper *blob); | 73 | struct debugfs_blob_wrapper *blob); |
74 | |||
75 | bool debugfs_initialized(void); | ||
76 | |||
74 | #else | 77 | #else |
75 | 78 | ||
76 | #include <linux/err.h> | 79 | #include <linux/err.h> |
@@ -183,6 +186,11 @@ static inline struct dentry *debugfs_create_blob(const char *name, mode_t mode, | |||
183 | return ERR_PTR(-ENODEV); | 186 | return ERR_PTR(-ENODEV); |
184 | } | 187 | } |
185 | 188 | ||
189 | static inline bool debugfs_initialized(void) | ||
190 | { | ||
191 | return false; | ||
192 | } | ||
193 | |||
186 | #endif | 194 | #endif |
187 | 195 | ||
188 | #endif | 196 | #endif |
diff --git a/include/linux/dst.h b/include/linux/dst.h new file mode 100644 index 00000000000..e26fed84b1a --- /dev/null +++ b/include/linux/dst.h | |||
@@ -0,0 +1,587 @@ | |||
1 | /* | ||
2 | * 2007+ Copyright (c) Evgeniy Polyakov <johnpol@2ka.mipt.ru> | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | */ | ||
15 | |||
16 | #ifndef __DST_H | ||
17 | #define __DST_H | ||
18 | |||
19 | #include <linux/types.h> | ||
20 | #include <linux/connector.h> | ||
21 | |||
22 | #define DST_NAMELEN 32 | ||
23 | #define DST_NAME "dst" | ||
24 | |||
25 | enum { | ||
26 | /* Remove node with given id from storage */ | ||
27 | DST_DEL_NODE = 0, | ||
28 | /* Add remote node with given id to the storage */ | ||
29 | DST_ADD_REMOTE, | ||
30 | /* Add local node with given id to the storage to be exported and used by remote peers */ | ||
31 | DST_ADD_EXPORT, | ||
32 | /* Crypto initialization command (hash/cipher used to protect the connection) */ | ||
33 | DST_CRYPTO, | ||
34 | /* Security attributes for given connection (permissions for example) */ | ||
35 | DST_SECURITY, | ||
36 | /* Register given node in the block layer subsystem */ | ||
37 | DST_START, | ||
38 | DST_CMD_MAX | ||
39 | }; | ||
40 | |||
41 | struct dst_ctl | ||
42 | { | ||
43 | /* Storage name */ | ||
44 | char name[DST_NAMELEN]; | ||
45 | /* Command flags */ | ||
46 | __u32 flags; | ||
47 | /* Command itself (see above) */ | ||
48 | __u32 cmd; | ||
49 | /* Maximum number of pages per single request in this device */ | ||
50 | __u32 max_pages; | ||
51 | /* Stale/error transaction scanning timeout in milliseconds */ | ||
52 | __u32 trans_scan_timeout; | ||
53 | /* Maximum number of retry sends before completing transaction as broken */ | ||
54 | __u32 trans_max_retries; | ||
55 | /* Storage size */ | ||
56 | __u64 size; | ||
57 | }; | ||
58 | |||
59 | /* Reply command carries completion status */ | ||
60 | struct dst_ctl_ack | ||
61 | { | ||
62 | struct cn_msg msg; | ||
63 | int error; | ||
64 | int unused[3]; | ||
65 | }; | ||
66 | |||
67 | /* | ||
68 | * Unfortunaltely socket address structure is not exported to userspace | ||
69 | * and is redefined there. | ||
70 | */ | ||
71 | #define SADDR_MAX_DATA 128 | ||
72 | |||
73 | struct saddr { | ||
74 | /* address family, AF_xxx */ | ||
75 | unsigned short sa_family; | ||
76 | /* 14 bytes of protocol address */ | ||
77 | char sa_data[SADDR_MAX_DATA]; | ||
78 | /* Number of bytes used in sa_data */ | ||
79 | unsigned short sa_data_len; | ||
80 | }; | ||
81 | |||
82 | /* Address structure */ | ||
83 | struct dst_network_ctl | ||
84 | { | ||
85 | /* Socket type: datagram, stream...*/ | ||
86 | unsigned int type; | ||
87 | /* Let me guess, is it a Jupiter diameter? */ | ||
88 | unsigned int proto; | ||
89 | /* Peer's address */ | ||
90 | struct saddr addr; | ||
91 | }; | ||
92 | |||
93 | struct dst_crypto_ctl | ||
94 | { | ||
95 | /* Cipher and hash names */ | ||
96 | char cipher_algo[DST_NAMELEN]; | ||
97 | char hash_algo[DST_NAMELEN]; | ||
98 | |||
99 | /* Key sizes. Can be zero for digest for example */ | ||
100 | unsigned int cipher_keysize, hash_keysize; | ||
101 | /* Alignment. Calculated by the DST itself. */ | ||
102 | unsigned int crypto_attached_size; | ||
103 | /* Number of threads to perform crypto operations */ | ||
104 | int thread_num; | ||
105 | }; | ||
106 | |||
107 | /* Export security attributes have this bits checked in when client connects */ | ||
108 | #define DST_PERM_READ (1<<0) | ||
109 | #define DST_PERM_WRITE (1<<1) | ||
110 | |||
111 | /* | ||
112 | * Right now it is simple model, where each remote address | ||
113 | * is assigned to set of permissions it is allowed to perform. | ||
114 | * In real world block device does not know anything but | ||
115 | * reading and writing, so it should be more than enough. | ||
116 | */ | ||
117 | struct dst_secure_user | ||
118 | { | ||
119 | unsigned int permissions; | ||
120 | struct saddr addr; | ||
121 | }; | ||
122 | |||
123 | /* | ||
124 | * Export control command: device to export and network address to accept | ||
125 | * clients to work with given device | ||
126 | */ | ||
127 | struct dst_export_ctl | ||
128 | { | ||
129 | char device[DST_NAMELEN]; | ||
130 | struct dst_network_ctl ctl; | ||
131 | }; | ||
132 | |||
133 | enum { | ||
134 | DST_CFG = 1, /* Request remote configuration */ | ||
135 | DST_IO, /* IO command */ | ||
136 | DST_IO_RESPONSE, /* IO response */ | ||
137 | DST_PING, /* Keepalive message */ | ||
138 | DST_NCMD_MAX, | ||
139 | }; | ||
140 | |||
141 | struct dst_cmd | ||
142 | { | ||
143 | /* Network command itself, see above */ | ||
144 | __u32 cmd; | ||
145 | /* | ||
146 | * Size of the attached data | ||
147 | * (in most cases, for READ command it means how many bytes were requested) | ||
148 | */ | ||
149 | __u32 size; | ||
150 | /* Crypto size: number of attached bytes with digest/hmac */ | ||
151 | __u32 csize; | ||
152 | /* Here we can carry secret data */ | ||
153 | __u32 reserved; | ||
154 | /* Read/write bits, see how they are encoded in bio structure */ | ||
155 | __u64 rw; | ||
156 | /* BIO flags */ | ||
157 | __u64 flags; | ||
158 | /* Unique command id (like transaction ID) */ | ||
159 | __u64 id; | ||
160 | /* Sector to start IO from */ | ||
161 | __u64 sector; | ||
162 | /* Hash data is placed after this header */ | ||
163 | __u8 hash[0]; | ||
164 | }; | ||
165 | |||
166 | /* | ||
167 | * Convert command to/from network byte order. | ||
168 | * We do not use hton*() functions, since there is | ||
169 | * no 64-bit implementation. | ||
170 | */ | ||
171 | static inline void dst_convert_cmd(struct dst_cmd *c) | ||
172 | { | ||
173 | c->cmd = __cpu_to_be32(c->cmd); | ||
174 | c->csize = __cpu_to_be32(c->csize); | ||
175 | c->size = __cpu_to_be32(c->size); | ||
176 | c->sector = __cpu_to_be64(c->sector); | ||
177 | c->id = __cpu_to_be64(c->id); | ||
178 | c->flags = __cpu_to_be64(c->flags); | ||
179 | c->rw = __cpu_to_be64(c->rw); | ||
180 | } | ||
181 | |||
182 | /* Transaction id */ | ||
183 | typedef __u64 dst_gen_t; | ||
184 | |||
185 | #ifdef __KERNEL__ | ||
186 | |||
187 | #include <linux/blkdev.h> | ||
188 | #include <linux/bio.h> | ||
189 | #include <linux/device.h> | ||
190 | #include <linux/mempool.h> | ||
191 | #include <linux/net.h> | ||
192 | #include <linux/poll.h> | ||
193 | #include <linux/rbtree.h> | ||
194 | |||
195 | #ifdef CONFIG_DST_DEBUG | ||
196 | #define dprintk(f, a...) printk(KERN_NOTICE f, ##a) | ||
197 | #else | ||
198 | static inline void __attribute__ ((format (printf, 1, 2))) | ||
199 | dprintk(const char *fmt, ...) {} | ||
200 | #endif | ||
201 | |||
202 | struct dst_node; | ||
203 | |||
204 | struct dst_trans | ||
205 | { | ||
206 | /* DST node we are working with */ | ||
207 | struct dst_node *n; | ||
208 | |||
209 | /* Entry inside transaction tree */ | ||
210 | struct rb_node trans_entry; | ||
211 | |||
212 | /* Merlin kills this transaction when this memory cell equals zero */ | ||
213 | atomic_t refcnt; | ||
214 | |||
215 | /* How this transaction should be processed by crypto engine */ | ||
216 | short enc; | ||
217 | /* How many times this transaction was resent */ | ||
218 | short retries; | ||
219 | /* Completion status */ | ||
220 | int error; | ||
221 | |||
222 | /* When did we send it to the remote peer */ | ||
223 | long send_time; | ||
224 | |||
225 | /* My name is... | ||
226 | * Well, computers does not speak, they have unique id instead */ | ||
227 | dst_gen_t gen; | ||
228 | |||
229 | /* Block IO we are working with */ | ||
230 | struct bio *bio; | ||
231 | |||
232 | /* Network command for above block IO request */ | ||
233 | struct dst_cmd cmd; | ||
234 | }; | ||
235 | |||
236 | struct dst_crypto_engine | ||
237 | { | ||
238 | /* What should we do with all block requests */ | ||
239 | struct crypto_hash *hash; | ||
240 | struct crypto_ablkcipher *cipher; | ||
241 | |||
242 | /* Pool of pages used to encrypt data into before sending */ | ||
243 | int page_num; | ||
244 | struct page **pages; | ||
245 | |||
246 | /* What to do with current request */ | ||
247 | int enc; | ||
248 | /* Who we are and where do we go */ | ||
249 | struct scatterlist *src, *dst; | ||
250 | |||
251 | /* Maximum timeout waiting for encryption to be completed */ | ||
252 | long timeout; | ||
253 | /* IV is a 64-bit sequential counter */ | ||
254 | u64 iv; | ||
255 | |||
256 | /* Secret data */ | ||
257 | void *private; | ||
258 | |||
259 | /* Cached temporary data lives here */ | ||
260 | int size; | ||
261 | void *data; | ||
262 | }; | ||
263 | |||
264 | struct dst_state | ||
265 | { | ||
266 | /* The main state protection */ | ||
267 | struct mutex state_lock; | ||
268 | |||
269 | /* Polling machinery for sockets */ | ||
270 | wait_queue_t wait; | ||
271 | wait_queue_head_t *whead; | ||
272 | /* Most of events are being waited here */ | ||
273 | wait_queue_head_t thread_wait; | ||
274 | |||
275 | /* Who owns this? */ | ||
276 | struct dst_node *node; | ||
277 | |||
278 | /* Network address for this state */ | ||
279 | struct dst_network_ctl ctl; | ||
280 | |||
281 | /* Permissions to work with: read-only or rw connection */ | ||
282 | u32 permissions; | ||
283 | |||
284 | /* Called when we need to clean private data */ | ||
285 | void (* cleanup)(struct dst_state *st); | ||
286 | |||
287 | /* Used by the server: BIO completion queues BIOs here */ | ||
288 | struct list_head request_list; | ||
289 | spinlock_t request_lock; | ||
290 | |||
291 | /* Guess what? No, it is not number of planets */ | ||
292 | atomic_t refcnt; | ||
293 | |||
294 | /* This flags is set when connection should be dropped */ | ||
295 | int need_exit; | ||
296 | |||
297 | /* | ||
298 | * Socket to work with. Second pointer is used for | ||
299 | * lockless check if socket was changed before performing | ||
300 | * next action (like working with cached polling result) | ||
301 | */ | ||
302 | struct socket *socket, *read_socket; | ||
303 | |||
304 | /* Cached preallocated data */ | ||
305 | void *data; | ||
306 | unsigned int size; | ||
307 | |||
308 | /* Currently processed command */ | ||
309 | struct dst_cmd cmd; | ||
310 | }; | ||
311 | |||
312 | struct dst_info | ||
313 | { | ||
314 | /* Device size */ | ||
315 | u64 size; | ||
316 | |||
317 | /* Local device name for export devices */ | ||
318 | char local[DST_NAMELEN]; | ||
319 | |||
320 | /* Network setup */ | ||
321 | struct dst_network_ctl net; | ||
322 | |||
323 | /* Sysfs bits use this */ | ||
324 | struct device device; | ||
325 | }; | ||
326 | |||
327 | struct dst_node | ||
328 | { | ||
329 | struct list_head node_entry; | ||
330 | |||
331 | /* Hi, my name is stored here */ | ||
332 | char name[DST_NAMELEN]; | ||
333 | /* My cache name is stored here */ | ||
334 | char cache_name[DST_NAMELEN]; | ||
335 | |||
336 | /* Block device attached to given node. | ||
337 | * Only valid for exporting nodes */ | ||
338 | struct block_device *bdev; | ||
339 | /* Network state machine for given peer */ | ||
340 | struct dst_state *state; | ||
341 | |||
342 | /* Block IO machinery */ | ||
343 | struct request_queue *queue; | ||
344 | struct gendisk *disk; | ||
345 | |||
346 | /* Number of threads in processing pool */ | ||
347 | int thread_num; | ||
348 | /* Maximum number of pages in single IO */ | ||
349 | int max_pages; | ||
350 | |||
351 | /* I'm that big in bytes */ | ||
352 | loff_t size; | ||
353 | |||
354 | /* Exported to userspace node information */ | ||
355 | struct dst_info *info; | ||
356 | |||
357 | /* | ||
358 | * Security attribute list. | ||
359 | * Used only by exporting node currently. | ||
360 | */ | ||
361 | struct list_head security_list; | ||
362 | struct mutex security_lock; | ||
363 | |||
364 | /* | ||
365 | * When this unerflows below zero, university collapses. | ||
366 | * But this will not happen, since node will be freed, | ||
367 | * when reference counter reaches zero. | ||
368 | */ | ||
369 | atomic_t refcnt; | ||
370 | |||
371 | /* How precisely should I be started? */ | ||
372 | int (*start)(struct dst_node *); | ||
373 | |||
374 | /* Crypto capabilities */ | ||
375 | struct dst_crypto_ctl crypto; | ||
376 | u8 *hash_key; | ||
377 | u8 *cipher_key; | ||
378 | |||
379 | /* Pool of processing thread */ | ||
380 | struct thread_pool *pool; | ||
381 | |||
382 | /* Transaction IDs live here */ | ||
383 | atomic_long_t gen; | ||
384 | |||
385 | /* | ||
386 | * How frequently and how many times transaction | ||
387 | * tree should be scanned to drop stale objects. | ||
388 | */ | ||
389 | long trans_scan_timeout; | ||
390 | int trans_max_retries; | ||
391 | |||
392 | /* Small gnomes live here */ | ||
393 | struct rb_root trans_root; | ||
394 | struct mutex trans_lock; | ||
395 | |||
396 | /* | ||
397 | * Transaction cache/memory pool. | ||
398 | * It is big enough to contain not only transaction | ||
399 | * itself, but additional crypto data (digest/hmac). | ||
400 | */ | ||
401 | struct kmem_cache *trans_cache; | ||
402 | mempool_t *trans_pool; | ||
403 | |||
404 | /* This entity scans transaction tree */ | ||
405 | struct delayed_work trans_work; | ||
406 | |||
407 | wait_queue_head_t wait; | ||
408 | }; | ||
409 | |||
410 | /* Kernel representation of the security attribute */ | ||
411 | struct dst_secure | ||
412 | { | ||
413 | struct list_head sec_entry; | ||
414 | struct dst_secure_user sec; | ||
415 | }; | ||
416 | |||
417 | int dst_process_bio(struct dst_node *n, struct bio *bio); | ||
418 | |||
419 | int dst_node_init_connected(struct dst_node *n, struct dst_network_ctl *r); | ||
420 | int dst_node_init_listened(struct dst_node *n, struct dst_export_ctl *le); | ||
421 | |||
422 | static inline struct dst_state *dst_state_get(struct dst_state *st) | ||
423 | { | ||
424 | BUG_ON(atomic_read(&st->refcnt) == 0); | ||
425 | atomic_inc(&st->refcnt); | ||
426 | return st; | ||
427 | } | ||
428 | |||
429 | void dst_state_put(struct dst_state *st); | ||
430 | |||
431 | struct dst_state *dst_state_alloc(struct dst_node *n); | ||
432 | int dst_state_socket_create(struct dst_state *st); | ||
433 | void dst_state_socket_release(struct dst_state *st); | ||
434 | |||
435 | void dst_state_exit_connected(struct dst_state *st); | ||
436 | |||
437 | int dst_state_schedule_receiver(struct dst_state *st); | ||
438 | |||
439 | void dst_dump_addr(struct socket *sk, struct sockaddr *sa, char *str); | ||
440 | |||
441 | static inline void dst_state_lock(struct dst_state *st) | ||
442 | { | ||
443 | mutex_lock(&st->state_lock); | ||
444 | } | ||
445 | |||
446 | static inline void dst_state_unlock(struct dst_state *st) | ||
447 | { | ||
448 | mutex_unlock(&st->state_lock); | ||
449 | } | ||
450 | |||
451 | void dst_poll_exit(struct dst_state *st); | ||
452 | int dst_poll_init(struct dst_state *st); | ||
453 | |||
454 | static inline unsigned int dst_state_poll(struct dst_state *st) | ||
455 | { | ||
456 | unsigned int revents = POLLHUP | POLLERR; | ||
457 | |||
458 | dst_state_lock(st); | ||
459 | if (st->socket) | ||
460 | revents = st->socket->ops->poll(NULL, st->socket, NULL); | ||
461 | dst_state_unlock(st); | ||
462 | |||
463 | return revents; | ||
464 | } | ||
465 | |||
466 | static inline int dst_thread_setup(void *private, void *data) | ||
467 | { | ||
468 | return 0; | ||
469 | } | ||
470 | |||
471 | void dst_node_put(struct dst_node *n); | ||
472 | |||
473 | static inline struct dst_node *dst_node_get(struct dst_node *n) | ||
474 | { | ||
475 | atomic_inc(&n->refcnt); | ||
476 | return n; | ||
477 | } | ||
478 | |||
479 | int dst_data_recv(struct dst_state *st, void *data, unsigned int size); | ||
480 | int dst_recv_cdata(struct dst_state *st, void *cdata); | ||
481 | int dst_data_send_header(struct socket *sock, | ||
482 | void *data, unsigned int size, int more); | ||
483 | |||
484 | int dst_send_bio(struct dst_state *st, struct dst_cmd *cmd, struct bio *bio); | ||
485 | |||
486 | int dst_process_io(struct dst_state *st); | ||
487 | int dst_export_crypto(struct dst_node *n, struct bio *bio); | ||
488 | int dst_export_send_bio(struct bio *bio); | ||
489 | int dst_start_export(struct dst_node *n); | ||
490 | |||
491 | int __init dst_export_init(void); | ||
492 | void dst_export_exit(void); | ||
493 | |||
494 | /* Private structure for export block IO requests */ | ||
495 | struct dst_export_priv | ||
496 | { | ||
497 | struct list_head request_entry; | ||
498 | struct dst_state *state; | ||
499 | struct bio *bio; | ||
500 | struct dst_cmd cmd; | ||
501 | }; | ||
502 | |||
503 | static inline void dst_trans_get(struct dst_trans *t) | ||
504 | { | ||
505 | atomic_inc(&t->refcnt); | ||
506 | } | ||
507 | |||
508 | struct dst_trans *dst_trans_search(struct dst_node *node, dst_gen_t gen); | ||
509 | int dst_trans_remove(struct dst_trans *t); | ||
510 | int dst_trans_remove_nolock(struct dst_trans *t); | ||
511 | void dst_trans_put(struct dst_trans *t); | ||
512 | |||
513 | /* | ||
514 | * Convert bio into network command. | ||
515 | */ | ||
516 | static inline void dst_bio_to_cmd(struct bio *bio, struct dst_cmd *cmd, | ||
517 | u32 command, u64 id) | ||
518 | { | ||
519 | cmd->cmd = command; | ||
520 | cmd->flags = (bio->bi_flags << BIO_POOL_BITS) >> BIO_POOL_BITS; | ||
521 | cmd->rw = bio->bi_rw; | ||
522 | cmd->size = bio->bi_size; | ||
523 | cmd->csize = 0; | ||
524 | cmd->id = id; | ||
525 | cmd->sector = bio->bi_sector; | ||
526 | }; | ||
527 | |||
528 | int dst_trans_send(struct dst_trans *t); | ||
529 | int dst_trans_crypto(struct dst_trans *t); | ||
530 | |||
531 | int dst_node_crypto_init(struct dst_node *n, struct dst_crypto_ctl *ctl); | ||
532 | void dst_node_crypto_exit(struct dst_node *n); | ||
533 | |||
534 | static inline int dst_need_crypto(struct dst_node *n) | ||
535 | { | ||
536 | struct dst_crypto_ctl *c = &n->crypto; | ||
537 | /* | ||
538 | * Logical OR is appropriate here, but boolean one produces | ||
539 | * more optimal code, so it is used instead. | ||
540 | */ | ||
541 | return (c->hash_algo[0] | c->cipher_algo[0]); | ||
542 | } | ||
543 | |||
544 | int dst_node_trans_init(struct dst_node *n, unsigned int size); | ||
545 | void dst_node_trans_exit(struct dst_node *n); | ||
546 | |||
547 | /* | ||
548 | * Pool of threads. | ||
549 | * Ready list contains threads currently free to be used, | ||
550 | * active one contains threads with some work scheduled for them. | ||
551 | * Caller can wait in given queue when thread is ready. | ||
552 | */ | ||
553 | struct thread_pool | ||
554 | { | ||
555 | int thread_num; | ||
556 | struct mutex thread_lock; | ||
557 | struct list_head ready_list, active_list; | ||
558 | |||
559 | wait_queue_head_t wait; | ||
560 | }; | ||
561 | |||
562 | void thread_pool_del_worker(struct thread_pool *p); | ||
563 | void thread_pool_del_worker_id(struct thread_pool *p, unsigned int id); | ||
564 | int thread_pool_add_worker(struct thread_pool *p, | ||
565 | char *name, | ||
566 | unsigned int id, | ||
567 | void *(* init)(void *data), | ||
568 | void (* cleanup)(void *data), | ||
569 | void *data); | ||
570 | |||
571 | void thread_pool_destroy(struct thread_pool *p); | ||
572 | struct thread_pool *thread_pool_create(int num, char *name, | ||
573 | void *(* init)(void *data), | ||
574 | void (* cleanup)(void *data), | ||
575 | void *data); | ||
576 | |||
577 | int thread_pool_schedule(struct thread_pool *p, | ||
578 | int (* setup)(void *stored_private, void *setup_data), | ||
579 | int (* action)(void *stored_private, void *setup_data), | ||
580 | void *setup_data, long timeout); | ||
581 | int thread_pool_schedule_private(struct thread_pool *p, | ||
582 | int (* setup)(void *private, void *data), | ||
583 | int (* action)(void *private, void *data), | ||
584 | void *data, long timeout, void *id); | ||
585 | |||
586 | #endif /* __KERNEL__ */ | ||
587 | #endif /* __DST_H */ | ||
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h index a7f8134c594..015a3d22cf7 100644 --- a/include/linux/ftrace.h +++ b/include/linux/ftrace.h | |||
@@ -1,15 +1,18 @@ | |||
1 | #ifndef _LINUX_FTRACE_H | 1 | #ifndef _LINUX_FTRACE_H |
2 | #define _LINUX_FTRACE_H | 2 | #define _LINUX_FTRACE_H |
3 | 3 | ||
4 | #include <linux/linkage.h> | 4 | #include <linux/trace_clock.h> |
5 | #include <linux/fs.h> | ||
6 | #include <linux/ktime.h> | ||
7 | #include <linux/init.h> | ||
8 | #include <linux/types.h> | ||
9 | #include <linux/module.h> | ||
10 | #include <linux/kallsyms.h> | 5 | #include <linux/kallsyms.h> |
6 | #include <linux/linkage.h> | ||
11 | #include <linux/bitops.h> | 7 | #include <linux/bitops.h> |
8 | #include <linux/module.h> | ||
9 | #include <linux/ktime.h> | ||
12 | #include <linux/sched.h> | 10 | #include <linux/sched.h> |
11 | #include <linux/types.h> | ||
12 | #include <linux/init.h> | ||
13 | #include <linux/fs.h> | ||
14 | |||
15 | #include <asm/ftrace.h> | ||
13 | 16 | ||
14 | #ifdef CONFIG_FUNCTION_TRACER | 17 | #ifdef CONFIG_FUNCTION_TRACER |
15 | 18 | ||
@@ -95,9 +98,41 @@ stack_trace_sysctl(struct ctl_table *table, int write, | |||
95 | loff_t *ppos); | 98 | loff_t *ppos); |
96 | #endif | 99 | #endif |
97 | 100 | ||
101 | struct ftrace_func_command { | ||
102 | struct list_head list; | ||
103 | char *name; | ||
104 | int (*func)(char *func, char *cmd, | ||
105 | char *params, int enable); | ||
106 | }; | ||
107 | |||
98 | #ifdef CONFIG_DYNAMIC_FTRACE | 108 | #ifdef CONFIG_DYNAMIC_FTRACE |
99 | /* asm/ftrace.h must be defined for archs supporting dynamic ftrace */ | 109 | |
100 | #include <asm/ftrace.h> | 110 | int ftrace_arch_code_modify_prepare(void); |
111 | int ftrace_arch_code_modify_post_process(void); | ||
112 | |||
113 | struct seq_file; | ||
114 | |||
115 | struct ftrace_probe_ops { | ||
116 | void (*func)(unsigned long ip, | ||
117 | unsigned long parent_ip, | ||
118 | void **data); | ||
119 | int (*callback)(unsigned long ip, void **data); | ||
120 | void (*free)(void **data); | ||
121 | int (*print)(struct seq_file *m, | ||
122 | unsigned long ip, | ||
123 | struct ftrace_probe_ops *ops, | ||
124 | void *data); | ||
125 | }; | ||
126 | |||
127 | extern int | ||
128 | register_ftrace_function_probe(char *glob, struct ftrace_probe_ops *ops, | ||
129 | void *data); | ||
130 | extern void | ||
131 | unregister_ftrace_function_probe(char *glob, struct ftrace_probe_ops *ops, | ||
132 | void *data); | ||
133 | extern void | ||
134 | unregister_ftrace_function_probe_func(char *glob, struct ftrace_probe_ops *ops); | ||
135 | extern void unregister_ftrace_function_probe_all(char *glob); | ||
101 | 136 | ||
102 | enum { | 137 | enum { |
103 | FTRACE_FL_FREE = (1 << 0), | 138 | FTRACE_FL_FREE = (1 << 0), |
@@ -110,15 +145,23 @@ enum { | |||
110 | }; | 145 | }; |
111 | 146 | ||
112 | struct dyn_ftrace { | 147 | struct dyn_ftrace { |
113 | struct list_head list; | 148 | union { |
114 | unsigned long ip; /* address of mcount call-site */ | 149 | unsigned long ip; /* address of mcount call-site */ |
115 | unsigned long flags; | 150 | struct dyn_ftrace *freelist; |
116 | struct dyn_arch_ftrace arch; | 151 | }; |
152 | union { | ||
153 | unsigned long flags; | ||
154 | struct dyn_ftrace *newlist; | ||
155 | }; | ||
156 | struct dyn_arch_ftrace arch; | ||
117 | }; | 157 | }; |
118 | 158 | ||
119 | int ftrace_force_update(void); | 159 | int ftrace_force_update(void); |
120 | void ftrace_set_filter(unsigned char *buf, int len, int reset); | 160 | void ftrace_set_filter(unsigned char *buf, int len, int reset); |
121 | 161 | ||
162 | int register_ftrace_command(struct ftrace_func_command *cmd); | ||
163 | int unregister_ftrace_command(struct ftrace_func_command *cmd); | ||
164 | |||
122 | /* defined in arch */ | 165 | /* defined in arch */ |
123 | extern int ftrace_ip_converted(unsigned long ip); | 166 | extern int ftrace_ip_converted(unsigned long ip); |
124 | extern int ftrace_dyn_arch_init(void *data); | 167 | extern int ftrace_dyn_arch_init(void *data); |
@@ -126,6 +169,10 @@ extern int ftrace_update_ftrace_func(ftrace_func_t func); | |||
126 | extern void ftrace_caller(void); | 169 | extern void ftrace_caller(void); |
127 | extern void ftrace_call(void); | 170 | extern void ftrace_call(void); |
128 | extern void mcount_call(void); | 171 | extern void mcount_call(void); |
172 | |||
173 | #ifndef FTRACE_ADDR | ||
174 | #define FTRACE_ADDR ((unsigned long)ftrace_caller) | ||
175 | #endif | ||
129 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER | 176 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER |
130 | extern void ftrace_graph_caller(void); | 177 | extern void ftrace_graph_caller(void); |
131 | extern int ftrace_enable_ftrace_graph_caller(void); | 178 | extern int ftrace_enable_ftrace_graph_caller(void); |
@@ -136,7 +183,7 @@ static inline int ftrace_disable_ftrace_graph_caller(void) { return 0; } | |||
136 | #endif | 183 | #endif |
137 | 184 | ||
138 | /** | 185 | /** |
139 | * ftrace_make_nop - convert code into top | 186 | * ftrace_make_nop - convert code into nop |
140 | * @mod: module structure if called by module load initialization | 187 | * @mod: module structure if called by module load initialization |
141 | * @rec: the mcount call site record | 188 | * @rec: the mcount call site record |
142 | * @addr: the address that the call site should be calling | 189 | * @addr: the address that the call site should be calling |
@@ -181,7 +228,6 @@ extern int ftrace_make_nop(struct module *mod, | |||
181 | */ | 228 | */ |
182 | extern int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr); | 229 | extern int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr); |
183 | 230 | ||
184 | |||
185 | /* May be defined in arch */ | 231 | /* May be defined in arch */ |
186 | extern int ftrace_arch_read_dyn_info(char *buf, int size); | 232 | extern int ftrace_arch_read_dyn_info(char *buf, int size); |
187 | 233 | ||
@@ -198,6 +244,14 @@ extern void ftrace_enable_daemon(void); | |||
198 | # define ftrace_disable_daemon() do { } while (0) | 244 | # define ftrace_disable_daemon() do { } while (0) |
199 | # define ftrace_enable_daemon() do { } while (0) | 245 | # define ftrace_enable_daemon() do { } while (0) |
200 | static inline void ftrace_release(void *start, unsigned long size) { } | 246 | static inline void ftrace_release(void *start, unsigned long size) { } |
247 | static inline int register_ftrace_command(struct ftrace_func_command *cmd) | ||
248 | { | ||
249 | return -EINVAL; | ||
250 | } | ||
251 | static inline int unregister_ftrace_command(char *cmd_name) | ||
252 | { | ||
253 | return -EINVAL; | ||
254 | } | ||
201 | #endif /* CONFIG_DYNAMIC_FTRACE */ | 255 | #endif /* CONFIG_DYNAMIC_FTRACE */ |
202 | 256 | ||
203 | /* totally disable ftrace - can not re-enable after this */ | 257 | /* totally disable ftrace - can not re-enable after this */ |
@@ -233,24 +287,25 @@ static inline void __ftrace_enabled_restore(int enabled) | |||
233 | #endif | 287 | #endif |
234 | } | 288 | } |
235 | 289 | ||
236 | #ifdef CONFIG_FRAME_POINTER | 290 | #ifndef HAVE_ARCH_CALLER_ADDR |
237 | /* TODO: need to fix this for ARM */ | 291 | # ifdef CONFIG_FRAME_POINTER |
238 | # define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0)) | 292 | # define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0)) |
239 | # define CALLER_ADDR1 ((unsigned long)__builtin_return_address(1)) | 293 | # define CALLER_ADDR1 ((unsigned long)__builtin_return_address(1)) |
240 | # define CALLER_ADDR2 ((unsigned long)__builtin_return_address(2)) | 294 | # define CALLER_ADDR2 ((unsigned long)__builtin_return_address(2)) |
241 | # define CALLER_ADDR3 ((unsigned long)__builtin_return_address(3)) | 295 | # define CALLER_ADDR3 ((unsigned long)__builtin_return_address(3)) |
242 | # define CALLER_ADDR4 ((unsigned long)__builtin_return_address(4)) | 296 | # define CALLER_ADDR4 ((unsigned long)__builtin_return_address(4)) |
243 | # define CALLER_ADDR5 ((unsigned long)__builtin_return_address(5)) | 297 | # define CALLER_ADDR5 ((unsigned long)__builtin_return_address(5)) |
244 | # define CALLER_ADDR6 ((unsigned long)__builtin_return_address(6)) | 298 | # define CALLER_ADDR6 ((unsigned long)__builtin_return_address(6)) |
245 | #else | 299 | # else |
246 | # define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0)) | 300 | # define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0)) |
247 | # define CALLER_ADDR1 0UL | 301 | # define CALLER_ADDR1 0UL |
248 | # define CALLER_ADDR2 0UL | 302 | # define CALLER_ADDR2 0UL |
249 | # define CALLER_ADDR3 0UL | 303 | # define CALLER_ADDR3 0UL |
250 | # define CALLER_ADDR4 0UL | 304 | # define CALLER_ADDR4 0UL |
251 | # define CALLER_ADDR5 0UL | 305 | # define CALLER_ADDR5 0UL |
252 | # define CALLER_ADDR6 0UL | 306 | # define CALLER_ADDR6 0UL |
253 | #endif | 307 | # endif |
308 | #endif /* ifndef HAVE_ARCH_CALLER_ADDR */ | ||
254 | 309 | ||
255 | #ifdef CONFIG_IRQSOFF_TRACER | 310 | #ifdef CONFIG_IRQSOFF_TRACER |
256 | extern void time_hardirqs_on(unsigned long a0, unsigned long a1); | 311 | extern void time_hardirqs_on(unsigned long a0, unsigned long a1); |
@@ -268,54 +323,6 @@ static inline void __ftrace_enabled_restore(int enabled) | |||
268 | # define trace_preempt_off(a0, a1) do { } while (0) | 323 | # define trace_preempt_off(a0, a1) do { } while (0) |
269 | #endif | 324 | #endif |
270 | 325 | ||
271 | #ifdef CONFIG_TRACING | ||
272 | extern int ftrace_dump_on_oops; | ||
273 | |||
274 | extern void tracing_start(void); | ||
275 | extern void tracing_stop(void); | ||
276 | extern void ftrace_off_permanent(void); | ||
277 | |||
278 | extern void | ||
279 | ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3); | ||
280 | |||
281 | /** | ||
282 | * ftrace_printk - printf formatting in the ftrace buffer | ||
283 | * @fmt: the printf format for printing | ||
284 | * | ||
285 | * Note: __ftrace_printk is an internal function for ftrace_printk and | ||
286 | * the @ip is passed in via the ftrace_printk macro. | ||
287 | * | ||
288 | * This function allows a kernel developer to debug fast path sections | ||
289 | * that printk is not appropriate for. By scattering in various | ||
290 | * printk like tracing in the code, a developer can quickly see | ||
291 | * where problems are occurring. | ||
292 | * | ||
293 | * This is intended as a debugging tool for the developer only. | ||
294 | * Please refrain from leaving ftrace_printks scattered around in | ||
295 | * your code. | ||
296 | */ | ||
297 | # define ftrace_printk(fmt...) __ftrace_printk(_THIS_IP_, fmt) | ||
298 | extern int | ||
299 | __ftrace_printk(unsigned long ip, const char *fmt, ...) | ||
300 | __attribute__ ((format (printf, 2, 3))); | ||
301 | extern void ftrace_dump(void); | ||
302 | #else | ||
303 | static inline void | ||
304 | ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3) { } | ||
305 | static inline int | ||
306 | ftrace_printk(const char *fmt, ...) __attribute__ ((format (printf, 1, 2))); | ||
307 | |||
308 | static inline void tracing_start(void) { } | ||
309 | static inline void tracing_stop(void) { } | ||
310 | static inline void ftrace_off_permanent(void) { } | ||
311 | static inline int | ||
312 | ftrace_printk(const char *fmt, ...) | ||
313 | { | ||
314 | return 0; | ||
315 | } | ||
316 | static inline void ftrace_dump(void) { } | ||
317 | #endif | ||
318 | |||
319 | #ifdef CONFIG_FTRACE_MCOUNT_RECORD | 326 | #ifdef CONFIG_FTRACE_MCOUNT_RECORD |
320 | extern void ftrace_init(void); | 327 | extern void ftrace_init(void); |
321 | extern void ftrace_init_module(struct module *mod, | 328 | extern void ftrace_init_module(struct module *mod, |
@@ -327,36 +334,6 @@ ftrace_init_module(struct module *mod, | |||
327 | unsigned long *start, unsigned long *end) { } | 334 | unsigned long *start, unsigned long *end) { } |
328 | #endif | 335 | #endif |
329 | 336 | ||
330 | enum { | ||
331 | POWER_NONE = 0, | ||
332 | POWER_CSTATE = 1, | ||
333 | POWER_PSTATE = 2, | ||
334 | }; | ||
335 | |||
336 | struct power_trace { | ||
337 | #ifdef CONFIG_POWER_TRACER | ||
338 | ktime_t stamp; | ||
339 | ktime_t end; | ||
340 | int type; | ||
341 | int state; | ||
342 | #endif | ||
343 | }; | ||
344 | |||
345 | #ifdef CONFIG_POWER_TRACER | ||
346 | extern void trace_power_start(struct power_trace *it, unsigned int type, | ||
347 | unsigned int state); | ||
348 | extern void trace_power_mark(struct power_trace *it, unsigned int type, | ||
349 | unsigned int state); | ||
350 | extern void trace_power_end(struct power_trace *it); | ||
351 | #else | ||
352 | static inline void trace_power_start(struct power_trace *it, unsigned int type, | ||
353 | unsigned int state) { } | ||
354 | static inline void trace_power_mark(struct power_trace *it, unsigned int type, | ||
355 | unsigned int state) { } | ||
356 | static inline void trace_power_end(struct power_trace *it) { } | ||
357 | #endif | ||
358 | |||
359 | |||
360 | /* | 337 | /* |
361 | * Structure that defines an entry function trace. | 338 | * Structure that defines an entry function trace. |
362 | */ | 339 | */ |
@@ -398,8 +375,7 @@ struct ftrace_ret_stack { | |||
398 | extern void return_to_handler(void); | 375 | extern void return_to_handler(void); |
399 | 376 | ||
400 | extern int | 377 | extern int |
401 | ftrace_push_return_trace(unsigned long ret, unsigned long long time, | 378 | ftrace_push_return_trace(unsigned long ret, unsigned long func, int *depth); |
402 | unsigned long func, int *depth); | ||
403 | extern void | 379 | extern void |
404 | ftrace_pop_return_trace(struct ftrace_graph_ret *trace, unsigned long *ret); | 380 | ftrace_pop_return_trace(struct ftrace_graph_ret *trace, unsigned long *ret); |
405 | 381 | ||
@@ -514,6 +490,50 @@ static inline int test_tsk_trace_graph(struct task_struct *tsk) | |||
514 | return tsk->trace & TSK_TRACE_FL_GRAPH; | 490 | return tsk->trace & TSK_TRACE_FL_GRAPH; |
515 | } | 491 | } |
516 | 492 | ||
493 | extern int ftrace_dump_on_oops; | ||
494 | |||
517 | #endif /* CONFIG_TRACING */ | 495 | #endif /* CONFIG_TRACING */ |
518 | 496 | ||
497 | |||
498 | #ifdef CONFIG_HW_BRANCH_TRACER | ||
499 | |||
500 | void trace_hw_branch(u64 from, u64 to); | ||
501 | void trace_hw_branch_oops(void); | ||
502 | |||
503 | #else /* CONFIG_HW_BRANCH_TRACER */ | ||
504 | |||
505 | static inline void trace_hw_branch(u64 from, u64 to) {} | ||
506 | static inline void trace_hw_branch_oops(void) {} | ||
507 | |||
508 | #endif /* CONFIG_HW_BRANCH_TRACER */ | ||
509 | |||
510 | /* | ||
511 | * A syscall entry in the ftrace syscalls array. | ||
512 | * | ||
513 | * @name: name of the syscall | ||
514 | * @nb_args: number of parameters it takes | ||
515 | * @types: list of types as strings | ||
516 | * @args: list of args as strings (args[i] matches types[i]) | ||
517 | */ | ||
518 | struct syscall_metadata { | ||
519 | const char *name; | ||
520 | int nb_args; | ||
521 | const char **types; | ||
522 | const char **args; | ||
523 | }; | ||
524 | |||
525 | #ifdef CONFIG_FTRACE_SYSCALLS | ||
526 | extern void arch_init_ftrace_syscalls(void); | ||
527 | extern struct syscall_metadata *syscall_nr_to_meta(int nr); | ||
528 | extern void start_ftrace_syscalls(void); | ||
529 | extern void stop_ftrace_syscalls(void); | ||
530 | extern void ftrace_syscall_enter(struct pt_regs *regs); | ||
531 | extern void ftrace_syscall_exit(struct pt_regs *regs); | ||
532 | #else | ||
533 | static inline void start_ftrace_syscalls(void) { } | ||
534 | static inline void stop_ftrace_syscalls(void) { } | ||
535 | static inline void ftrace_syscall_enter(struct pt_regs *regs) { } | ||
536 | static inline void ftrace_syscall_exit(struct pt_regs *regs) { } | ||
537 | #endif | ||
538 | |||
519 | #endif /* _LINUX_FTRACE_H */ | 539 | #endif /* _LINUX_FTRACE_H */ |
diff --git a/include/linux/ftrace_irq.h b/include/linux/ftrace_irq.h index 366a054d0b0..dca7bf8cffe 100644 --- a/include/linux/ftrace_irq.h +++ b/include/linux/ftrace_irq.h | |||
@@ -2,7 +2,7 @@ | |||
2 | #define _LINUX_FTRACE_IRQ_H | 2 | #define _LINUX_FTRACE_IRQ_H |
3 | 3 | ||
4 | 4 | ||
5 | #if defined(CONFIG_DYNAMIC_FTRACE) || defined(CONFIG_FUNCTION_GRAPH_TRACER) | 5 | #ifdef CONFIG_FTRACE_NMI_ENTER |
6 | extern void ftrace_nmi_enter(void); | 6 | extern void ftrace_nmi_enter(void); |
7 | extern void ftrace_nmi_exit(void); | 7 | extern void ftrace_nmi_exit(void); |
8 | #else | 8 | #else |
diff --git a/include/linux/gfp.h b/include/linux/gfp.h index dd20cd78faa..0bbc15f5453 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <linux/mmzone.h> | 4 | #include <linux/mmzone.h> |
5 | #include <linux/stddef.h> | 5 | #include <linux/stddef.h> |
6 | #include <linux/linkage.h> | 6 | #include <linux/linkage.h> |
7 | #include <linux/topology.h> | ||
7 | 8 | ||
8 | struct vm_area_struct; | 9 | struct vm_area_struct; |
9 | 10 | ||
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h index f83288347dd..faa1cf848bc 100644 --- a/include/linux/hardirq.h +++ b/include/linux/hardirq.h | |||
@@ -15,55 +15,61 @@ | |||
15 | * - bits 0-7 are the preemption count (max preemption depth: 256) | 15 | * - bits 0-7 are the preemption count (max preemption depth: 256) |
16 | * - bits 8-15 are the softirq count (max # of softirqs: 256) | 16 | * - bits 8-15 are the softirq count (max # of softirqs: 256) |
17 | * | 17 | * |
18 | * The hardirq count can be overridden per architecture, the default is: | 18 | * The hardirq count can in theory reach the same as NR_IRQS. |
19 | * In reality, the number of nested IRQS is limited to the stack | ||
20 | * size as well. For archs with over 1000 IRQS it is not practical | ||
21 | * to expect that they will all nest. We give a max of 10 bits for | ||
22 | * hardirq nesting. An arch may choose to give less than 10 bits. | ||
23 | * m68k expects it to be 8. | ||
19 | * | 24 | * |
20 | * - bits 16-27 are the hardirq count (max # of hardirqs: 4096) | 25 | * - bits 16-25 are the hardirq count (max # of nested hardirqs: 1024) |
21 | * - ( bit 28 is the PREEMPT_ACTIVE flag. ) | 26 | * - bit 26 is the NMI_MASK |
27 | * - bit 28 is the PREEMPT_ACTIVE flag | ||
22 | * | 28 | * |
23 | * PREEMPT_MASK: 0x000000ff | 29 | * PREEMPT_MASK: 0x000000ff |
24 | * SOFTIRQ_MASK: 0x0000ff00 | 30 | * SOFTIRQ_MASK: 0x0000ff00 |
25 | * HARDIRQ_MASK: 0x0fff0000 | 31 | * HARDIRQ_MASK: 0x03ff0000 |
32 | * NMI_MASK: 0x04000000 | ||
26 | */ | 33 | */ |
27 | #define PREEMPT_BITS 8 | 34 | #define PREEMPT_BITS 8 |
28 | #define SOFTIRQ_BITS 8 | 35 | #define SOFTIRQ_BITS 8 |
36 | #define NMI_BITS 1 | ||
29 | 37 | ||
30 | #ifndef HARDIRQ_BITS | 38 | #define MAX_HARDIRQ_BITS 10 |
31 | #define HARDIRQ_BITS 12 | ||
32 | 39 | ||
33 | #ifndef MAX_HARDIRQS_PER_CPU | 40 | #ifndef HARDIRQ_BITS |
34 | #define MAX_HARDIRQS_PER_CPU NR_IRQS | 41 | # define HARDIRQ_BITS MAX_HARDIRQ_BITS |
35 | #endif | 42 | #endif |
36 | 43 | ||
37 | /* | 44 | #if HARDIRQ_BITS > MAX_HARDIRQ_BITS |
38 | * The hardirq mask has to be large enough to have space for potentially | 45 | #error HARDIRQ_BITS too high! |
39 | * all IRQ sources in the system nesting on a single CPU. | ||
40 | */ | ||
41 | #if (1 << HARDIRQ_BITS) < MAX_HARDIRQS_PER_CPU | ||
42 | # error HARDIRQ_BITS is too low! | ||
43 | #endif | ||
44 | #endif | 46 | #endif |
45 | 47 | ||
46 | #define PREEMPT_SHIFT 0 | 48 | #define PREEMPT_SHIFT 0 |
47 | #define SOFTIRQ_SHIFT (PREEMPT_SHIFT + PREEMPT_BITS) | 49 | #define SOFTIRQ_SHIFT (PREEMPT_SHIFT + PREEMPT_BITS) |
48 | #define HARDIRQ_SHIFT (SOFTIRQ_SHIFT + SOFTIRQ_BITS) | 50 | #define HARDIRQ_SHIFT (SOFTIRQ_SHIFT + SOFTIRQ_BITS) |
51 | #define NMI_SHIFT (HARDIRQ_SHIFT + HARDIRQ_BITS) | ||
49 | 52 | ||
50 | #define __IRQ_MASK(x) ((1UL << (x))-1) | 53 | #define __IRQ_MASK(x) ((1UL << (x))-1) |
51 | 54 | ||
52 | #define PREEMPT_MASK (__IRQ_MASK(PREEMPT_BITS) << PREEMPT_SHIFT) | 55 | #define PREEMPT_MASK (__IRQ_MASK(PREEMPT_BITS) << PREEMPT_SHIFT) |
53 | #define SOFTIRQ_MASK (__IRQ_MASK(SOFTIRQ_BITS) << SOFTIRQ_SHIFT) | 56 | #define SOFTIRQ_MASK (__IRQ_MASK(SOFTIRQ_BITS) << SOFTIRQ_SHIFT) |
54 | #define HARDIRQ_MASK (__IRQ_MASK(HARDIRQ_BITS) << HARDIRQ_SHIFT) | 57 | #define HARDIRQ_MASK (__IRQ_MASK(HARDIRQ_BITS) << HARDIRQ_SHIFT) |
58 | #define NMI_MASK (__IRQ_MASK(NMI_BITS) << NMI_SHIFT) | ||
55 | 59 | ||
56 | #define PREEMPT_OFFSET (1UL << PREEMPT_SHIFT) | 60 | #define PREEMPT_OFFSET (1UL << PREEMPT_SHIFT) |
57 | #define SOFTIRQ_OFFSET (1UL << SOFTIRQ_SHIFT) | 61 | #define SOFTIRQ_OFFSET (1UL << SOFTIRQ_SHIFT) |
58 | #define HARDIRQ_OFFSET (1UL << HARDIRQ_SHIFT) | 62 | #define HARDIRQ_OFFSET (1UL << HARDIRQ_SHIFT) |
63 | #define NMI_OFFSET (1UL << NMI_SHIFT) | ||
59 | 64 | ||
60 | #if PREEMPT_ACTIVE < (1 << (HARDIRQ_SHIFT + HARDIRQ_BITS)) | 65 | #if PREEMPT_ACTIVE < (1 << (NMI_SHIFT + NMI_BITS)) |
61 | #error PREEMPT_ACTIVE is too low! | 66 | #error PREEMPT_ACTIVE is too low! |
62 | #endif | 67 | #endif |
63 | 68 | ||
64 | #define hardirq_count() (preempt_count() & HARDIRQ_MASK) | 69 | #define hardirq_count() (preempt_count() & HARDIRQ_MASK) |
65 | #define softirq_count() (preempt_count() & SOFTIRQ_MASK) | 70 | #define softirq_count() (preempt_count() & SOFTIRQ_MASK) |
66 | #define irq_count() (preempt_count() & (HARDIRQ_MASK | SOFTIRQ_MASK)) | 71 | #define irq_count() (preempt_count() & (HARDIRQ_MASK | SOFTIRQ_MASK \ |
72 | | NMI_MASK)) | ||
67 | 73 | ||
68 | /* | 74 | /* |
69 | * Are we doing bottom half or hardware interrupt processing? | 75 | * Are we doing bottom half or hardware interrupt processing? |
@@ -73,6 +79,11 @@ | |||
73 | #define in_softirq() (softirq_count()) | 79 | #define in_softirq() (softirq_count()) |
74 | #define in_interrupt() (irq_count()) | 80 | #define in_interrupt() (irq_count()) |
75 | 81 | ||
82 | /* | ||
83 | * Are we in NMI context? | ||
84 | */ | ||
85 | #define in_nmi() (preempt_count() & NMI_MASK) | ||
86 | |||
76 | #if defined(CONFIG_PREEMPT) | 87 | #if defined(CONFIG_PREEMPT) |
77 | # define PREEMPT_INATOMIC_BASE kernel_locked() | 88 | # define PREEMPT_INATOMIC_BASE kernel_locked() |
78 | # define PREEMPT_CHECK_OFFSET 1 | 89 | # define PREEMPT_CHECK_OFFSET 1 |
@@ -164,20 +175,24 @@ extern void irq_enter(void); | |||
164 | */ | 175 | */ |
165 | extern void irq_exit(void); | 176 | extern void irq_exit(void); |
166 | 177 | ||
167 | #define nmi_enter() \ | 178 | #define nmi_enter() \ |
168 | do { \ | 179 | do { \ |
169 | ftrace_nmi_enter(); \ | 180 | ftrace_nmi_enter(); \ |
170 | lockdep_off(); \ | 181 | BUG_ON(in_nmi()); \ |
171 | rcu_nmi_enter(); \ | 182 | add_preempt_count(NMI_OFFSET + HARDIRQ_OFFSET); \ |
172 | __irq_enter(); \ | 183 | lockdep_off(); \ |
184 | rcu_nmi_enter(); \ | ||
185 | trace_hardirq_enter(); \ | ||
173 | } while (0) | 186 | } while (0) |
174 | 187 | ||
175 | #define nmi_exit() \ | 188 | #define nmi_exit() \ |
176 | do { \ | 189 | do { \ |
177 | __irq_exit(); \ | 190 | trace_hardirq_exit(); \ |
178 | rcu_nmi_exit(); \ | 191 | rcu_nmi_exit(); \ |
179 | lockdep_on(); \ | 192 | lockdep_on(); \ |
180 | ftrace_nmi_exit(); \ | 193 | BUG_ON(!in_nmi()); \ |
194 | sub_preempt_count(NMI_OFFSET + HARDIRQ_OFFSET); \ | ||
195 | ftrace_nmi_exit(); \ | ||
181 | } while (0) | 196 | } while (0) |
182 | 197 | ||
183 | #endif /* LINUX_HARDIRQ_H */ | 198 | #endif /* LINUX_HARDIRQ_H */ |
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index c68bffd182b..ce2c07d99fc 100644 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h | |||
@@ -278,6 +278,11 @@ enum | |||
278 | NR_SOFTIRQS | 278 | NR_SOFTIRQS |
279 | }; | 279 | }; |
280 | 280 | ||
281 | /* map softirq index to softirq name. update 'softirq_to_name' in | ||
282 | * kernel/softirq.c when adding a new softirq. | ||
283 | */ | ||
284 | extern char *softirq_to_name[NR_SOFTIRQS]; | ||
285 | |||
281 | /* softirq mask and active fields moved to irq_cpustat_t in | 286 | /* softirq mask and active fields moved to irq_cpustat_t in |
282 | * asm/hardirq.h to get better cache usage. KAO | 287 | * asm/hardirq.h to get better cache usage. KAO |
283 | */ | 288 | */ |
diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h index f3fe34391d8..792274269f2 100644 --- a/include/linux/kallsyms.h +++ b/include/linux/kallsyms.h | |||
@@ -13,10 +13,17 @@ | |||
13 | #define KSYM_SYMBOL_LEN (sizeof("%s+%#lx/%#lx [%s]") + (KSYM_NAME_LEN - 1) + \ | 13 | #define KSYM_SYMBOL_LEN (sizeof("%s+%#lx/%#lx [%s]") + (KSYM_NAME_LEN - 1) + \ |
14 | 2*(BITS_PER_LONG*3/10) + (MODULE_NAME_LEN - 1) + 1) | 14 | 2*(BITS_PER_LONG*3/10) + (MODULE_NAME_LEN - 1) + 1) |
15 | 15 | ||
16 | struct module; | ||
17 | |||
16 | #ifdef CONFIG_KALLSYMS | 18 | #ifdef CONFIG_KALLSYMS |
17 | /* Lookup the address for a symbol. Returns 0 if not found. */ | 19 | /* Lookup the address for a symbol. Returns 0 if not found. */ |
18 | unsigned long kallsyms_lookup_name(const char *name); | 20 | unsigned long kallsyms_lookup_name(const char *name); |
19 | 21 | ||
22 | /* Call a function on each kallsyms symbol in the core kernel */ | ||
23 | int kallsyms_on_each_symbol(int (*fn)(void *, const char *, struct module *, | ||
24 | unsigned long), | ||
25 | void *data); | ||
26 | |||
20 | extern int kallsyms_lookup_size_offset(unsigned long addr, | 27 | extern int kallsyms_lookup_size_offset(unsigned long addr, |
21 | unsigned long *symbolsize, | 28 | unsigned long *symbolsize, |
22 | unsigned long *offset); | 29 | unsigned long *offset); |
@@ -43,6 +50,14 @@ static inline unsigned long kallsyms_lookup_name(const char *name) | |||
43 | return 0; | 50 | return 0; |
44 | } | 51 | } |
45 | 52 | ||
53 | static inline int kallsyms_on_each_symbol(int (*fn)(void *, const char *, | ||
54 | struct module *, | ||
55 | unsigned long), | ||
56 | void *data) | ||
57 | { | ||
58 | return 0; | ||
59 | } | ||
60 | |||
46 | static inline int kallsyms_lookup_size_offset(unsigned long addr, | 61 | static inline int kallsyms_lookup_size_offset(unsigned long addr, |
47 | unsigned long *symbolsize, | 62 | unsigned long *symbolsize, |
48 | unsigned long *offset) | 63 | unsigned long *offset) |
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 556d781e69f..d9e75ec7def 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
@@ -242,6 +242,19 @@ extern struct ratelimit_state printk_ratelimit_state; | |||
242 | extern int printk_ratelimit(void); | 242 | extern int printk_ratelimit(void); |
243 | extern bool printk_timed_ratelimit(unsigned long *caller_jiffies, | 243 | extern bool printk_timed_ratelimit(unsigned long *caller_jiffies, |
244 | unsigned int interval_msec); | 244 | unsigned int interval_msec); |
245 | |||
246 | /* | ||
247 | * Print a one-time message (analogous to WARN_ONCE() et al): | ||
248 | */ | ||
249 | #define printk_once(x...) ({ \ | ||
250 | static int __print_once = 1; \ | ||
251 | \ | ||
252 | if (__print_once) { \ | ||
253 | __print_once = 0; \ | ||
254 | printk(x); \ | ||
255 | } \ | ||
256 | }) | ||
257 | |||
245 | void log_buf_kexec_setup(void); | 258 | void log_buf_kexec_setup(void); |
246 | #else | 259 | #else |
247 | static inline int vprintk(const char *s, va_list args) | 260 | static inline int vprintk(const char *s, va_list args) |
@@ -254,6 +267,10 @@ static inline int printk_ratelimit(void) { return 0; } | |||
254 | static inline bool printk_timed_ratelimit(unsigned long *caller_jiffies, \ | 267 | static inline bool printk_timed_ratelimit(unsigned long *caller_jiffies, \ |
255 | unsigned int interval_msec) \ | 268 | unsigned int interval_msec) \ |
256 | { return false; } | 269 | { return false; } |
270 | |||
271 | /* No effect, but we still get type checking even in the !PRINTK case: */ | ||
272 | #define printk_once(x...) printk(x) | ||
273 | |||
257 | static inline void log_buf_kexec_setup(void) | 274 | static inline void log_buf_kexec_setup(void) |
258 | { | 275 | { |
259 | } | 276 | } |
@@ -375,6 +392,139 @@ static inline char *pack_hex_byte(char *buf, u8 byte) | |||
375 | #endif | 392 | #endif |
376 | 393 | ||
377 | /* | 394 | /* |
395 | * General tracing related utility functions - trace_printk(), | ||
396 | * tracing_on/tracing_off and tracing_start()/tracing_stop | ||
397 | * | ||
398 | * Use tracing_on/tracing_off when you want to quickly turn on or off | ||
399 | * tracing. It simply enables or disables the recording of the trace events. | ||
400 | * This also corresponds to the user space debugfs/tracing/tracing_on | ||
401 | * file, which gives a means for the kernel and userspace to interact. | ||
402 | * Place a tracing_off() in the kernel where you want tracing to end. | ||
403 | * From user space, examine the trace, and then echo 1 > tracing_on | ||
404 | * to continue tracing. | ||
405 | * | ||
406 | * tracing_stop/tracing_start has slightly more overhead. It is used | ||
407 | * by things like suspend to ram where disabling the recording of the | ||
408 | * trace is not enough, but tracing must actually stop because things | ||
409 | * like calling smp_processor_id() may crash the system. | ||
410 | * | ||
411 | * Most likely, you want to use tracing_on/tracing_off. | ||
412 | */ | ||
413 | #ifdef CONFIG_RING_BUFFER | ||
414 | void tracing_on(void); | ||
415 | void tracing_off(void); | ||
416 | /* trace_off_permanent stops recording with no way to bring it back */ | ||
417 | void tracing_off_permanent(void); | ||
418 | int tracing_is_on(void); | ||
419 | #else | ||
420 | static inline void tracing_on(void) { } | ||
421 | static inline void tracing_off(void) { } | ||
422 | static inline void tracing_off_permanent(void) { } | ||
423 | static inline int tracing_is_on(void) { return 0; } | ||
424 | #endif | ||
425 | #ifdef CONFIG_TRACING | ||
426 | extern void tracing_start(void); | ||
427 | extern void tracing_stop(void); | ||
428 | extern void ftrace_off_permanent(void); | ||
429 | |||
430 | extern void | ||
431 | ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3); | ||
432 | |||
433 | static inline void __attribute__ ((format (printf, 1, 2))) | ||
434 | ____trace_printk_check_format(const char *fmt, ...) | ||
435 | { | ||
436 | } | ||
437 | #define __trace_printk_check_format(fmt, args...) \ | ||
438 | do { \ | ||
439 | if (0) \ | ||
440 | ____trace_printk_check_format(fmt, ##args); \ | ||
441 | } while (0) | ||
442 | |||
443 | /** | ||
444 | * trace_printk - printf formatting in the ftrace buffer | ||
445 | * @fmt: the printf format for printing | ||
446 | * | ||
447 | * Note: __trace_printk is an internal function for trace_printk and | ||
448 | * the @ip is passed in via the trace_printk macro. | ||
449 | * | ||
450 | * This function allows a kernel developer to debug fast path sections | ||
451 | * that printk is not appropriate for. By scattering in various | ||
452 | * printk like tracing in the code, a developer can quickly see | ||
453 | * where problems are occurring. | ||
454 | * | ||
455 | * This is intended as a debugging tool for the developer only. | ||
456 | * Please refrain from leaving trace_printks scattered around in | ||
457 | * your code. | ||
458 | */ | ||
459 | |||
460 | #define trace_printk(fmt, args...) \ | ||
461 | do { \ | ||
462 | __trace_printk_check_format(fmt, ##args); \ | ||
463 | if (__builtin_constant_p(fmt)) { \ | ||
464 | static const char *trace_printk_fmt \ | ||
465 | __attribute__((section("__trace_printk_fmt"))) = \ | ||
466 | __builtin_constant_p(fmt) ? fmt : NULL; \ | ||
467 | \ | ||
468 | __trace_bprintk(_THIS_IP_, trace_printk_fmt, ##args); \ | ||
469 | } else \ | ||
470 | __trace_printk(_THIS_IP_, fmt, ##args); \ | ||
471 | } while (0) | ||
472 | |||
473 | extern int | ||
474 | __trace_bprintk(unsigned long ip, const char *fmt, ...) | ||
475 | __attribute__ ((format (printf, 2, 3))); | ||
476 | |||
477 | extern int | ||
478 | __trace_printk(unsigned long ip, const char *fmt, ...) | ||
479 | __attribute__ ((format (printf, 2, 3))); | ||
480 | |||
481 | /* | ||
482 | * The double __builtin_constant_p is because gcc will give us an error | ||
483 | * if we try to allocate the static variable to fmt if it is not a | ||
484 | * constant. Even with the outer if statement. | ||
485 | */ | ||
486 | #define ftrace_vprintk(fmt, vargs) \ | ||
487 | do { \ | ||
488 | if (__builtin_constant_p(fmt)) { \ | ||
489 | static const char *trace_printk_fmt \ | ||
490 | __attribute__((section("__trace_printk_fmt"))) = \ | ||
491 | __builtin_constant_p(fmt) ? fmt : NULL; \ | ||
492 | \ | ||
493 | __ftrace_vbprintk(_THIS_IP_, trace_printk_fmt, vargs); \ | ||
494 | } else \ | ||
495 | __ftrace_vprintk(_THIS_IP_, fmt, vargs); \ | ||
496 | } while (0) | ||
497 | |||
498 | extern int | ||
499 | __ftrace_vbprintk(unsigned long ip, const char *fmt, va_list ap); | ||
500 | |||
501 | extern int | ||
502 | __ftrace_vprintk(unsigned long ip, const char *fmt, va_list ap); | ||
503 | |||
504 | extern void ftrace_dump(void); | ||
505 | #else | ||
506 | static inline void | ||
507 | ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3) { } | ||
508 | static inline int | ||
509 | trace_printk(const char *fmt, ...) __attribute__ ((format (printf, 1, 2))); | ||
510 | |||
511 | static inline void tracing_start(void) { } | ||
512 | static inline void tracing_stop(void) { } | ||
513 | static inline void ftrace_off_permanent(void) { } | ||
514 | static inline int | ||
515 | trace_printk(const char *fmt, ...) | ||
516 | { | ||
517 | return 0; | ||
518 | } | ||
519 | static inline int | ||
520 | ftrace_vprintk(const char *fmt, va_list ap) | ||
521 | { | ||
522 | return 0; | ||
523 | } | ||
524 | static inline void ftrace_dump(void) { } | ||
525 | #endif /* CONFIG_TRACING */ | ||
526 | |||
527 | /* | ||
378 | * Display an IP address in readable format. | 528 | * Display an IP address in readable format. |
379 | */ | 529 | */ |
380 | 530 | ||
diff --git a/include/linux/kmod.h b/include/linux/kmod.h index 92213a9194e..d5fa565086d 100644 --- a/include/linux/kmod.h +++ b/include/linux/kmod.h | |||
@@ -29,10 +29,15 @@ | |||
29 | #ifdef CONFIG_MODULES | 29 | #ifdef CONFIG_MODULES |
30 | /* modprobe exit status on success, -ve on error. Return value | 30 | /* modprobe exit status on success, -ve on error. Return value |
31 | * usually useless though. */ | 31 | * usually useless though. */ |
32 | extern int request_module(const char * name, ...) __attribute__ ((format (printf, 1, 2))); | 32 | extern int __request_module(bool wait, const char *name, ...) \ |
33 | #define try_then_request_module(x, mod...) ((x) ?: (request_module(mod), (x))) | 33 | __attribute__((format(printf, 2, 3))); |
34 | #define request_module(mod...) __request_module(true, mod) | ||
35 | #define request_module_nowait(mod...) __request_module(false, mod) | ||
36 | #define try_then_request_module(x, mod...) \ | ||
37 | ((x) ?: (__request_module(false, mod), (x))) | ||
34 | #else | 38 | #else |
35 | static inline int request_module(const char * name, ...) { return -ENOSYS; } | 39 | static inline int request_module(const char *name, ...) { return -ENOSYS; } |
40 | static inline int request_module_nowait(const char *name, ...) { return -ENOSYS; } | ||
36 | #define try_then_request_module(x, mod...) (x) | 41 | #define try_then_request_module(x, mod...) (x) |
37 | #endif | 42 | #endif |
38 | 43 | ||
diff --git a/include/linux/memory.h b/include/linux/memory.h index 42767d1a62e..37fa19b34ef 100644 --- a/include/linux/memory.h +++ b/include/linux/memory.h | |||
@@ -110,4 +110,10 @@ struct memory_accessor { | |||
110 | off_t offset, size_t count); | 110 | off_t offset, size_t count); |
111 | }; | 111 | }; |
112 | 112 | ||
113 | /* | ||
114 | * Kernel text modification mutex, used for code patching. Users of this lock | ||
115 | * can sleep. | ||
116 | */ | ||
117 | extern struct mutex text_mutex; | ||
118 | |||
113 | #endif /* _LINUX_MEMORY_H_ */ | 119 | #endif /* _LINUX_MEMORY_H_ */ |
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 26ef24076b7..186ec6ab334 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h | |||
@@ -764,12 +764,6 @@ extern int numa_zonelist_order_handler(struct ctl_table *, int, | |||
764 | extern char numa_zonelist_order[]; | 764 | extern char numa_zonelist_order[]; |
765 | #define NUMA_ZONELIST_ORDER_LEN 16 /* string buffer size */ | 765 | #define NUMA_ZONELIST_ORDER_LEN 16 /* string buffer size */ |
766 | 766 | ||
767 | #include <linux/topology.h> | ||
768 | /* Returns the number of the current Node. */ | ||
769 | #ifndef numa_node_id | ||
770 | #define numa_node_id() (cpu_to_node(raw_smp_processor_id())) | ||
771 | #endif | ||
772 | |||
773 | #ifndef CONFIG_NEED_MULTIPLE_NODES | 767 | #ifndef CONFIG_NEED_MULTIPLE_NODES |
774 | 768 | ||
775 | extern struct pglist_data contig_page_data; | 769 | extern struct pglist_data contig_page_data; |
diff --git a/include/linux/module.h b/include/linux/module.h index 145a75528cc..627ac082e2a 100644 --- a/include/linux/module.h +++ b/include/linux/module.h | |||
@@ -248,6 +248,10 @@ struct module | |||
248 | const unsigned long *crcs; | 248 | const unsigned long *crcs; |
249 | unsigned int num_syms; | 249 | unsigned int num_syms; |
250 | 250 | ||
251 | /* Kernel parameters. */ | ||
252 | struct kernel_param *kp; | ||
253 | unsigned int num_kp; | ||
254 | |||
251 | /* GPL-only exported symbols. */ | 255 | /* GPL-only exported symbols. */ |
252 | unsigned int num_gpl_syms; | 256 | unsigned int num_gpl_syms; |
253 | const struct kernel_symbol *gpl_syms; | 257 | const struct kernel_symbol *gpl_syms; |
@@ -329,6 +333,11 @@ struct module | |||
329 | unsigned int num_tracepoints; | 333 | unsigned int num_tracepoints; |
330 | #endif | 334 | #endif |
331 | 335 | ||
336 | #ifdef CONFIG_TRACING | ||
337 | const char **trace_bprintk_fmt_start; | ||
338 | unsigned int num_trace_bprintk_fmt; | ||
339 | #endif | ||
340 | |||
332 | #ifdef CONFIG_MODULE_UNLOAD | 341 | #ifdef CONFIG_MODULE_UNLOAD |
333 | /* What modules depend on me? */ | 342 | /* What modules depend on me? */ |
334 | struct list_head modules_which_use_me; | 343 | struct list_head modules_which_use_me; |
@@ -350,6 +359,8 @@ struct module | |||
350 | #define MODULE_ARCH_INIT {} | 359 | #define MODULE_ARCH_INIT {} |
351 | #endif | 360 | #endif |
352 | 361 | ||
362 | extern struct mutex module_mutex; | ||
363 | |||
353 | /* FIXME: It'd be nice to isolate modules during init, too, so they | 364 | /* FIXME: It'd be nice to isolate modules during init, too, so they |
354 | aren't used before they (may) fail. But presently too much code | 365 | aren't used before they (may) fail. But presently too much code |
355 | (IDE & SCSI) require entry into the module during init.*/ | 366 | (IDE & SCSI) require entry into the module during init.*/ |
@@ -358,10 +369,10 @@ static inline int module_is_live(struct module *mod) | |||
358 | return mod->state != MODULE_STATE_GOING; | 369 | return mod->state != MODULE_STATE_GOING; |
359 | } | 370 | } |
360 | 371 | ||
361 | /* Is this address in a module? (second is with no locks, for oops) */ | ||
362 | struct module *module_text_address(unsigned long addr); | ||
363 | struct module *__module_text_address(unsigned long addr); | 372 | struct module *__module_text_address(unsigned long addr); |
364 | int is_module_address(unsigned long addr); | 373 | struct module *__module_address(unsigned long addr); |
374 | bool is_module_address(unsigned long addr); | ||
375 | bool is_module_text_address(unsigned long addr); | ||
365 | 376 | ||
366 | static inline int within_module_core(unsigned long addr, struct module *mod) | 377 | static inline int within_module_core(unsigned long addr, struct module *mod) |
367 | { | 378 | { |
@@ -375,6 +386,31 @@ static inline int within_module_init(unsigned long addr, struct module *mod) | |||
375 | addr < (unsigned long)mod->module_init + mod->init_size; | 386 | addr < (unsigned long)mod->module_init + mod->init_size; |
376 | } | 387 | } |
377 | 388 | ||
389 | /* Search for module by name: must hold module_mutex. */ | ||
390 | struct module *find_module(const char *name); | ||
391 | |||
392 | struct symsearch { | ||
393 | const struct kernel_symbol *start, *stop; | ||
394 | const unsigned long *crcs; | ||
395 | enum { | ||
396 | NOT_GPL_ONLY, | ||
397 | GPL_ONLY, | ||
398 | WILL_BE_GPL_ONLY, | ||
399 | } licence; | ||
400 | bool unused; | ||
401 | }; | ||
402 | |||
403 | /* Search for an exported symbol by name. */ | ||
404 | const struct kernel_symbol *find_symbol(const char *name, | ||
405 | struct module **owner, | ||
406 | const unsigned long **crc, | ||
407 | bool gplok, | ||
408 | bool warn); | ||
409 | |||
410 | /* Walk the exported symbol table */ | ||
411 | bool each_symbol(bool (*fn)(const struct symsearch *arr, struct module *owner, | ||
412 | unsigned int symnum, void *data), void *data); | ||
413 | |||
378 | /* Returns 0 and fills in value, defined and namebuf, or -ERANGE if | 414 | /* Returns 0 and fills in value, defined and namebuf, or -ERANGE if |
379 | symnum out of range. */ | 415 | symnum out of range. */ |
380 | int module_get_kallsym(unsigned int symnum, unsigned long *value, char *type, | 416 | int module_get_kallsym(unsigned int symnum, unsigned long *value, char *type, |
@@ -383,6 +419,10 @@ int module_get_kallsym(unsigned int symnum, unsigned long *value, char *type, | |||
383 | /* Look for this name: can be of form module:name. */ | 419 | /* Look for this name: can be of form module:name. */ |
384 | unsigned long module_kallsyms_lookup_name(const char *name); | 420 | unsigned long module_kallsyms_lookup_name(const char *name); |
385 | 421 | ||
422 | int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *, | ||
423 | struct module *, unsigned long), | ||
424 | void *data); | ||
425 | |||
386 | extern void __module_put_and_exit(struct module *mod, long code) | 426 | extern void __module_put_and_exit(struct module *mod, long code) |
387 | __attribute__((noreturn)); | 427 | __attribute__((noreturn)); |
388 | #define module_put_and_exit(code) __module_put_and_exit(THIS_MODULE, code); | 428 | #define module_put_and_exit(code) __module_put_and_exit(THIS_MODULE, code); |
@@ -444,6 +484,7 @@ static inline void __module_get(struct module *module) | |||
444 | #define symbol_put_addr(p) do { } while(0) | 484 | #define symbol_put_addr(p) do { } while(0) |
445 | 485 | ||
446 | #endif /* CONFIG_MODULE_UNLOAD */ | 486 | #endif /* CONFIG_MODULE_UNLOAD */ |
487 | int use_module(struct module *a, struct module *b); | ||
447 | 488 | ||
448 | /* This is a #define so the string doesn't get put in every .o file */ | 489 | /* This is a #define so the string doesn't get put in every .o file */ |
449 | #define module_name(mod) \ | 490 | #define module_name(mod) \ |
@@ -490,21 +531,24 @@ search_module_extables(unsigned long addr) | |||
490 | return NULL; | 531 | return NULL; |
491 | } | 532 | } |
492 | 533 | ||
493 | /* Is this address in a module? */ | 534 | static inline struct module *__module_address(unsigned long addr) |
494 | static inline struct module *module_text_address(unsigned long addr) | ||
495 | { | 535 | { |
496 | return NULL; | 536 | return NULL; |
497 | } | 537 | } |
498 | 538 | ||
499 | /* Is this address in a module? (don't take a lock, we're oopsing) */ | ||
500 | static inline struct module *__module_text_address(unsigned long addr) | 539 | static inline struct module *__module_text_address(unsigned long addr) |
501 | { | 540 | { |
502 | return NULL; | 541 | return NULL; |
503 | } | 542 | } |
504 | 543 | ||
505 | static inline int is_module_address(unsigned long addr) | 544 | static inline bool is_module_address(unsigned long addr) |
506 | { | 545 | { |
507 | return 0; | 546 | return false; |
547 | } | ||
548 | |||
549 | static inline bool is_module_text_address(unsigned long addr) | ||
550 | { | ||
551 | return false; | ||
508 | } | 552 | } |
509 | 553 | ||
510 | /* Get/put a kernel symbol (calls should be symmetric) */ | 554 | /* Get/put a kernel symbol (calls should be symmetric) */ |
@@ -559,6 +603,14 @@ static inline unsigned long module_kallsyms_lookup_name(const char *name) | |||
559 | return 0; | 603 | return 0; |
560 | } | 604 | } |
561 | 605 | ||
606 | static inline int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *, | ||
607 | struct module *, | ||
608 | unsigned long), | ||
609 | void *data) | ||
610 | { | ||
611 | return 0; | ||
612 | } | ||
613 | |||
562 | static inline int register_module_notifier(struct notifier_block * nb) | 614 | static inline int register_module_notifier(struct notifier_block * nb) |
563 | { | 615 | { |
564 | /* no events will happen anyway, so this can always succeed */ | 616 | /* no events will happen anyway, so this can always succeed */ |
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h index e4af3399ef4..a4f0b931846 100644 --- a/include/linux/moduleparam.h +++ b/include/linux/moduleparam.h | |||
@@ -138,6 +138,16 @@ extern int parse_args(const char *name, | |||
138 | unsigned num, | 138 | unsigned num, |
139 | int (*unknown)(char *param, char *val)); | 139 | int (*unknown)(char *param, char *val)); |
140 | 140 | ||
141 | /* Called by module remove. */ | ||
142 | #ifdef CONFIG_SYSFS | ||
143 | extern void destroy_params(const struct kernel_param *params, unsigned num); | ||
144 | #else | ||
145 | static inline void destroy_params(const struct kernel_param *params, | ||
146 | unsigned num) | ||
147 | { | ||
148 | } | ||
149 | #endif /* !CONFIG_SYSFS */ | ||
150 | |||
141 | /* All the helper functions */ | 151 | /* All the helper functions */ |
142 | /* The macros to do compile-time type checking stolen from Jakub | 152 | /* The macros to do compile-time type checking stolen from Jakub |
143 | Jelinek, who IIRC came up with this idea for the 2.4 module init code. */ | 153 | Jelinek, who IIRC came up with this idea for the 2.4 module init code. */ |
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h index 8ff25e0e7f7..594c494ac3f 100644 --- a/include/linux/power_supply.h +++ b/include/linux/power_supply.h | |||
@@ -73,6 +73,8 @@ enum power_supply_property { | |||
73 | POWER_SUPPLY_PROP_VOLTAGE_AVG, | 73 | POWER_SUPPLY_PROP_VOLTAGE_AVG, |
74 | POWER_SUPPLY_PROP_CURRENT_NOW, | 74 | POWER_SUPPLY_PROP_CURRENT_NOW, |
75 | POWER_SUPPLY_PROP_CURRENT_AVG, | 75 | POWER_SUPPLY_PROP_CURRENT_AVG, |
76 | POWER_SUPPLY_PROP_POWER_NOW, | ||
77 | POWER_SUPPLY_PROP_POWER_AVG, | ||
76 | POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN, | 78 | POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN, |
77 | POWER_SUPPLY_PROP_CHARGE_EMPTY_DESIGN, | 79 | POWER_SUPPLY_PROP_CHARGE_EMPTY_DESIGN, |
78 | POWER_SUPPLY_PROP_CHARGE_FULL, | 80 | POWER_SUPPLY_PROP_CHARGE_FULL, |
diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h index b3b35966008..e1b7b217388 100644 --- a/include/linux/ring_buffer.h +++ b/include/linux/ring_buffer.h | |||
@@ -8,7 +8,7 @@ struct ring_buffer; | |||
8 | struct ring_buffer_iter; | 8 | struct ring_buffer_iter; |
9 | 9 | ||
10 | /* | 10 | /* |
11 | * Don't reference this struct directly, use functions below. | 11 | * Don't refer to this struct directly, use functions below. |
12 | */ | 12 | */ |
13 | struct ring_buffer_event { | 13 | struct ring_buffer_event { |
14 | u32 type:2, len:3, time_delta:27; | 14 | u32 type:2, len:3, time_delta:27; |
@@ -18,10 +18,13 @@ struct ring_buffer_event { | |||
18 | /** | 18 | /** |
19 | * enum ring_buffer_type - internal ring buffer types | 19 | * enum ring_buffer_type - internal ring buffer types |
20 | * | 20 | * |
21 | * @RINGBUF_TYPE_PADDING: Left over page padding | 21 | * @RINGBUF_TYPE_PADDING: Left over page padding or discarded event |
22 | * array is ignored | 22 | * If time_delta is 0: |
23 | * size is variable depending on how much | 23 | * array is ignored |
24 | * size is variable depending on how much | ||
24 | * padding is needed | 25 | * padding is needed |
26 | * If time_delta is non zero: | ||
27 | * everything else same as RINGBUF_TYPE_DATA | ||
25 | * | 28 | * |
26 | * @RINGBUF_TYPE_TIME_EXTEND: Extend the time delta | 29 | * @RINGBUF_TYPE_TIME_EXTEND: Extend the time delta |
27 | * array[0] = time delta (28 .. 59) | 30 | * array[0] = time delta (28 .. 59) |
@@ -65,6 +68,8 @@ ring_buffer_event_time_delta(struct ring_buffer_event *event) | |||
65 | return event->time_delta; | 68 | return event->time_delta; |
66 | } | 69 | } |
67 | 70 | ||
71 | void ring_buffer_event_discard(struct ring_buffer_event *event); | ||
72 | |||
68 | /* | 73 | /* |
69 | * size is in bytes for each per CPU buffer. | 74 | * size is in bytes for each per CPU buffer. |
70 | */ | 75 | */ |
@@ -74,13 +79,10 @@ void ring_buffer_free(struct ring_buffer *buffer); | |||
74 | 79 | ||
75 | int ring_buffer_resize(struct ring_buffer *buffer, unsigned long size); | 80 | int ring_buffer_resize(struct ring_buffer *buffer, unsigned long size); |
76 | 81 | ||
77 | struct ring_buffer_event * | 82 | struct ring_buffer_event *ring_buffer_lock_reserve(struct ring_buffer *buffer, |
78 | ring_buffer_lock_reserve(struct ring_buffer *buffer, | 83 | unsigned long length); |
79 | unsigned long length, | ||
80 | unsigned long *flags); | ||
81 | int ring_buffer_unlock_commit(struct ring_buffer *buffer, | 84 | int ring_buffer_unlock_commit(struct ring_buffer *buffer, |
82 | struct ring_buffer_event *event, | 85 | struct ring_buffer_event *event); |
83 | unsigned long flags); | ||
84 | int ring_buffer_write(struct ring_buffer *buffer, | 86 | int ring_buffer_write(struct ring_buffer *buffer, |
85 | unsigned long length, void *data); | 87 | unsigned long length, void *data); |
86 | 88 | ||
@@ -121,17 +123,19 @@ unsigned long ring_buffer_overruns(struct ring_buffer *buffer); | |||
121 | unsigned long ring_buffer_entries_cpu(struct ring_buffer *buffer, int cpu); | 123 | unsigned long ring_buffer_entries_cpu(struct ring_buffer *buffer, int cpu); |
122 | unsigned long ring_buffer_overrun_cpu(struct ring_buffer *buffer, int cpu); | 124 | unsigned long ring_buffer_overrun_cpu(struct ring_buffer *buffer, int cpu); |
123 | 125 | ||
124 | u64 ring_buffer_time_stamp(int cpu); | 126 | u64 ring_buffer_time_stamp(struct ring_buffer *buffer, int cpu); |
125 | void ring_buffer_normalize_time_stamp(int cpu, u64 *ts); | 127 | void ring_buffer_normalize_time_stamp(struct ring_buffer *buffer, |
128 | int cpu, u64 *ts); | ||
129 | void ring_buffer_set_clock(struct ring_buffer *buffer, | ||
130 | u64 (*clock)(void)); | ||
131 | |||
132 | size_t ring_buffer_page_len(void *page); | ||
126 | 133 | ||
127 | void tracing_on(void); | ||
128 | void tracing_off(void); | ||
129 | void tracing_off_permanent(void); | ||
130 | 134 | ||
131 | void *ring_buffer_alloc_read_page(struct ring_buffer *buffer); | 135 | void *ring_buffer_alloc_read_page(struct ring_buffer *buffer); |
132 | void ring_buffer_free_read_page(struct ring_buffer *buffer, void *data); | 136 | void ring_buffer_free_read_page(struct ring_buffer *buffer, void *data); |
133 | int ring_buffer_read_page(struct ring_buffer *buffer, | 137 | int ring_buffer_read_page(struct ring_buffer *buffer, void **data_page, |
134 | void **data_page, int cpu, int full); | 138 | size_t len, int cpu, int full); |
135 | 139 | ||
136 | enum ring_buffer_flags { | 140 | enum ring_buffer_flags { |
137 | RB_FL_OVERWRITE = 1 << 0, | 141 | RB_FL_OVERWRITE = 1 << 0, |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 9da5aa0771e..b94f3541f67 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -138,6 +138,8 @@ extern unsigned long nr_uninterruptible(void); | |||
138 | extern unsigned long nr_active(void); | 138 | extern unsigned long nr_active(void); |
139 | extern unsigned long nr_iowait(void); | 139 | extern unsigned long nr_iowait(void); |
140 | 140 | ||
141 | extern unsigned long get_parent_ip(unsigned long addr); | ||
142 | |||
141 | struct seq_file; | 143 | struct seq_file; |
142 | struct cfs_rq; | 144 | struct cfs_rq; |
143 | struct task_group; | 145 | struct task_group; |
@@ -1405,6 +1407,8 @@ struct task_struct { | |||
1405 | int curr_ret_stack; | 1407 | int curr_ret_stack; |
1406 | /* Stack of return addresses for return function tracing */ | 1408 | /* Stack of return addresses for return function tracing */ |
1407 | struct ftrace_ret_stack *ret_stack; | 1409 | struct ftrace_ret_stack *ret_stack; |
1410 | /* time stamp for last schedule */ | ||
1411 | unsigned long long ftrace_timestamp; | ||
1408 | /* | 1412 | /* |
1409 | * Number of functions that haven't been traced | 1413 | * Number of functions that haven't been traced |
1410 | * because of depth overrun. | 1414 | * because of depth overrun. |
diff --git a/include/linux/slab_def.h b/include/linux/slab_def.h index 6ca6a7b66d7..f4523651fa4 100644 --- a/include/linux/slab_def.h +++ b/include/linux/slab_def.h | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <asm/page.h> /* kmalloc_sizes.h needs PAGE_SIZE */ | 14 | #include <asm/page.h> /* kmalloc_sizes.h needs PAGE_SIZE */ |
15 | #include <asm/cache.h> /* kmalloc_sizes.h needs L1_CACHE_BYTES */ | 15 | #include <asm/cache.h> /* kmalloc_sizes.h needs L1_CACHE_BYTES */ |
16 | #include <linux/compiler.h> | 16 | #include <linux/compiler.h> |
17 | #include <trace/kmemtrace.h> | ||
17 | 18 | ||
18 | /* Size description struct for general caches. */ | 19 | /* Size description struct for general caches. */ |
19 | struct cache_sizes { | 20 | struct cache_sizes { |
@@ -28,8 +29,26 @@ extern struct cache_sizes malloc_sizes[]; | |||
28 | void *kmem_cache_alloc(struct kmem_cache *, gfp_t); | 29 | void *kmem_cache_alloc(struct kmem_cache *, gfp_t); |
29 | void *__kmalloc(size_t size, gfp_t flags); | 30 | void *__kmalloc(size_t size, gfp_t flags); |
30 | 31 | ||
31 | static inline void *kmalloc(size_t size, gfp_t flags) | 32 | #ifdef CONFIG_KMEMTRACE |
33 | extern void *kmem_cache_alloc_notrace(struct kmem_cache *cachep, gfp_t flags); | ||
34 | extern size_t slab_buffer_size(struct kmem_cache *cachep); | ||
35 | #else | ||
36 | static __always_inline void * | ||
37 | kmem_cache_alloc_notrace(struct kmem_cache *cachep, gfp_t flags) | ||
32 | { | 38 | { |
39 | return kmem_cache_alloc(cachep, flags); | ||
40 | } | ||
41 | static inline size_t slab_buffer_size(struct kmem_cache *cachep) | ||
42 | { | ||
43 | return 0; | ||
44 | } | ||
45 | #endif | ||
46 | |||
47 | static __always_inline void *kmalloc(size_t size, gfp_t flags) | ||
48 | { | ||
49 | struct kmem_cache *cachep; | ||
50 | void *ret; | ||
51 | |||
33 | if (__builtin_constant_p(size)) { | 52 | if (__builtin_constant_p(size)) { |
34 | int i = 0; | 53 | int i = 0; |
35 | 54 | ||
@@ -47,10 +66,17 @@ static inline void *kmalloc(size_t size, gfp_t flags) | |||
47 | found: | 66 | found: |
48 | #ifdef CONFIG_ZONE_DMA | 67 | #ifdef CONFIG_ZONE_DMA |
49 | if (flags & GFP_DMA) | 68 | if (flags & GFP_DMA) |
50 | return kmem_cache_alloc(malloc_sizes[i].cs_dmacachep, | 69 | cachep = malloc_sizes[i].cs_dmacachep; |
51 | flags); | 70 | else |
52 | #endif | 71 | #endif |
53 | return kmem_cache_alloc(malloc_sizes[i].cs_cachep, flags); | 72 | cachep = malloc_sizes[i].cs_cachep; |
73 | |||
74 | ret = kmem_cache_alloc_notrace(cachep, flags); | ||
75 | |||
76 | kmemtrace_mark_alloc(KMEMTRACE_TYPE_KMALLOC, _THIS_IP_, ret, | ||
77 | size, slab_buffer_size(cachep), flags); | ||
78 | |||
79 | return ret; | ||
54 | } | 80 | } |
55 | return __kmalloc(size, flags); | 81 | return __kmalloc(size, flags); |
56 | } | 82 | } |
@@ -59,8 +85,25 @@ found: | |||
59 | extern void *__kmalloc_node(size_t size, gfp_t flags, int node); | 85 | extern void *__kmalloc_node(size_t size, gfp_t flags, int node); |
60 | extern void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node); | 86 | extern void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node); |
61 | 87 | ||
62 | static inline void *kmalloc_node(size_t size, gfp_t flags, int node) | 88 | #ifdef CONFIG_KMEMTRACE |
89 | extern void *kmem_cache_alloc_node_notrace(struct kmem_cache *cachep, | ||
90 | gfp_t flags, | ||
91 | int nodeid); | ||
92 | #else | ||
93 | static __always_inline void * | ||
94 | kmem_cache_alloc_node_notrace(struct kmem_cache *cachep, | ||
95 | gfp_t flags, | ||
96 | int nodeid) | ||
97 | { | ||
98 | return kmem_cache_alloc_node(cachep, flags, nodeid); | ||
99 | } | ||
100 | #endif | ||
101 | |||
102 | static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node) | ||
63 | { | 103 | { |
104 | struct kmem_cache *cachep; | ||
105 | void *ret; | ||
106 | |||
64 | if (__builtin_constant_p(size)) { | 107 | if (__builtin_constant_p(size)) { |
65 | int i = 0; | 108 | int i = 0; |
66 | 109 | ||
@@ -78,11 +121,18 @@ static inline void *kmalloc_node(size_t size, gfp_t flags, int node) | |||
78 | found: | 121 | found: |
79 | #ifdef CONFIG_ZONE_DMA | 122 | #ifdef CONFIG_ZONE_DMA |
80 | if (flags & GFP_DMA) | 123 | if (flags & GFP_DMA) |
81 | return kmem_cache_alloc_node(malloc_sizes[i].cs_dmacachep, | 124 | cachep = malloc_sizes[i].cs_dmacachep; |
82 | flags, node); | 125 | else |
83 | #endif | 126 | #endif |
84 | return kmem_cache_alloc_node(malloc_sizes[i].cs_cachep, | 127 | cachep = malloc_sizes[i].cs_cachep; |
85 | flags, node); | 128 | |
129 | ret = kmem_cache_alloc_node_notrace(cachep, flags, node); | ||
130 | |||
131 | kmemtrace_mark_alloc_node(KMEMTRACE_TYPE_KMALLOC, _THIS_IP_, | ||
132 | ret, size, slab_buffer_size(cachep), | ||
133 | flags, node); | ||
134 | |||
135 | return ret; | ||
86 | } | 136 | } |
87 | return __kmalloc_node(size, flags, node); | 137 | return __kmalloc_node(size, flags, node); |
88 | } | 138 | } |
diff --git a/include/linux/slob_def.h b/include/linux/slob_def.h index 59a3fa476ab..0ec00b39d00 100644 --- a/include/linux/slob_def.h +++ b/include/linux/slob_def.h | |||
@@ -3,14 +3,15 @@ | |||
3 | 3 | ||
4 | void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node); | 4 | void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node); |
5 | 5 | ||
6 | static inline void *kmem_cache_alloc(struct kmem_cache *cachep, gfp_t flags) | 6 | static __always_inline void *kmem_cache_alloc(struct kmem_cache *cachep, |
7 | gfp_t flags) | ||
7 | { | 8 | { |
8 | return kmem_cache_alloc_node(cachep, flags, -1); | 9 | return kmem_cache_alloc_node(cachep, flags, -1); |
9 | } | 10 | } |
10 | 11 | ||
11 | void *__kmalloc_node(size_t size, gfp_t flags, int node); | 12 | void *__kmalloc_node(size_t size, gfp_t flags, int node); |
12 | 13 | ||
13 | static inline void *kmalloc_node(size_t size, gfp_t flags, int node) | 14 | static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node) |
14 | { | 15 | { |
15 | return __kmalloc_node(size, flags, node); | 16 | return __kmalloc_node(size, flags, node); |
16 | } | 17 | } |
@@ -23,12 +24,12 @@ static inline void *kmalloc_node(size_t size, gfp_t flags, int node) | |||
23 | * kmalloc is the normal method of allocating memory | 24 | * kmalloc is the normal method of allocating memory |
24 | * in the kernel. | 25 | * in the kernel. |
25 | */ | 26 | */ |
26 | static inline void *kmalloc(size_t size, gfp_t flags) | 27 | static __always_inline void *kmalloc(size_t size, gfp_t flags) |
27 | { | 28 | { |
28 | return __kmalloc_node(size, flags, -1); | 29 | return __kmalloc_node(size, flags, -1); |
29 | } | 30 | } |
30 | 31 | ||
31 | static inline void *__kmalloc(size_t size, gfp_t flags) | 32 | static __always_inline void *__kmalloc(size_t size, gfp_t flags) |
32 | { | 33 | { |
33 | return kmalloc(size, flags); | 34 | return kmalloc(size, flags); |
34 | } | 35 | } |
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h index e37b6aa8a9f..a1f90528e70 100644 --- a/include/linux/slub_def.h +++ b/include/linux/slub_def.h | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/gfp.h> | 10 | #include <linux/gfp.h> |
11 | #include <linux/workqueue.h> | 11 | #include <linux/workqueue.h> |
12 | #include <linux/kobject.h> | 12 | #include <linux/kobject.h> |
13 | #include <trace/kmemtrace.h> | ||
13 | 14 | ||
14 | enum stat_item { | 15 | enum stat_item { |
15 | ALLOC_FASTPATH, /* Allocation from cpu slab */ | 16 | ALLOC_FASTPATH, /* Allocation from cpu slab */ |
@@ -217,13 +218,31 @@ static __always_inline struct kmem_cache *kmalloc_slab(size_t size) | |||
217 | void *kmem_cache_alloc(struct kmem_cache *, gfp_t); | 218 | void *kmem_cache_alloc(struct kmem_cache *, gfp_t); |
218 | void *__kmalloc(size_t size, gfp_t flags); | 219 | void *__kmalloc(size_t size, gfp_t flags); |
219 | 220 | ||
221 | #ifdef CONFIG_KMEMTRACE | ||
222 | extern void *kmem_cache_alloc_notrace(struct kmem_cache *s, gfp_t gfpflags); | ||
223 | #else | ||
224 | static __always_inline void * | ||
225 | kmem_cache_alloc_notrace(struct kmem_cache *s, gfp_t gfpflags) | ||
226 | { | ||
227 | return kmem_cache_alloc(s, gfpflags); | ||
228 | } | ||
229 | #endif | ||
230 | |||
220 | static __always_inline void *kmalloc_large(size_t size, gfp_t flags) | 231 | static __always_inline void *kmalloc_large(size_t size, gfp_t flags) |
221 | { | 232 | { |
222 | return (void *)__get_free_pages(flags | __GFP_COMP, get_order(size)); | 233 | unsigned int order = get_order(size); |
234 | void *ret = (void *) __get_free_pages(flags | __GFP_COMP, order); | ||
235 | |||
236 | kmemtrace_mark_alloc(KMEMTRACE_TYPE_KMALLOC, _THIS_IP_, ret, | ||
237 | size, PAGE_SIZE << order, flags); | ||
238 | |||
239 | return ret; | ||
223 | } | 240 | } |
224 | 241 | ||
225 | static __always_inline void *kmalloc(size_t size, gfp_t flags) | 242 | static __always_inline void *kmalloc(size_t size, gfp_t flags) |
226 | { | 243 | { |
244 | void *ret; | ||
245 | |||
227 | if (__builtin_constant_p(size)) { | 246 | if (__builtin_constant_p(size)) { |
228 | if (size > SLUB_MAX_SIZE) | 247 | if (size > SLUB_MAX_SIZE) |
229 | return kmalloc_large(size, flags); | 248 | return kmalloc_large(size, flags); |
@@ -234,7 +253,13 @@ static __always_inline void *kmalloc(size_t size, gfp_t flags) | |||
234 | if (!s) | 253 | if (!s) |
235 | return ZERO_SIZE_PTR; | 254 | return ZERO_SIZE_PTR; |
236 | 255 | ||
237 | return kmem_cache_alloc(s, flags); | 256 | ret = kmem_cache_alloc_notrace(s, flags); |
257 | |||
258 | kmemtrace_mark_alloc(KMEMTRACE_TYPE_KMALLOC, | ||
259 | _THIS_IP_, ret, | ||
260 | size, s->size, flags); | ||
261 | |||
262 | return ret; | ||
238 | } | 263 | } |
239 | } | 264 | } |
240 | return __kmalloc(size, flags); | 265 | return __kmalloc(size, flags); |
@@ -244,8 +269,24 @@ static __always_inline void *kmalloc(size_t size, gfp_t flags) | |||
244 | void *__kmalloc_node(size_t size, gfp_t flags, int node); | 269 | void *__kmalloc_node(size_t size, gfp_t flags, int node); |
245 | void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node); | 270 | void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node); |
246 | 271 | ||
272 | #ifdef CONFIG_KMEMTRACE | ||
273 | extern void *kmem_cache_alloc_node_notrace(struct kmem_cache *s, | ||
274 | gfp_t gfpflags, | ||
275 | int node); | ||
276 | #else | ||
277 | static __always_inline void * | ||
278 | kmem_cache_alloc_node_notrace(struct kmem_cache *s, | ||
279 | gfp_t gfpflags, | ||
280 | int node) | ||
281 | { | ||
282 | return kmem_cache_alloc_node(s, gfpflags, node); | ||
283 | } | ||
284 | #endif | ||
285 | |||
247 | static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node) | 286 | static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node) |
248 | { | 287 | { |
288 | void *ret; | ||
289 | |||
249 | if (__builtin_constant_p(size) && | 290 | if (__builtin_constant_p(size) && |
250 | size <= SLUB_MAX_SIZE && !(flags & SLUB_DMA)) { | 291 | size <= SLUB_MAX_SIZE && !(flags & SLUB_DMA)) { |
251 | struct kmem_cache *s = kmalloc_slab(size); | 292 | struct kmem_cache *s = kmalloc_slab(size); |
@@ -253,7 +294,13 @@ static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node) | |||
253 | if (!s) | 294 | if (!s) |
254 | return ZERO_SIZE_PTR; | 295 | return ZERO_SIZE_PTR; |
255 | 296 | ||
256 | return kmem_cache_alloc_node(s, flags, node); | 297 | ret = kmem_cache_alloc_node_notrace(s, flags, node); |
298 | |||
299 | kmemtrace_mark_alloc_node(KMEMTRACE_TYPE_KMALLOC, | ||
300 | _THIS_IP_, ret, | ||
301 | size, s->size, flags, node); | ||
302 | |||
303 | return ret; | ||
257 | } | 304 | } |
258 | return __kmalloc_node(size, flags, node); | 305 | return __kmalloc_node(size, flags, node); |
259 | } | 306 | } |
diff --git a/include/linux/sonypi.h b/include/linux/sonypi.h index f41ffd7c2dd..34c4475ac4a 100644 --- a/include/linux/sonypi.h +++ b/include/linux/sonypi.h | |||
@@ -103,6 +103,14 @@ | |||
103 | #define SONYPI_EVENT_WIRELESS_OFF 61 | 103 | #define SONYPI_EVENT_WIRELESS_OFF 61 |
104 | #define SONYPI_EVENT_ZOOM_IN_PRESSED 62 | 104 | #define SONYPI_EVENT_ZOOM_IN_PRESSED 62 |
105 | #define SONYPI_EVENT_ZOOM_OUT_PRESSED 63 | 105 | #define SONYPI_EVENT_ZOOM_OUT_PRESSED 63 |
106 | #define SONYPI_EVENT_CD_EJECT_PRESSED 64 | ||
107 | #define SONYPI_EVENT_MODEKEY_PRESSED 65 | ||
108 | #define SONYPI_EVENT_PKEY_P4 66 | ||
109 | #define SONYPI_EVENT_PKEY_P5 67 | ||
110 | #define SONYPI_EVENT_SETTINGKEY_PRESSED 68 | ||
111 | #define SONYPI_EVENT_VOLUME_INC_PRESSED 69 | ||
112 | #define SONYPI_EVENT_VOLUME_DEC_PRESSED 70 | ||
113 | #define SONYPI_EVENT_BRIGHTNESS_PRESSED 71 | ||
106 | 114 | ||
107 | /* get/set brightness */ | 115 | /* get/set brightness */ |
108 | #define SONYPI_IOCGBRT _IOR('v', 0, __u8) | 116 | #define SONYPI_IOCGBRT _IOR('v', 0, __u8) |
diff --git a/include/linux/string.h b/include/linux/string.h index 8852739f36d..489019ef169 100644 --- a/include/linux/string.h +++ b/include/linux/string.h | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/compiler.h> /* for inline */ | 10 | #include <linux/compiler.h> /* for inline */ |
11 | #include <linux/types.h> /* for size_t */ | 11 | #include <linux/types.h> /* for size_t */ |
12 | #include <linux/stddef.h> /* for NULL */ | 12 | #include <linux/stddef.h> /* for NULL */ |
13 | #include <stdarg.h> | ||
13 | 14 | ||
14 | extern char *strndup_user(const char __user *, long); | 15 | extern char *strndup_user(const char __user *, long); |
15 | extern void *memdup_user(const void __user *, size_t); | 16 | extern void *memdup_user(const void __user *, size_t); |
@@ -112,8 +113,23 @@ extern void argv_free(char **argv); | |||
112 | 113 | ||
113 | extern bool sysfs_streq(const char *s1, const char *s2); | 114 | extern bool sysfs_streq(const char *s1, const char *s2); |
114 | 115 | ||
116 | #ifdef CONFIG_BINARY_PRINTF | ||
117 | int vbin_printf(u32 *bin_buf, size_t size, const char *fmt, va_list args); | ||
118 | int bstr_printf(char *buf, size_t size, const char *fmt, const u32 *bin_buf); | ||
119 | int bprintf(u32 *bin_buf, size_t size, const char *fmt, ...) __printf(3, 4); | ||
120 | #endif | ||
121 | |||
115 | extern ssize_t memory_read_from_buffer(void *to, size_t count, loff_t *ppos, | 122 | extern ssize_t memory_read_from_buffer(void *to, size_t count, loff_t *ppos, |
116 | const void *from, size_t available); | 123 | const void *from, size_t available); |
117 | 124 | ||
125 | /** | ||
126 | * strstarts - does @str start with @prefix? | ||
127 | * @str: string to examine | ||
128 | * @prefix: prefix to look for. | ||
129 | */ | ||
130 | static inline bool strstarts(const char *str, const char *prefix) | ||
131 | { | ||
132 | return strncmp(str, prefix, strlen(prefix)) == 0; | ||
133 | } | ||
118 | #endif | 134 | #endif |
119 | #endif /* _LINUX_STRING_H_ */ | 135 | #endif /* _LINUX_STRING_H_ */ |
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index b299a82a05e..6470f74074a 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h | |||
@@ -65,6 +65,7 @@ struct old_linux_dirent; | |||
65 | #include <asm/signal.h> | 65 | #include <asm/signal.h> |
66 | #include <linux/quota.h> | 66 | #include <linux/quota.h> |
67 | #include <linux/key.h> | 67 | #include <linux/key.h> |
68 | #include <linux/ftrace.h> | ||
68 | 69 | ||
69 | #define __SC_DECL1(t1, a1) t1 a1 | 70 | #define __SC_DECL1(t1, a1) t1 a1 |
70 | #define __SC_DECL2(t2, a2, ...) t2 a2, __SC_DECL1(__VA_ARGS__) | 71 | #define __SC_DECL2(t2, a2, ...) t2 a2, __SC_DECL1(__VA_ARGS__) |
@@ -95,7 +96,46 @@ struct old_linux_dirent; | |||
95 | #define __SC_TEST5(t5, a5, ...) __SC_TEST(t5); __SC_TEST4(__VA_ARGS__) | 96 | #define __SC_TEST5(t5, a5, ...) __SC_TEST(t5); __SC_TEST4(__VA_ARGS__) |
96 | #define __SC_TEST6(t6, a6, ...) __SC_TEST(t6); __SC_TEST5(__VA_ARGS__) | 97 | #define __SC_TEST6(t6, a6, ...) __SC_TEST(t6); __SC_TEST5(__VA_ARGS__) |
97 | 98 | ||
99 | #ifdef CONFIG_FTRACE_SYSCALLS | ||
100 | #define __SC_STR_ADECL1(t, a) #a | ||
101 | #define __SC_STR_ADECL2(t, a, ...) #a, __SC_STR_ADECL1(__VA_ARGS__) | ||
102 | #define __SC_STR_ADECL3(t, a, ...) #a, __SC_STR_ADECL2(__VA_ARGS__) | ||
103 | #define __SC_STR_ADECL4(t, a, ...) #a, __SC_STR_ADECL3(__VA_ARGS__) | ||
104 | #define __SC_STR_ADECL5(t, a, ...) #a, __SC_STR_ADECL4(__VA_ARGS__) | ||
105 | #define __SC_STR_ADECL6(t, a, ...) #a, __SC_STR_ADECL5(__VA_ARGS__) | ||
106 | |||
107 | #define __SC_STR_TDECL1(t, a) #t | ||
108 | #define __SC_STR_TDECL2(t, a, ...) #t, __SC_STR_TDECL1(__VA_ARGS__) | ||
109 | #define __SC_STR_TDECL3(t, a, ...) #t, __SC_STR_TDECL2(__VA_ARGS__) | ||
110 | #define __SC_STR_TDECL4(t, a, ...) #t, __SC_STR_TDECL3(__VA_ARGS__) | ||
111 | #define __SC_STR_TDECL5(t, a, ...) #t, __SC_STR_TDECL4(__VA_ARGS__) | ||
112 | #define __SC_STR_TDECL6(t, a, ...) #t, __SC_STR_TDECL5(__VA_ARGS__) | ||
113 | |||
114 | #define SYSCALL_METADATA(sname, nb) \ | ||
115 | static const struct syscall_metadata __used \ | ||
116 | __attribute__((__aligned__(4))) \ | ||
117 | __attribute__((section("__syscalls_metadata"))) \ | ||
118 | __syscall_meta_##sname = { \ | ||
119 | .name = "sys"#sname, \ | ||
120 | .nb_args = nb, \ | ||
121 | .types = types_##sname, \ | ||
122 | .args = args_##sname, \ | ||
123 | } | ||
124 | |||
125 | #define SYSCALL_DEFINE0(sname) \ | ||
126 | static const struct syscall_metadata __used \ | ||
127 | __attribute__((__aligned__(4))) \ | ||
128 | __attribute__((section("__syscalls_metadata"))) \ | ||
129 | __syscall_meta_##sname = { \ | ||
130 | .name = "sys_"#sname, \ | ||
131 | .nb_args = 0, \ | ||
132 | }; \ | ||
133 | asmlinkage long sys_##sname(void) | ||
134 | |||
135 | #else | ||
98 | #define SYSCALL_DEFINE0(name) asmlinkage long sys_##name(void) | 136 | #define SYSCALL_DEFINE0(name) asmlinkage long sys_##name(void) |
137 | #endif | ||
138 | |||
99 | #define SYSCALL_DEFINE1(name, ...) SYSCALL_DEFINEx(1, _##name, __VA_ARGS__) | 139 | #define SYSCALL_DEFINE1(name, ...) SYSCALL_DEFINEx(1, _##name, __VA_ARGS__) |
100 | #define SYSCALL_DEFINE2(name, ...) SYSCALL_DEFINEx(2, _##name, __VA_ARGS__) | 140 | #define SYSCALL_DEFINE2(name, ...) SYSCALL_DEFINEx(2, _##name, __VA_ARGS__) |
101 | #define SYSCALL_DEFINE3(name, ...) SYSCALL_DEFINEx(3, _##name, __VA_ARGS__) | 141 | #define SYSCALL_DEFINE3(name, ...) SYSCALL_DEFINEx(3, _##name, __VA_ARGS__) |
@@ -117,10 +157,26 @@ struct old_linux_dirent; | |||
117 | #endif | 157 | #endif |
118 | #endif | 158 | #endif |
119 | 159 | ||
160 | #ifdef CONFIG_FTRACE_SYSCALLS | ||
161 | #define SYSCALL_DEFINEx(x, sname, ...) \ | ||
162 | static const char *types_##sname[] = { \ | ||
163 | __SC_STR_TDECL##x(__VA_ARGS__) \ | ||
164 | }; \ | ||
165 | static const char *args_##sname[] = { \ | ||
166 | __SC_STR_ADECL##x(__VA_ARGS__) \ | ||
167 | }; \ | ||
168 | SYSCALL_METADATA(sname, x); \ | ||
169 | __SYSCALL_DEFINEx(x, sname, __VA_ARGS__) | ||
170 | #else | ||
171 | #define SYSCALL_DEFINEx(x, sname, ...) \ | ||
172 | __SYSCALL_DEFINEx(x, sname, __VA_ARGS__) | ||
173 | #endif | ||
174 | |||
120 | #ifdef CONFIG_HAVE_SYSCALL_WRAPPERS | 175 | #ifdef CONFIG_HAVE_SYSCALL_WRAPPERS |
121 | 176 | ||
122 | #define SYSCALL_DEFINE(name) static inline long SYSC_##name | 177 | #define SYSCALL_DEFINE(name) static inline long SYSC_##name |
123 | #define SYSCALL_DEFINEx(x, name, ...) \ | 178 | |
179 | #define __SYSCALL_DEFINEx(x, name, ...) \ | ||
124 | asmlinkage long sys##name(__SC_DECL##x(__VA_ARGS__)); \ | 180 | asmlinkage long sys##name(__SC_DECL##x(__VA_ARGS__)); \ |
125 | static inline long SYSC##name(__SC_DECL##x(__VA_ARGS__)); \ | 181 | static inline long SYSC##name(__SC_DECL##x(__VA_ARGS__)); \ |
126 | asmlinkage long SyS##name(__SC_LONG##x(__VA_ARGS__)) \ | 182 | asmlinkage long SyS##name(__SC_LONG##x(__VA_ARGS__)) \ |
@@ -134,7 +190,7 @@ struct old_linux_dirent; | |||
134 | #else /* CONFIG_HAVE_SYSCALL_WRAPPERS */ | 190 | #else /* CONFIG_HAVE_SYSCALL_WRAPPERS */ |
135 | 191 | ||
136 | #define SYSCALL_DEFINE(name) asmlinkage long sys_##name | 192 | #define SYSCALL_DEFINE(name) asmlinkage long sys_##name |
137 | #define SYSCALL_DEFINEx(x, name, ...) \ | 193 | #define __SYSCALL_DEFINEx(x, name, ...) \ |
138 | asmlinkage long sys##name(__SC_DECL##x(__VA_ARGS__)) | 194 | asmlinkage long sys##name(__SC_DECL##x(__VA_ARGS__)) |
139 | 195 | ||
140 | #endif /* CONFIG_HAVE_SYSCALL_WRAPPERS */ | 196 | #endif /* CONFIG_HAVE_SYSCALL_WRAPPERS */ |
@@ -462,9 +518,9 @@ asmlinkage long sys_pread64(unsigned int fd, char __user *buf, | |||
462 | asmlinkage long sys_pwrite64(unsigned int fd, const char __user *buf, | 518 | asmlinkage long sys_pwrite64(unsigned int fd, const char __user *buf, |
463 | size_t count, loff_t pos); | 519 | size_t count, loff_t pos); |
464 | asmlinkage long sys_preadv(unsigned long fd, const struct iovec __user *vec, | 520 | asmlinkage long sys_preadv(unsigned long fd, const struct iovec __user *vec, |
465 | unsigned long vlen, u32 pos_high, u32 pos_low); | 521 | unsigned long vlen, unsigned long pos_l, unsigned long pos_h); |
466 | asmlinkage long sys_pwritev(unsigned long fd, const struct iovec __user *vec, | 522 | asmlinkage long sys_pwritev(unsigned long fd, const struct iovec __user *vec, |
467 | unsigned long vlen, u32 pos_high, u32 pos_low); | 523 | unsigned long vlen, unsigned long pos_l, unsigned long pos_h); |
468 | asmlinkage long sys_getcwd(char __user *buf, unsigned long size); | 524 | asmlinkage long sys_getcwd(char __user *buf, unsigned long size); |
469 | asmlinkage long sys_mkdir(const char __user *pathname, int mode); | 525 | asmlinkage long sys_mkdir(const char __user *pathname, int mode); |
470 | asmlinkage long sys_chdir(const char __user *filename); | 526 | asmlinkage long sys_chdir(const char __user *filename); |
diff --git a/include/linux/thermal.h b/include/linux/thermal.h index 917707e6151..1de8b9eb841 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h | |||
@@ -27,27 +27,46 @@ | |||
27 | 27 | ||
28 | #include <linux/idr.h> | 28 | #include <linux/idr.h> |
29 | #include <linux/device.h> | 29 | #include <linux/device.h> |
30 | #include <linux/workqueue.h> | ||
30 | 31 | ||
31 | struct thermal_zone_device; | 32 | struct thermal_zone_device; |
32 | struct thermal_cooling_device; | 33 | struct thermal_cooling_device; |
33 | 34 | ||
35 | enum thermal_device_mode { | ||
36 | THERMAL_DEVICE_DISABLED = 0, | ||
37 | THERMAL_DEVICE_ENABLED, | ||
38 | }; | ||
39 | |||
40 | enum thermal_trip_type { | ||
41 | THERMAL_TRIP_ACTIVE = 0, | ||
42 | THERMAL_TRIP_PASSIVE, | ||
43 | THERMAL_TRIP_HOT, | ||
44 | THERMAL_TRIP_CRITICAL, | ||
45 | }; | ||
46 | |||
34 | struct thermal_zone_device_ops { | 47 | struct thermal_zone_device_ops { |
35 | int (*bind) (struct thermal_zone_device *, | 48 | int (*bind) (struct thermal_zone_device *, |
36 | struct thermal_cooling_device *); | 49 | struct thermal_cooling_device *); |
37 | int (*unbind) (struct thermal_zone_device *, | 50 | int (*unbind) (struct thermal_zone_device *, |
38 | struct thermal_cooling_device *); | 51 | struct thermal_cooling_device *); |
39 | int (*get_temp) (struct thermal_zone_device *, char *); | 52 | int (*get_temp) (struct thermal_zone_device *, unsigned long *); |
40 | int (*get_mode) (struct thermal_zone_device *, char *); | 53 | int (*get_mode) (struct thermal_zone_device *, |
41 | int (*set_mode) (struct thermal_zone_device *, const char *); | 54 | enum thermal_device_mode *); |
42 | int (*get_trip_type) (struct thermal_zone_device *, int, char *); | 55 | int (*set_mode) (struct thermal_zone_device *, |
43 | int (*get_trip_temp) (struct thermal_zone_device *, int, char *); | 56 | enum thermal_device_mode); |
57 | int (*get_trip_type) (struct thermal_zone_device *, int, | ||
58 | enum thermal_trip_type *); | ||
59 | int (*get_trip_temp) (struct thermal_zone_device *, int, | ||
60 | unsigned long *); | ||
44 | int (*get_crit_temp) (struct thermal_zone_device *, unsigned long *); | 61 | int (*get_crit_temp) (struct thermal_zone_device *, unsigned long *); |
62 | int (*notify) (struct thermal_zone_device *, int, | ||
63 | enum thermal_trip_type); | ||
45 | }; | 64 | }; |
46 | 65 | ||
47 | struct thermal_cooling_device_ops { | 66 | struct thermal_cooling_device_ops { |
48 | int (*get_max_state) (struct thermal_cooling_device *, char *); | 67 | int (*get_max_state) (struct thermal_cooling_device *, unsigned long *); |
49 | int (*get_cur_state) (struct thermal_cooling_device *, char *); | 68 | int (*get_cur_state) (struct thermal_cooling_device *, unsigned long *); |
50 | int (*set_cur_state) (struct thermal_cooling_device *, unsigned int); | 69 | int (*set_cur_state) (struct thermal_cooling_device *, unsigned long); |
51 | }; | 70 | }; |
52 | 71 | ||
53 | #define THERMAL_TRIPS_NONE -1 | 72 | #define THERMAL_TRIPS_NONE -1 |
@@ -88,11 +107,19 @@ struct thermal_zone_device { | |||
88 | struct device device; | 107 | struct device device; |
89 | void *devdata; | 108 | void *devdata; |
90 | int trips; | 109 | int trips; |
110 | int tc1; | ||
111 | int tc2; | ||
112 | int passive_delay; | ||
113 | int polling_delay; | ||
114 | int last_temperature; | ||
115 | bool passive; | ||
116 | unsigned int forced_passive; | ||
91 | struct thermal_zone_device_ops *ops; | 117 | struct thermal_zone_device_ops *ops; |
92 | struct list_head cooling_devices; | 118 | struct list_head cooling_devices; |
93 | struct idr idr; | 119 | struct idr idr; |
94 | struct mutex lock; /* protect cooling devices list */ | 120 | struct mutex lock; /* protect cooling devices list */ |
95 | struct list_head node; | 121 | struct list_head node; |
122 | struct delayed_work poll_queue; | ||
96 | #if defined(CONFIG_THERMAL_HWMON) | 123 | #if defined(CONFIG_THERMAL_HWMON) |
97 | struct list_head hwmon_node; | 124 | struct list_head hwmon_node; |
98 | struct thermal_hwmon_device *hwmon; | 125 | struct thermal_hwmon_device *hwmon; |
@@ -104,13 +131,16 @@ struct thermal_zone_device { | |||
104 | struct thermal_zone_device *thermal_zone_device_register(char *, int, void *, | 131 | struct thermal_zone_device *thermal_zone_device_register(char *, int, void *, |
105 | struct | 132 | struct |
106 | thermal_zone_device_ops | 133 | thermal_zone_device_ops |
107 | *); | 134 | *, int tc1, int tc2, |
135 | int passive_freq, | ||
136 | int polling_freq); | ||
108 | void thermal_zone_device_unregister(struct thermal_zone_device *); | 137 | void thermal_zone_device_unregister(struct thermal_zone_device *); |
109 | 138 | ||
110 | int thermal_zone_bind_cooling_device(struct thermal_zone_device *, int, | 139 | int thermal_zone_bind_cooling_device(struct thermal_zone_device *, int, |
111 | struct thermal_cooling_device *); | 140 | struct thermal_cooling_device *); |
112 | int thermal_zone_unbind_cooling_device(struct thermal_zone_device *, int, | 141 | int thermal_zone_unbind_cooling_device(struct thermal_zone_device *, int, |
113 | struct thermal_cooling_device *); | 142 | struct thermal_cooling_device *); |
143 | void thermal_zone_device_update(struct thermal_zone_device *); | ||
114 | struct thermal_cooling_device *thermal_cooling_device_register(char *, void *, | 144 | struct thermal_cooling_device *thermal_cooling_device_register(char *, void *, |
115 | struct | 145 | struct |
116 | thermal_cooling_device_ops | 146 | thermal_cooling_device_ops |
diff --git a/include/linux/topology.h b/include/linux/topology.h index a16b9e06f2e..7402c1a27c4 100644 --- a/include/linux/topology.h +++ b/include/linux/topology.h | |||
@@ -38,11 +38,7 @@ | |||
38 | #endif | 38 | #endif |
39 | 39 | ||
40 | #ifndef nr_cpus_node | 40 | #ifndef nr_cpus_node |
41 | #define nr_cpus_node(node) \ | 41 | #define nr_cpus_node(node) cpumask_weight(cpumask_of_node(node)) |
42 | ({ \ | ||
43 | node_to_cpumask_ptr(__tmp__, node); \ | ||
44 | cpus_weight(*__tmp__); \ | ||
45 | }) | ||
46 | #endif | 42 | #endif |
47 | 43 | ||
48 | #define for_each_node_with_cpus(node) \ | 44 | #define for_each_node_with_cpus(node) \ |
@@ -200,4 +196,9 @@ int arch_update_cpu_topology(void); | |||
200 | #define topology_core_cpumask(cpu) cpumask_of(cpu) | 196 | #define topology_core_cpumask(cpu) cpumask_of(cpu) |
201 | #endif | 197 | #endif |
202 | 198 | ||
199 | /* Returns the number of the current Node. */ | ||
200 | #ifndef numa_node_id | ||
201 | #define numa_node_id() (cpu_to_node(raw_smp_processor_id())) | ||
202 | #endif | ||
203 | |||
203 | #endif /* _LINUX_TOPOLOGY_H */ | 204 | #endif /* _LINUX_TOPOLOGY_H */ |
diff --git a/include/linux/trace_clock.h b/include/linux/trace_clock.h new file mode 100644 index 00000000000..7a813038408 --- /dev/null +++ b/include/linux/trace_clock.h | |||
@@ -0,0 +1,19 @@ | |||
1 | #ifndef _LINUX_TRACE_CLOCK_H | ||
2 | #define _LINUX_TRACE_CLOCK_H | ||
3 | |||
4 | /* | ||
5 | * 3 trace clock variants, with differing scalability/precision | ||
6 | * tradeoffs: | ||
7 | * | ||
8 | * - local: CPU-local trace clock | ||
9 | * - medium: scalable global clock with some jitter | ||
10 | * - global: globally monotonic, serialized clock | ||
11 | */ | ||
12 | #include <linux/compiler.h> | ||
13 | #include <linux/types.h> | ||
14 | |||
15 | extern u64 notrace trace_clock_local(void); | ||
16 | extern u64 notrace trace_clock(void); | ||
17 | extern u64 notrace trace_clock_global(void); | ||
18 | |||
19 | #endif /* _LINUX_TRACE_CLOCK_H */ | ||
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h index 75700545836..d35a7ee7611 100644 --- a/include/linux/tracepoint.h +++ b/include/linux/tracepoint.h | |||
@@ -31,8 +31,8 @@ struct tracepoint { | |||
31 | * Keep in sync with vmlinux.lds.h. | 31 | * Keep in sync with vmlinux.lds.h. |
32 | */ | 32 | */ |
33 | 33 | ||
34 | #define TPPROTO(args...) args | 34 | #define TP_PROTO(args...) args |
35 | #define TPARGS(args...) args | 35 | #define TP_ARGS(args...) args |
36 | 36 | ||
37 | #ifdef CONFIG_TRACEPOINTS | 37 | #ifdef CONFIG_TRACEPOINTS |
38 | 38 | ||
@@ -65,7 +65,7 @@ struct tracepoint { | |||
65 | { \ | 65 | { \ |
66 | if (unlikely(__tracepoint_##name.state)) \ | 66 | if (unlikely(__tracepoint_##name.state)) \ |
67 | __DO_TRACE(&__tracepoint_##name, \ | 67 | __DO_TRACE(&__tracepoint_##name, \ |
68 | TPPROTO(proto), TPARGS(args)); \ | 68 | TP_PROTO(proto), TP_ARGS(args)); \ |
69 | } \ | 69 | } \ |
70 | static inline int register_trace_##name(void (*probe)(proto)) \ | 70 | static inline int register_trace_##name(void (*probe)(proto)) \ |
71 | { \ | 71 | { \ |
@@ -153,4 +153,114 @@ static inline void tracepoint_synchronize_unregister(void) | |||
153 | synchronize_sched(); | 153 | synchronize_sched(); |
154 | } | 154 | } |
155 | 155 | ||
156 | #define PARAMS(args...) args | ||
157 | #define TRACE_FORMAT(name, proto, args, fmt) \ | ||
158 | DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) | ||
159 | |||
160 | |||
161 | /* | ||
162 | * For use with the TRACE_EVENT macro: | ||
163 | * | ||
164 | * We define a tracepoint, its arguments, its printk format | ||
165 | * and its 'fast binay record' layout. | ||
166 | * | ||
167 | * Firstly, name your tracepoint via TRACE_EVENT(name : the | ||
168 | * 'subsystem_event' notation is fine. | ||
169 | * | ||
170 | * Think about this whole construct as the | ||
171 | * 'trace_sched_switch() function' from now on. | ||
172 | * | ||
173 | * | ||
174 | * TRACE_EVENT(sched_switch, | ||
175 | * | ||
176 | * * | ||
177 | * * A function has a regular function arguments | ||
178 | * * prototype, declare it via TP_PROTO(): | ||
179 | * * | ||
180 | * | ||
181 | * TP_PROTO(struct rq *rq, struct task_struct *prev, | ||
182 | * struct task_struct *next), | ||
183 | * | ||
184 | * * | ||
185 | * * Define the call signature of the 'function'. | ||
186 | * * (Design sidenote: we use this instead of a | ||
187 | * * TP_PROTO1/TP_PROTO2/TP_PROTO3 ugliness.) | ||
188 | * * | ||
189 | * | ||
190 | * TP_ARGS(rq, prev, next), | ||
191 | * | ||
192 | * * | ||
193 | * * Fast binary tracing: define the trace record via | ||
194 | * * TP_STRUCT__entry(). You can think about it like a | ||
195 | * * regular C structure local variable definition. | ||
196 | * * | ||
197 | * * This is how the trace record is structured and will | ||
198 | * * be saved into the ring buffer. These are the fields | ||
199 | * * that will be exposed to user-space in | ||
200 | * * /debug/tracing/events/<*>/format. | ||
201 | * * | ||
202 | * * The declared 'local variable' is called '__entry' | ||
203 | * * | ||
204 | * * __field(pid_t, prev_prid) is equivalent to a standard declariton: | ||
205 | * * | ||
206 | * * pid_t prev_pid; | ||
207 | * * | ||
208 | * * __array(char, prev_comm, TASK_COMM_LEN) is equivalent to: | ||
209 | * * | ||
210 | * * char prev_comm[TASK_COMM_LEN]; | ||
211 | * * | ||
212 | * | ||
213 | * TP_STRUCT__entry( | ||
214 | * __array( char, prev_comm, TASK_COMM_LEN ) | ||
215 | * __field( pid_t, prev_pid ) | ||
216 | * __field( int, prev_prio ) | ||
217 | * __array( char, next_comm, TASK_COMM_LEN ) | ||
218 | * __field( pid_t, next_pid ) | ||
219 | * __field( int, next_prio ) | ||
220 | * ), | ||
221 | * | ||
222 | * * | ||
223 | * * Assign the entry into the trace record, by embedding | ||
224 | * * a full C statement block into TP_fast_assign(). You | ||
225 | * * can refer to the trace record as '__entry' - | ||
226 | * * otherwise you can put arbitrary C code in here. | ||
227 | * * | ||
228 | * * Note: this C code will execute every time a trace event | ||
229 | * * happens, on an active tracepoint. | ||
230 | * * | ||
231 | * | ||
232 | * TP_fast_assign( | ||
233 | * memcpy(__entry->next_comm, next->comm, TASK_COMM_LEN); | ||
234 | * __entry->prev_pid = prev->pid; | ||
235 | * __entry->prev_prio = prev->prio; | ||
236 | * memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN); | ||
237 | * __entry->next_pid = next->pid; | ||
238 | * __entry->next_prio = next->prio; | ||
239 | * ) | ||
240 | * | ||
241 | * * | ||
242 | * * Formatted output of a trace record via TP_printk(). | ||
243 | * * This is how the tracepoint will appear under ftrace | ||
244 | * * plugins that make use of this tracepoint. | ||
245 | * * | ||
246 | * * (raw-binary tracing wont actually perform this step.) | ||
247 | * * | ||
248 | * | ||
249 | * TP_printk("task %s:%d [%d] ==> %s:%d [%d]", | ||
250 | * __entry->prev_comm, __entry->prev_pid, __entry->prev_prio, | ||
251 | * __entry->next_comm, __entry->next_pid, __entry->next_prio), | ||
252 | * | ||
253 | * ); | ||
254 | * | ||
255 | * This macro construct is thus used for the regular printk format | ||
256 | * tracing setup, it is used to construct a function pointer based | ||
257 | * tracepoint callback (this is used by programmatic plugins and | ||
258 | * can also by used by generic instrumentation like SystemTap), and | ||
259 | * it is also used to expose a structured trace record in | ||
260 | * /debug/tracing/events/. | ||
261 | */ | ||
262 | |||
263 | #define TRACE_EVENT(name, proto, args, struct, assign, print) \ | ||
264 | DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) | ||
265 | |||
156 | #endif | 266 | #endif |
diff --git a/include/trace/block.h b/include/trace/block.h index 25c6a1fd5b7..25b7068b819 100644 --- a/include/trace/block.h +++ b/include/trace/block.h | |||
@@ -5,72 +5,72 @@ | |||
5 | #include <linux/tracepoint.h> | 5 | #include <linux/tracepoint.h> |
6 | 6 | ||
7 | DECLARE_TRACE(block_rq_abort, | 7 | DECLARE_TRACE(block_rq_abort, |
8 | TPPROTO(struct request_queue *q, struct request *rq), | 8 | TP_PROTO(struct request_queue *q, struct request *rq), |
9 | TPARGS(q, rq)); | 9 | TP_ARGS(q, rq)); |
10 | 10 | ||
11 | DECLARE_TRACE(block_rq_insert, | 11 | DECLARE_TRACE(block_rq_insert, |
12 | TPPROTO(struct request_queue *q, struct request *rq), | 12 | TP_PROTO(struct request_queue *q, struct request *rq), |
13 | TPARGS(q, rq)); | 13 | TP_ARGS(q, rq)); |
14 | 14 | ||
15 | DECLARE_TRACE(block_rq_issue, | 15 | DECLARE_TRACE(block_rq_issue, |
16 | TPPROTO(struct request_queue *q, struct request *rq), | 16 | TP_PROTO(struct request_queue *q, struct request *rq), |
17 | TPARGS(q, rq)); | 17 | TP_ARGS(q, rq)); |
18 | 18 | ||
19 | DECLARE_TRACE(block_rq_requeue, | 19 | DECLARE_TRACE(block_rq_requeue, |
20 | TPPROTO(struct request_queue *q, struct request *rq), | 20 | TP_PROTO(struct request_queue *q, struct request *rq), |
21 | TPARGS(q, rq)); | 21 | TP_ARGS(q, rq)); |
22 | 22 | ||
23 | DECLARE_TRACE(block_rq_complete, | 23 | DECLARE_TRACE(block_rq_complete, |
24 | TPPROTO(struct request_queue *q, struct request *rq), | 24 | TP_PROTO(struct request_queue *q, struct request *rq), |
25 | TPARGS(q, rq)); | 25 | TP_ARGS(q, rq)); |
26 | 26 | ||
27 | DECLARE_TRACE(block_bio_bounce, | 27 | DECLARE_TRACE(block_bio_bounce, |
28 | TPPROTO(struct request_queue *q, struct bio *bio), | 28 | TP_PROTO(struct request_queue *q, struct bio *bio), |
29 | TPARGS(q, bio)); | 29 | TP_ARGS(q, bio)); |
30 | 30 | ||
31 | DECLARE_TRACE(block_bio_complete, | 31 | DECLARE_TRACE(block_bio_complete, |
32 | TPPROTO(struct request_queue *q, struct bio *bio), | 32 | TP_PROTO(struct request_queue *q, struct bio *bio), |
33 | TPARGS(q, bio)); | 33 | TP_ARGS(q, bio)); |
34 | 34 | ||
35 | DECLARE_TRACE(block_bio_backmerge, | 35 | DECLARE_TRACE(block_bio_backmerge, |
36 | TPPROTO(struct request_queue *q, struct bio *bio), | 36 | TP_PROTO(struct request_queue *q, struct bio *bio), |
37 | TPARGS(q, bio)); | 37 | TP_ARGS(q, bio)); |
38 | 38 | ||
39 | DECLARE_TRACE(block_bio_frontmerge, | 39 | DECLARE_TRACE(block_bio_frontmerge, |
40 | TPPROTO(struct request_queue *q, struct bio *bio), | 40 | TP_PROTO(struct request_queue *q, struct bio *bio), |
41 | TPARGS(q, bio)); | 41 | TP_ARGS(q, bio)); |
42 | 42 | ||
43 | DECLARE_TRACE(block_bio_queue, | 43 | DECLARE_TRACE(block_bio_queue, |
44 | TPPROTO(struct request_queue *q, struct bio *bio), | 44 | TP_PROTO(struct request_queue *q, struct bio *bio), |
45 | TPARGS(q, bio)); | 45 | TP_ARGS(q, bio)); |
46 | 46 | ||
47 | DECLARE_TRACE(block_getrq, | 47 | DECLARE_TRACE(block_getrq, |
48 | TPPROTO(struct request_queue *q, struct bio *bio, int rw), | 48 | TP_PROTO(struct request_queue *q, struct bio *bio, int rw), |
49 | TPARGS(q, bio, rw)); | 49 | TP_ARGS(q, bio, rw)); |
50 | 50 | ||
51 | DECLARE_TRACE(block_sleeprq, | 51 | DECLARE_TRACE(block_sleeprq, |
52 | TPPROTO(struct request_queue *q, struct bio *bio, int rw), | 52 | TP_PROTO(struct request_queue *q, struct bio *bio, int rw), |
53 | TPARGS(q, bio, rw)); | 53 | TP_ARGS(q, bio, rw)); |
54 | 54 | ||
55 | DECLARE_TRACE(block_plug, | 55 | DECLARE_TRACE(block_plug, |
56 | TPPROTO(struct request_queue *q), | 56 | TP_PROTO(struct request_queue *q), |
57 | TPARGS(q)); | 57 | TP_ARGS(q)); |
58 | 58 | ||
59 | DECLARE_TRACE(block_unplug_timer, | 59 | DECLARE_TRACE(block_unplug_timer, |
60 | TPPROTO(struct request_queue *q), | 60 | TP_PROTO(struct request_queue *q), |
61 | TPARGS(q)); | 61 | TP_ARGS(q)); |
62 | 62 | ||
63 | DECLARE_TRACE(block_unplug_io, | 63 | DECLARE_TRACE(block_unplug_io, |
64 | TPPROTO(struct request_queue *q), | 64 | TP_PROTO(struct request_queue *q), |
65 | TPARGS(q)); | 65 | TP_ARGS(q)); |
66 | 66 | ||
67 | DECLARE_TRACE(block_split, | 67 | DECLARE_TRACE(block_split, |
68 | TPPROTO(struct request_queue *q, struct bio *bio, unsigned int pdu), | 68 | TP_PROTO(struct request_queue *q, struct bio *bio, unsigned int pdu), |
69 | TPARGS(q, bio, pdu)); | 69 | TP_ARGS(q, bio, pdu)); |
70 | 70 | ||
71 | DECLARE_TRACE(block_remap, | 71 | DECLARE_TRACE(block_remap, |
72 | TPPROTO(struct request_queue *q, struct bio *bio, dev_t dev, | 72 | TP_PROTO(struct request_queue *q, struct bio *bio, dev_t dev, |
73 | sector_t from, sector_t to), | 73 | sector_t from, sector_t to), |
74 | TPARGS(q, bio, dev, from, to)); | 74 | TP_ARGS(q, bio, dev, from, to)); |
75 | 75 | ||
76 | #endif | 76 | #endif |
diff --git a/include/trace/irq.h b/include/trace/irq.h new file mode 100644 index 00000000000..ff5d4495dc3 --- /dev/null +++ b/include/trace/irq.h | |||
@@ -0,0 +1,9 @@ | |||
1 | #ifndef _TRACE_IRQ_H | ||
2 | #define _TRACE_IRQ_H | ||
3 | |||
4 | #include <linux/interrupt.h> | ||
5 | #include <linux/tracepoint.h> | ||
6 | |||
7 | #include <trace/irq_event_types.h> | ||
8 | |||
9 | #endif | ||
diff --git a/include/trace/irq_event_types.h b/include/trace/irq_event_types.h new file mode 100644 index 00000000000..85964ebd47e --- /dev/null +++ b/include/trace/irq_event_types.h | |||
@@ -0,0 +1,55 @@ | |||
1 | |||
2 | /* use <trace/irq.h> instead */ | ||
3 | #ifndef TRACE_FORMAT | ||
4 | # error Do not include this file directly. | ||
5 | # error Unless you know what you are doing. | ||
6 | #endif | ||
7 | |||
8 | #undef TRACE_SYSTEM | ||
9 | #define TRACE_SYSTEM irq | ||
10 | |||
11 | /* | ||
12 | * Tracepoint for entry of interrupt handler: | ||
13 | */ | ||
14 | TRACE_FORMAT(irq_handler_entry, | ||
15 | TP_PROTO(int irq, struct irqaction *action), | ||
16 | TP_ARGS(irq, action), | ||
17 | TP_FMT("irq=%d handler=%s", irq, action->name) | ||
18 | ); | ||
19 | |||
20 | /* | ||
21 | * Tracepoint for return of an interrupt handler: | ||
22 | */ | ||
23 | TRACE_EVENT(irq_handler_exit, | ||
24 | |||
25 | TP_PROTO(int irq, struct irqaction *action, int ret), | ||
26 | |||
27 | TP_ARGS(irq, action, ret), | ||
28 | |||
29 | TP_STRUCT__entry( | ||
30 | __field( int, irq ) | ||
31 | __field( int, ret ) | ||
32 | ), | ||
33 | |||
34 | TP_fast_assign( | ||
35 | __entry->irq = irq; | ||
36 | __entry->ret = ret; | ||
37 | ), | ||
38 | |||
39 | TP_printk("irq=%d return=%s", | ||
40 | __entry->irq, __entry->ret ? "handled" : "unhandled") | ||
41 | ); | ||
42 | |||
43 | TRACE_FORMAT(softirq_entry, | ||
44 | TP_PROTO(struct softirq_action *h, struct softirq_action *vec), | ||
45 | TP_ARGS(h, vec), | ||
46 | TP_FMT("softirq=%d action=%s", (int)(h - vec), softirq_to_name[h-vec]) | ||
47 | ); | ||
48 | |||
49 | TRACE_FORMAT(softirq_exit, | ||
50 | TP_PROTO(struct softirq_action *h, struct softirq_action *vec), | ||
51 | TP_ARGS(h, vec), | ||
52 | TP_FMT("softirq=%d action=%s", (int)(h - vec), softirq_to_name[h-vec]) | ||
53 | ); | ||
54 | |||
55 | #undef TRACE_SYSTEM | ||
diff --git a/include/trace/kmemtrace.h b/include/trace/kmemtrace.h new file mode 100644 index 00000000000..ad8b7857855 --- /dev/null +++ b/include/trace/kmemtrace.h | |||
@@ -0,0 +1,75 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2008 Eduard - Gabriel Munteanu | ||
3 | * | ||
4 | * This file is released under GPL version 2. | ||
5 | */ | ||
6 | |||
7 | #ifndef _LINUX_KMEMTRACE_H | ||
8 | #define _LINUX_KMEMTRACE_H | ||
9 | |||
10 | #ifdef __KERNEL__ | ||
11 | |||
12 | #include <linux/types.h> | ||
13 | #include <linux/marker.h> | ||
14 | |||
15 | enum kmemtrace_type_id { | ||
16 | KMEMTRACE_TYPE_KMALLOC = 0, /* kmalloc() or kfree(). */ | ||
17 | KMEMTRACE_TYPE_CACHE, /* kmem_cache_*(). */ | ||
18 | KMEMTRACE_TYPE_PAGES, /* __get_free_pages() and friends. */ | ||
19 | }; | ||
20 | |||
21 | #ifdef CONFIG_KMEMTRACE | ||
22 | |||
23 | extern void kmemtrace_init(void); | ||
24 | |||
25 | extern void kmemtrace_mark_alloc_node(enum kmemtrace_type_id type_id, | ||
26 | unsigned long call_site, | ||
27 | const void *ptr, | ||
28 | size_t bytes_req, | ||
29 | size_t bytes_alloc, | ||
30 | gfp_t gfp_flags, | ||
31 | int node); | ||
32 | |||
33 | extern void kmemtrace_mark_free(enum kmemtrace_type_id type_id, | ||
34 | unsigned long call_site, | ||
35 | const void *ptr); | ||
36 | |||
37 | #else /* CONFIG_KMEMTRACE */ | ||
38 | |||
39 | static inline void kmemtrace_init(void) | ||
40 | { | ||
41 | } | ||
42 | |||
43 | static inline void kmemtrace_mark_alloc_node(enum kmemtrace_type_id type_id, | ||
44 | unsigned long call_site, | ||
45 | const void *ptr, | ||
46 | size_t bytes_req, | ||
47 | size_t bytes_alloc, | ||
48 | gfp_t gfp_flags, | ||
49 | int node) | ||
50 | { | ||
51 | } | ||
52 | |||
53 | static inline void kmemtrace_mark_free(enum kmemtrace_type_id type_id, | ||
54 | unsigned long call_site, | ||
55 | const void *ptr) | ||
56 | { | ||
57 | } | ||
58 | |||
59 | #endif /* CONFIG_KMEMTRACE */ | ||
60 | |||
61 | static inline void kmemtrace_mark_alloc(enum kmemtrace_type_id type_id, | ||
62 | unsigned long call_site, | ||
63 | const void *ptr, | ||
64 | size_t bytes_req, | ||
65 | size_t bytes_alloc, | ||
66 | gfp_t gfp_flags) | ||
67 | { | ||
68 | kmemtrace_mark_alloc_node(type_id, call_site, ptr, | ||
69 | bytes_req, bytes_alloc, gfp_flags, -1); | ||
70 | } | ||
71 | |||
72 | #endif /* __KERNEL__ */ | ||
73 | |||
74 | #endif /* _LINUX_KMEMTRACE_H */ | ||
75 | |||
diff --git a/include/trace/lockdep.h b/include/trace/lockdep.h new file mode 100644 index 00000000000..5ca67df87f2 --- /dev/null +++ b/include/trace/lockdep.h | |||
@@ -0,0 +1,9 @@ | |||
1 | #ifndef _TRACE_LOCKDEP_H | ||
2 | #define _TRACE_LOCKDEP_H | ||
3 | |||
4 | #include <linux/lockdep.h> | ||
5 | #include <linux/tracepoint.h> | ||
6 | |||
7 | #include <trace/lockdep_event_types.h> | ||
8 | |||
9 | #endif | ||
diff --git a/include/trace/lockdep_event_types.h b/include/trace/lockdep_event_types.h new file mode 100644 index 00000000000..adccfcd2ec8 --- /dev/null +++ b/include/trace/lockdep_event_types.h | |||
@@ -0,0 +1,44 @@ | |||
1 | |||
2 | #ifndef TRACE_FORMAT | ||
3 | # error Do not include this file directly. | ||
4 | # error Unless you know what you are doing. | ||
5 | #endif | ||
6 | |||
7 | #undef TRACE_SYSTEM | ||
8 | #define TRACE_SYSTEM lock | ||
9 | |||
10 | #ifdef CONFIG_LOCKDEP | ||
11 | |||
12 | TRACE_FORMAT(lock_acquire, | ||
13 | TP_PROTO(struct lockdep_map *lock, unsigned int subclass, | ||
14 | int trylock, int read, int check, | ||
15 | struct lockdep_map *next_lock, unsigned long ip), | ||
16 | TP_ARGS(lock, subclass, trylock, read, check, next_lock, ip), | ||
17 | TP_FMT("%s%s%s", trylock ? "try " : "", | ||
18 | read ? "read " : "", lock->name) | ||
19 | ); | ||
20 | |||
21 | TRACE_FORMAT(lock_release, | ||
22 | TP_PROTO(struct lockdep_map *lock, int nested, unsigned long ip), | ||
23 | TP_ARGS(lock, nested, ip), | ||
24 | TP_FMT("%s", lock->name) | ||
25 | ); | ||
26 | |||
27 | #ifdef CONFIG_LOCK_STAT | ||
28 | |||
29 | TRACE_FORMAT(lock_contended, | ||
30 | TP_PROTO(struct lockdep_map *lock, unsigned long ip), | ||
31 | TP_ARGS(lock, ip), | ||
32 | TP_FMT("%s", lock->name) | ||
33 | ); | ||
34 | |||
35 | TRACE_FORMAT(lock_acquired, | ||
36 | TP_PROTO(struct lockdep_map *lock, unsigned long ip), | ||
37 | TP_ARGS(lock, ip), | ||
38 | TP_FMT("%s", lock->name) | ||
39 | ); | ||
40 | |||
41 | #endif | ||
42 | #endif | ||
43 | |||
44 | #undef TRACE_SYSTEM | ||
diff --git a/include/trace/power.h b/include/trace/power.h new file mode 100644 index 00000000000..ef204666e98 --- /dev/null +++ b/include/trace/power.h | |||
@@ -0,0 +1,32 @@ | |||
1 | #ifndef _TRACE_POWER_H | ||
2 | #define _TRACE_POWER_H | ||
3 | |||
4 | #include <linux/ktime.h> | ||
5 | #include <linux/tracepoint.h> | ||
6 | |||
7 | enum { | ||
8 | POWER_NONE = 0, | ||
9 | POWER_CSTATE = 1, | ||
10 | POWER_PSTATE = 2, | ||
11 | }; | ||
12 | |||
13 | struct power_trace { | ||
14 | ktime_t stamp; | ||
15 | ktime_t end; | ||
16 | int type; | ||
17 | int state; | ||
18 | }; | ||
19 | |||
20 | DECLARE_TRACE(power_start, | ||
21 | TP_PROTO(struct power_trace *it, unsigned int type, unsigned int state), | ||
22 | TP_ARGS(it, type, state)); | ||
23 | |||
24 | DECLARE_TRACE(power_mark, | ||
25 | TP_PROTO(struct power_trace *it, unsigned int type, unsigned int state), | ||
26 | TP_ARGS(it, type, state)); | ||
27 | |||
28 | DECLARE_TRACE(power_end, | ||
29 | TP_PROTO(struct power_trace *it), | ||
30 | TP_ARGS(it)); | ||
31 | |||
32 | #endif /* _TRACE_POWER_H */ | ||
diff --git a/include/trace/sched.h b/include/trace/sched.h index 0d81098ee9f..4e372a1a29b 100644 --- a/include/trace/sched.h +++ b/include/trace/sched.h | |||
@@ -4,53 +4,6 @@ | |||
4 | #include <linux/sched.h> | 4 | #include <linux/sched.h> |
5 | #include <linux/tracepoint.h> | 5 | #include <linux/tracepoint.h> |
6 | 6 | ||
7 | DECLARE_TRACE(sched_kthread_stop, | 7 | #include <trace/sched_event_types.h> |
8 | TPPROTO(struct task_struct *t), | ||
9 | TPARGS(t)); | ||
10 | |||
11 | DECLARE_TRACE(sched_kthread_stop_ret, | ||
12 | TPPROTO(int ret), | ||
13 | TPARGS(ret)); | ||
14 | |||
15 | DECLARE_TRACE(sched_wait_task, | ||
16 | TPPROTO(struct rq *rq, struct task_struct *p), | ||
17 | TPARGS(rq, p)); | ||
18 | |||
19 | DECLARE_TRACE(sched_wakeup, | ||
20 | TPPROTO(struct rq *rq, struct task_struct *p, int success), | ||
21 | TPARGS(rq, p, success)); | ||
22 | |||
23 | DECLARE_TRACE(sched_wakeup_new, | ||
24 | TPPROTO(struct rq *rq, struct task_struct *p, int success), | ||
25 | TPARGS(rq, p, success)); | ||
26 | |||
27 | DECLARE_TRACE(sched_switch, | ||
28 | TPPROTO(struct rq *rq, struct task_struct *prev, | ||
29 | struct task_struct *next), | ||
30 | TPARGS(rq, prev, next)); | ||
31 | |||
32 | DECLARE_TRACE(sched_migrate_task, | ||
33 | TPPROTO(struct task_struct *p, int orig_cpu, int dest_cpu), | ||
34 | TPARGS(p, orig_cpu, dest_cpu)); | ||
35 | |||
36 | DECLARE_TRACE(sched_process_free, | ||
37 | TPPROTO(struct task_struct *p), | ||
38 | TPARGS(p)); | ||
39 | |||
40 | DECLARE_TRACE(sched_process_exit, | ||
41 | TPPROTO(struct task_struct *p), | ||
42 | TPARGS(p)); | ||
43 | |||
44 | DECLARE_TRACE(sched_process_wait, | ||
45 | TPPROTO(struct pid *pid), | ||
46 | TPARGS(pid)); | ||
47 | |||
48 | DECLARE_TRACE(sched_process_fork, | ||
49 | TPPROTO(struct task_struct *parent, struct task_struct *child), | ||
50 | TPARGS(parent, child)); | ||
51 | |||
52 | DECLARE_TRACE(sched_signal_send, | ||
53 | TPPROTO(int sig, struct task_struct *p), | ||
54 | TPARGS(sig, p)); | ||
55 | 8 | ||
56 | #endif | 9 | #endif |
diff --git a/include/trace/sched_event_types.h b/include/trace/sched_event_types.h new file mode 100644 index 00000000000..63547dc1125 --- /dev/null +++ b/include/trace/sched_event_types.h | |||
@@ -0,0 +1,337 @@ | |||
1 | |||
2 | /* use <trace/sched.h> instead */ | ||
3 | #ifndef TRACE_EVENT | ||
4 | # error Do not include this file directly. | ||
5 | # error Unless you know what you are doing. | ||
6 | #endif | ||
7 | |||
8 | #undef TRACE_SYSTEM | ||
9 | #define TRACE_SYSTEM sched | ||
10 | |||
11 | /* | ||
12 | * Tracepoint for calling kthread_stop, performed to end a kthread: | ||
13 | */ | ||
14 | TRACE_EVENT(sched_kthread_stop, | ||
15 | |||
16 | TP_PROTO(struct task_struct *t), | ||
17 | |||
18 | TP_ARGS(t), | ||
19 | |||
20 | TP_STRUCT__entry( | ||
21 | __array( char, comm, TASK_COMM_LEN ) | ||
22 | __field( pid_t, pid ) | ||
23 | ), | ||
24 | |||
25 | TP_fast_assign( | ||
26 | memcpy(__entry->comm, t->comm, TASK_COMM_LEN); | ||
27 | __entry->pid = t->pid; | ||
28 | ), | ||
29 | |||
30 | TP_printk("task %s:%d", __entry->comm, __entry->pid) | ||
31 | ); | ||
32 | |||
33 | /* | ||
34 | * Tracepoint for the return value of the kthread stopping: | ||
35 | */ | ||
36 | TRACE_EVENT(sched_kthread_stop_ret, | ||
37 | |||
38 | TP_PROTO(int ret), | ||
39 | |||
40 | TP_ARGS(ret), | ||
41 | |||
42 | TP_STRUCT__entry( | ||
43 | __field( int, ret ) | ||
44 | ), | ||
45 | |||
46 | TP_fast_assign( | ||
47 | __entry->ret = ret; | ||
48 | ), | ||
49 | |||
50 | TP_printk("ret %d", __entry->ret) | ||
51 | ); | ||
52 | |||
53 | /* | ||
54 | * Tracepoint for waiting on task to unschedule: | ||
55 | * | ||
56 | * (NOTE: the 'rq' argument is not used by generic trace events, | ||
57 | * but used by the latency tracer plugin. ) | ||
58 | */ | ||
59 | TRACE_EVENT(sched_wait_task, | ||
60 | |||
61 | TP_PROTO(struct rq *rq, struct task_struct *p), | ||
62 | |||
63 | TP_ARGS(rq, p), | ||
64 | |||
65 | TP_STRUCT__entry( | ||
66 | __array( char, comm, TASK_COMM_LEN ) | ||
67 | __field( pid_t, pid ) | ||
68 | __field( int, prio ) | ||
69 | ), | ||
70 | |||
71 | TP_fast_assign( | ||
72 | memcpy(__entry->comm, p->comm, TASK_COMM_LEN); | ||
73 | __entry->pid = p->pid; | ||
74 | __entry->prio = p->prio; | ||
75 | ), | ||
76 | |||
77 | TP_printk("task %s:%d [%d]", | ||
78 | __entry->comm, __entry->pid, __entry->prio) | ||
79 | ); | ||
80 | |||
81 | /* | ||
82 | * Tracepoint for waking up a task: | ||
83 | * | ||
84 | * (NOTE: the 'rq' argument is not used by generic trace events, | ||
85 | * but used by the latency tracer plugin. ) | ||
86 | */ | ||
87 | TRACE_EVENT(sched_wakeup, | ||
88 | |||
89 | TP_PROTO(struct rq *rq, struct task_struct *p, int success), | ||
90 | |||
91 | TP_ARGS(rq, p, success), | ||
92 | |||
93 | TP_STRUCT__entry( | ||
94 | __array( char, comm, TASK_COMM_LEN ) | ||
95 | __field( pid_t, pid ) | ||
96 | __field( int, prio ) | ||
97 | __field( int, success ) | ||
98 | ), | ||
99 | |||
100 | TP_fast_assign( | ||
101 | memcpy(__entry->comm, p->comm, TASK_COMM_LEN); | ||
102 | __entry->pid = p->pid; | ||
103 | __entry->prio = p->prio; | ||
104 | __entry->success = success; | ||
105 | ), | ||
106 | |||
107 | TP_printk("task %s:%d [%d] success=%d", | ||
108 | __entry->comm, __entry->pid, __entry->prio, | ||
109 | __entry->success) | ||
110 | ); | ||
111 | |||
112 | /* | ||
113 | * Tracepoint for waking up a new task: | ||
114 | * | ||
115 | * (NOTE: the 'rq' argument is not used by generic trace events, | ||
116 | * but used by the latency tracer plugin. ) | ||
117 | */ | ||
118 | TRACE_EVENT(sched_wakeup_new, | ||
119 | |||
120 | TP_PROTO(struct rq *rq, struct task_struct *p, int success), | ||
121 | |||
122 | TP_ARGS(rq, p, success), | ||
123 | |||
124 | TP_STRUCT__entry( | ||
125 | __array( char, comm, TASK_COMM_LEN ) | ||
126 | __field( pid_t, pid ) | ||
127 | __field( int, prio ) | ||
128 | __field( int, success ) | ||
129 | ), | ||
130 | |||
131 | TP_fast_assign( | ||
132 | memcpy(__entry->comm, p->comm, TASK_COMM_LEN); | ||
133 | __entry->pid = p->pid; | ||
134 | __entry->prio = p->prio; | ||
135 | __entry->success = success; | ||
136 | ), | ||
137 | |||
138 | TP_printk("task %s:%d [%d] success=%d", | ||
139 | __entry->comm, __entry->pid, __entry->prio, | ||
140 | __entry->success) | ||
141 | ); | ||
142 | |||
143 | /* | ||
144 | * Tracepoint for task switches, performed by the scheduler: | ||
145 | * | ||
146 | * (NOTE: the 'rq' argument is not used by generic trace events, | ||
147 | * but used by the latency tracer plugin. ) | ||
148 | */ | ||
149 | TRACE_EVENT(sched_switch, | ||
150 | |||
151 | TP_PROTO(struct rq *rq, struct task_struct *prev, | ||
152 | struct task_struct *next), | ||
153 | |||
154 | TP_ARGS(rq, prev, next), | ||
155 | |||
156 | TP_STRUCT__entry( | ||
157 | __array( char, prev_comm, TASK_COMM_LEN ) | ||
158 | __field( pid_t, prev_pid ) | ||
159 | __field( int, prev_prio ) | ||
160 | __array( char, next_comm, TASK_COMM_LEN ) | ||
161 | __field( pid_t, next_pid ) | ||
162 | __field( int, next_prio ) | ||
163 | ), | ||
164 | |||
165 | TP_fast_assign( | ||
166 | memcpy(__entry->next_comm, next->comm, TASK_COMM_LEN); | ||
167 | __entry->prev_pid = prev->pid; | ||
168 | __entry->prev_prio = prev->prio; | ||
169 | memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN); | ||
170 | __entry->next_pid = next->pid; | ||
171 | __entry->next_prio = next->prio; | ||
172 | ), | ||
173 | |||
174 | TP_printk("task %s:%d [%d] ==> %s:%d [%d]", | ||
175 | __entry->prev_comm, __entry->prev_pid, __entry->prev_prio, | ||
176 | __entry->next_comm, __entry->next_pid, __entry->next_prio) | ||
177 | ); | ||
178 | |||
179 | /* | ||
180 | * Tracepoint for a task being migrated: | ||
181 | */ | ||
182 | TRACE_EVENT(sched_migrate_task, | ||
183 | |||
184 | TP_PROTO(struct task_struct *p, int orig_cpu, int dest_cpu), | ||
185 | |||
186 | TP_ARGS(p, orig_cpu, dest_cpu), | ||
187 | |||
188 | TP_STRUCT__entry( | ||
189 | __array( char, comm, TASK_COMM_LEN ) | ||
190 | __field( pid_t, pid ) | ||
191 | __field( int, prio ) | ||
192 | __field( int, orig_cpu ) | ||
193 | __field( int, dest_cpu ) | ||
194 | ), | ||
195 | |||
196 | TP_fast_assign( | ||
197 | memcpy(__entry->comm, p->comm, TASK_COMM_LEN); | ||
198 | __entry->pid = p->pid; | ||
199 | __entry->prio = p->prio; | ||
200 | __entry->orig_cpu = orig_cpu; | ||
201 | __entry->dest_cpu = dest_cpu; | ||
202 | ), | ||
203 | |||
204 | TP_printk("task %s:%d [%d] from: %d to: %d", | ||
205 | __entry->comm, __entry->pid, __entry->prio, | ||
206 | __entry->orig_cpu, __entry->dest_cpu) | ||
207 | ); | ||
208 | |||
209 | /* | ||
210 | * Tracepoint for freeing a task: | ||
211 | */ | ||
212 | TRACE_EVENT(sched_process_free, | ||
213 | |||
214 | TP_PROTO(struct task_struct *p), | ||
215 | |||
216 | TP_ARGS(p), | ||
217 | |||
218 | TP_STRUCT__entry( | ||
219 | __array( char, comm, TASK_COMM_LEN ) | ||
220 | __field( pid_t, pid ) | ||
221 | __field( int, prio ) | ||
222 | ), | ||
223 | |||
224 | TP_fast_assign( | ||
225 | memcpy(__entry->comm, p->comm, TASK_COMM_LEN); | ||
226 | __entry->pid = p->pid; | ||
227 | __entry->prio = p->prio; | ||
228 | ), | ||
229 | |||
230 | TP_printk("task %s:%d [%d]", | ||
231 | __entry->comm, __entry->pid, __entry->prio) | ||
232 | ); | ||
233 | |||
234 | /* | ||
235 | * Tracepoint for a task exiting: | ||
236 | */ | ||
237 | TRACE_EVENT(sched_process_exit, | ||
238 | |||
239 | TP_PROTO(struct task_struct *p), | ||
240 | |||
241 | TP_ARGS(p), | ||
242 | |||
243 | TP_STRUCT__entry( | ||
244 | __array( char, comm, TASK_COMM_LEN ) | ||
245 | __field( pid_t, pid ) | ||
246 | __field( int, prio ) | ||
247 | ), | ||
248 | |||
249 | TP_fast_assign( | ||
250 | memcpy(__entry->comm, p->comm, TASK_COMM_LEN); | ||
251 | __entry->pid = p->pid; | ||
252 | __entry->prio = p->prio; | ||
253 | ), | ||
254 | |||
255 | TP_printk("task %s:%d [%d]", | ||
256 | __entry->comm, __entry->pid, __entry->prio) | ||
257 | ); | ||
258 | |||
259 | /* | ||
260 | * Tracepoint for a waiting task: | ||
261 | */ | ||
262 | TRACE_EVENT(sched_process_wait, | ||
263 | |||
264 | TP_PROTO(struct pid *pid), | ||
265 | |||
266 | TP_ARGS(pid), | ||
267 | |||
268 | TP_STRUCT__entry( | ||
269 | __array( char, comm, TASK_COMM_LEN ) | ||
270 | __field( pid_t, pid ) | ||
271 | __field( int, prio ) | ||
272 | ), | ||
273 | |||
274 | TP_fast_assign( | ||
275 | memcpy(__entry->comm, current->comm, TASK_COMM_LEN); | ||
276 | __entry->pid = pid_nr(pid); | ||
277 | __entry->prio = current->prio; | ||
278 | ), | ||
279 | |||
280 | TP_printk("task %s:%d [%d]", | ||
281 | __entry->comm, __entry->pid, __entry->prio) | ||
282 | ); | ||
283 | |||
284 | /* | ||
285 | * Tracepoint for do_fork: | ||
286 | */ | ||
287 | TRACE_EVENT(sched_process_fork, | ||
288 | |||
289 | TP_PROTO(struct task_struct *parent, struct task_struct *child), | ||
290 | |||
291 | TP_ARGS(parent, child), | ||
292 | |||
293 | TP_STRUCT__entry( | ||
294 | __array( char, parent_comm, TASK_COMM_LEN ) | ||
295 | __field( pid_t, parent_pid ) | ||
296 | __array( char, child_comm, TASK_COMM_LEN ) | ||
297 | __field( pid_t, child_pid ) | ||
298 | ), | ||
299 | |||
300 | TP_fast_assign( | ||
301 | memcpy(__entry->parent_comm, parent->comm, TASK_COMM_LEN); | ||
302 | __entry->parent_pid = parent->pid; | ||
303 | memcpy(__entry->child_comm, child->comm, TASK_COMM_LEN); | ||
304 | __entry->child_pid = child->pid; | ||
305 | ), | ||
306 | |||
307 | TP_printk("parent %s:%d child %s:%d", | ||
308 | __entry->parent_comm, __entry->parent_pid, | ||
309 | __entry->child_comm, __entry->child_pid) | ||
310 | ); | ||
311 | |||
312 | /* | ||
313 | * Tracepoint for sending a signal: | ||
314 | */ | ||
315 | TRACE_EVENT(sched_signal_send, | ||
316 | |||
317 | TP_PROTO(int sig, struct task_struct *p), | ||
318 | |||
319 | TP_ARGS(sig, p), | ||
320 | |||
321 | TP_STRUCT__entry( | ||
322 | __field( int, sig ) | ||
323 | __array( char, comm, TASK_COMM_LEN ) | ||
324 | __field( pid_t, pid ) | ||
325 | ), | ||
326 | |||
327 | TP_fast_assign( | ||
328 | memcpy(__entry->comm, p->comm, TASK_COMM_LEN); | ||
329 | __entry->pid = p->pid; | ||
330 | __entry->sig = sig; | ||
331 | ), | ||
332 | |||
333 | TP_printk("sig: %d task %s:%d", | ||
334 | __entry->sig, __entry->comm, __entry->pid) | ||
335 | ); | ||
336 | |||
337 | #undef TRACE_SYSTEM | ||
diff --git a/include/trace/skb.h b/include/trace/skb.h index a96610f92f6..b66206d9be7 100644 --- a/include/trace/skb.h +++ b/include/trace/skb.h | |||
@@ -5,7 +5,7 @@ | |||
5 | #include <linux/tracepoint.h> | 5 | #include <linux/tracepoint.h> |
6 | 6 | ||
7 | DECLARE_TRACE(kfree_skb, | 7 | DECLARE_TRACE(kfree_skb, |
8 | TPPROTO(struct sk_buff *skb, void *location), | 8 | TP_PROTO(struct sk_buff *skb, void *location), |
9 | TPARGS(skb, location)); | 9 | TP_ARGS(skb, location)); |
10 | 10 | ||
11 | #endif | 11 | #endif |
diff --git a/include/trace/trace_event_types.h b/include/trace/trace_event_types.h new file mode 100644 index 00000000000..df56f5694be --- /dev/null +++ b/include/trace/trace_event_types.h | |||
@@ -0,0 +1,5 @@ | |||
1 | /* trace/<type>_event_types.h here */ | ||
2 | |||
3 | #include <trace/sched_event_types.h> | ||
4 | #include <trace/irq_event_types.h> | ||
5 | #include <trace/lockdep_event_types.h> | ||
diff --git a/include/trace/trace_events.h b/include/trace/trace_events.h new file mode 100644 index 00000000000..fd13750ca4b --- /dev/null +++ b/include/trace/trace_events.h | |||
@@ -0,0 +1,5 @@ | |||
1 | /* trace/<type>.h here */ | ||
2 | |||
3 | #include <trace/sched.h> | ||
4 | #include <trace/irq.h> | ||
5 | #include <trace/lockdep.h> | ||
diff --git a/include/trace/workqueue.h b/include/trace/workqueue.h new file mode 100644 index 00000000000..7626523deeb --- /dev/null +++ b/include/trace/workqueue.h | |||
@@ -0,0 +1,25 @@ | |||
1 | #ifndef __TRACE_WORKQUEUE_H | ||
2 | #define __TRACE_WORKQUEUE_H | ||
3 | |||
4 | #include <linux/tracepoint.h> | ||
5 | #include <linux/workqueue.h> | ||
6 | #include <linux/sched.h> | ||
7 | |||
8 | DECLARE_TRACE(workqueue_insertion, | ||
9 | TP_PROTO(struct task_struct *wq_thread, struct work_struct *work), | ||
10 | TP_ARGS(wq_thread, work)); | ||
11 | |||
12 | DECLARE_TRACE(workqueue_execution, | ||
13 | TP_PROTO(struct task_struct *wq_thread, struct work_struct *work), | ||
14 | TP_ARGS(wq_thread, work)); | ||
15 | |||
16 | /* Trace the creation of one workqueue thread on a cpu */ | ||
17 | DECLARE_TRACE(workqueue_creation, | ||
18 | TP_PROTO(struct task_struct *wq_thread, int cpu), | ||
19 | TP_ARGS(wq_thread, cpu)); | ||
20 | |||
21 | DECLARE_TRACE(workqueue_destruction, | ||
22 | TP_PROTO(struct task_struct *wq_thread), | ||
23 | TP_ARGS(wq_thread)); | ||
24 | |||
25 | #endif /* __TRACE_WORKQUEUE_H */ | ||