diff options
38 files changed, 890 insertions, 398 deletions
diff --git a/Documentation/DocBook/drm.tmpl b/Documentation/DocBook/drm.tmpl index c27915893974..196b8b9dba11 100644 --- a/Documentation/DocBook/drm.tmpl +++ b/Documentation/DocBook/drm.tmpl | |||
@@ -32,7 +32,7 @@ | |||
32 | The Linux DRM layer contains code intended to support the needs | 32 | The Linux DRM layer contains code intended to support the needs |
33 | of complex graphics devices, usually containing programmable | 33 | of complex graphics devices, usually containing programmable |
34 | pipelines well suited to 3D graphics acceleration. Graphics | 34 | pipelines well suited to 3D graphics acceleration. Graphics |
35 | drivers in the kernel can make use of DRM functions to make | 35 | drivers in the kernel may make use of DRM functions to make |
36 | tasks like memory management, interrupt handling and DMA easier, | 36 | tasks like memory management, interrupt handling and DMA easier, |
37 | and provide a uniform interface to applications. | 37 | and provide a uniform interface to applications. |
38 | </para> | 38 | </para> |
@@ -57,10 +57,10 @@ | |||
57 | existing drivers. | 57 | existing drivers. |
58 | </para> | 58 | </para> |
59 | <para> | 59 | <para> |
60 | First, we'll go over some typical driver initialization | 60 | First, we go over some typical driver initialization |
61 | requirements, like setting up command buffers, creating an | 61 | requirements, like setting up command buffers, creating an |
62 | initial output configuration, and initializing core services. | 62 | initial output configuration, and initializing core services. |
63 | Subsequent sections will cover core internals in more detail, | 63 | Subsequent sections cover core internals in more detail, |
64 | providing implementation notes and examples. | 64 | providing implementation notes and examples. |
65 | </para> | 65 | </para> |
66 | <para> | 66 | <para> |
@@ -74,7 +74,7 @@ | |||
74 | </para> | 74 | </para> |
75 | <para> | 75 | <para> |
76 | The core of every DRM driver is struct drm_driver. Drivers | 76 | The core of every DRM driver is struct drm_driver. Drivers |
77 | will typically statically initialize a drm_driver structure, | 77 | typically statically initialize a drm_driver structure, |
78 | then pass it to drm_init() at load time. | 78 | then pass it to drm_init() at load time. |
79 | </para> | 79 | </para> |
80 | 80 | ||
@@ -88,8 +88,8 @@ | |||
88 | </para> | 88 | </para> |
89 | <programlisting> | 89 | <programlisting> |
90 | static struct drm_driver driver = { | 90 | static struct drm_driver driver = { |
91 | /* don't use mtrr's here, the Xserver or user space app should | 91 | /* Don't use MTRRs here; the Xserver or userspace app should |
92 | * deal with them for intel hardware. | 92 | * deal with them for Intel hardware. |
93 | */ | 93 | */ |
94 | .driver_features = | 94 | .driver_features = |
95 | DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | | 95 | DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | |
@@ -154,8 +154,8 @@ | |||
154 | </programlisting> | 154 | </programlisting> |
155 | <para> | 155 | <para> |
156 | In the example above, taken from the i915 DRM driver, the driver | 156 | In the example above, taken from the i915 DRM driver, the driver |
157 | sets several flags indicating what core features it supports. | 157 | sets several flags indicating what core features it supports; |
158 | We'll go over the individual callbacks in later sections. Since | 158 | we go over the individual callbacks in later sections. Since |
159 | flags indicate which features your driver supports to the DRM | 159 | flags indicate which features your driver supports to the DRM |
160 | core, you need to set most of them prior to calling drm_init(). Some, | 160 | core, you need to set most of them prior to calling drm_init(). Some, |
161 | like DRIVER_MODESET can be set later based on user supplied parameters, | 161 | like DRIVER_MODESET can be set later based on user supplied parameters, |
@@ -203,8 +203,8 @@ | |||
203 | <term>DRIVER_HAVE_IRQ</term><term>DRIVER_IRQ_SHARED</term> | 203 | <term>DRIVER_HAVE_IRQ</term><term>DRIVER_IRQ_SHARED</term> |
204 | <listitem> | 204 | <listitem> |
205 | <para> | 205 | <para> |
206 | DRIVER_HAVE_IRQ indicates whether the driver has a IRQ | 206 | DRIVER_HAVE_IRQ indicates whether the driver has an IRQ |
207 | handler, DRIVER_IRQ_SHARED indicates whether the device & | 207 | handler. DRIVER_IRQ_SHARED indicates whether the device & |
208 | handler support shared IRQs (note that this is required of | 208 | handler support shared IRQs (note that this is required of |
209 | PCI drivers). | 209 | PCI drivers). |
210 | </para> | 210 | </para> |
@@ -214,8 +214,8 @@ | |||
214 | <term>DRIVER_DMA_QUEUE</term> | 214 | <term>DRIVER_DMA_QUEUE</term> |
215 | <listitem> | 215 | <listitem> |
216 | <para> | 216 | <para> |
217 | If the driver queues DMA requests and completes them | 217 | Should be set if the driver queues DMA requests and completes them |
218 | asynchronously, this flag should be set. Deprecated. | 218 | asynchronously. Deprecated. |
219 | </para> | 219 | </para> |
220 | </listitem> | 220 | </listitem> |
221 | </varlistentry> | 221 | </varlistentry> |
@@ -238,7 +238,7 @@ | |||
238 | </variablelist> | 238 | </variablelist> |
239 | <para> | 239 | <para> |
240 | In this specific case, the driver requires AGP and supports | 240 | In this specific case, the driver requires AGP and supports |
241 | IRQs. DMA, as we'll see, is handled by device specific ioctls | 241 | IRQs. DMA, as discussed later, is handled by device-specific ioctls |
242 | in this case. It also supports the kernel mode setting APIs, though | 242 | in this case. It also supports the kernel mode setting APIs, though |
243 | unlike in the actual i915 driver source, this example unconditionally | 243 | unlike in the actual i915 driver source, this example unconditionally |
244 | exports KMS capability. | 244 | exports KMS capability. |
@@ -269,36 +269,34 @@ | |||
269 | initial output configuration. | 269 | initial output configuration. |
270 | </para> | 270 | </para> |
271 | <para> | 271 | <para> |
272 | Note that the tasks performed at driver load time must not | 272 | If compatibility is a concern (e.g. with drivers converted over |
273 | conflict with DRM client requirements. For instance, if user | 273 | to the new interfaces from the old ones), care must be taken to |
274 | prevent device initialization and control that is incompatible with | ||
275 | currently active userspace drivers. For instance, if user | ||
274 | level mode setting drivers are in use, it would be problematic | 276 | level mode setting drivers are in use, it would be problematic |
275 | to perform output discovery & configuration at load time. | 277 | to perform output discovery & configuration at load time. |
276 | Likewise, if pre-memory management aware user level drivers are | 278 | Likewise, if user-level drivers unaware of memory management are |
277 | in use, memory management and command buffer setup may need to | 279 | in use, memory management and command buffer setup may need to |
278 | be omitted. These requirements are driver specific, and care | 280 | be omitted. These requirements are driver-specific, and care |
279 | needs to be taken to keep both old and new applications and | 281 | needs to be taken to keep both old and new applications and |
280 | libraries working. The i915 driver supports the "modeset" | 282 | libraries working. The i915 driver supports the "modeset" |
281 | module parameter to control whether advanced features are | 283 | module parameter to control whether advanced features are |
282 | enabled at load time or in legacy fashion. If compatibility is | 284 | enabled at load time or in legacy fashion. |
283 | a concern (e.g. with drivers converted over to the new interfaces | ||
284 | from the old ones), care must be taken to prevent incompatible | ||
285 | device initialization and control with the currently active | ||
286 | userspace drivers. | ||
287 | </para> | 285 | </para> |
288 | 286 | ||
289 | <sect2> | 287 | <sect2> |
290 | <title>Driver private & performance counters</title> | 288 | <title>Driver private & performance counters</title> |
291 | <para> | 289 | <para> |
292 | The driver private hangs off the main drm_device structure and | 290 | The driver private hangs off the main drm_device structure and |
293 | can be used for tracking various device specific bits of | 291 | can be used for tracking various device-specific bits of |
294 | information, like register offsets, command buffer status, | 292 | information, like register offsets, command buffer status, |
295 | register state for suspend/resume, etc. At load time, a | 293 | register state for suspend/resume, etc. At load time, a |
296 | driver can simply allocate one and set drm_device.dev_priv | 294 | driver may simply allocate one and set drm_device.dev_priv |
297 | appropriately; at unload the driver can free it and set | 295 | appropriately; it should be freed and drm_device.dev_priv set |
298 | drm_device.dev_priv to NULL. | 296 | to NULL when the driver is unloaded. |
299 | </para> | 297 | </para> |
300 | <para> | 298 | <para> |
301 | The DRM supports several counters which can be used for rough | 299 | The DRM supports several counters which may be used for rough |
302 | performance characterization. Note that the DRM stat counter | 300 | performance characterization. Note that the DRM stat counter |
303 | system is not often used by applications, and supporting | 301 | system is not often used by applications, and supporting |
304 | additional counters is completely optional. | 302 | additional counters is completely optional. |
@@ -307,15 +305,15 @@ | |||
307 | These interfaces are deprecated and should not be used. If performance | 305 | These interfaces are deprecated and should not be used. If performance |
308 | monitoring is desired, the developer should investigate and | 306 | monitoring is desired, the developer should investigate and |
309 | potentially enhance the kernel perf and tracing infrastructure to export | 307 | potentially enhance the kernel perf and tracing infrastructure to export |
310 | GPU related performance information to performance monitoring | 308 | GPU related performance information for consumption by performance |
311 | tools and applications. | 309 | monitoring tools and applications. |
312 | </para> | 310 | </para> |
313 | </sect2> | 311 | </sect2> |
314 | 312 | ||
315 | <sect2> | 313 | <sect2> |
316 | <title>Configuring the device</title> | 314 | <title>Configuring the device</title> |
317 | <para> | 315 | <para> |
318 | Obviously, device configuration will be device specific. | 316 | Obviously, device configuration is device-specific. |
319 | However, there are several common operations: finding a | 317 | However, there are several common operations: finding a |
320 | device's PCI resources, mapping them, and potentially setting | 318 | device's PCI resources, mapping them, and potentially setting |
321 | up an IRQ handler. | 319 | up an IRQ handler. |
@@ -323,10 +321,10 @@ | |||
323 | <para> | 321 | <para> |
324 | Finding & mapping resources is fairly straightforward. The | 322 | Finding & mapping resources is fairly straightforward. The |
325 | DRM wrapper functions, drm_get_resource_start() and | 323 | DRM wrapper functions, drm_get_resource_start() and |
326 | drm_get_resource_len() can be used to find BARs on the given | 324 | drm_get_resource_len(), may be used to find BARs on the given |
327 | drm_device struct. Once those values have been retrieved, the | 325 | drm_device struct. Once those values have been retrieved, the |
328 | driver load function can call drm_addmap() to create a new | 326 | driver load function can call drm_addmap() to create a new |
329 | mapping for the BAR in question. Note you'll probably want a | 327 | mapping for the BAR in question. Note that you probably want a |
330 | drm_local_map_t in your driver private structure to track any | 328 | drm_local_map_t in your driver private structure to track any |
331 | mappings you create. | 329 | mappings you create. |
332 | <!-- !Fdrivers/gpu/drm/drm_bufs.c drm_get_resource_* --> | 330 | <!-- !Fdrivers/gpu/drm/drm_bufs.c drm_get_resource_* --> |
@@ -335,20 +333,20 @@ | |||
335 | <para> | 333 | <para> |
336 | if compatibility with other operating systems isn't a concern | 334 | if compatibility with other operating systems isn't a concern |
337 | (DRM drivers can run under various BSD variants and OpenSolaris), | 335 | (DRM drivers can run under various BSD variants and OpenSolaris), |
338 | native Linux calls can be used for the above, e.g. pci_resource_* | 336 | native Linux calls may be used for the above, e.g. pci_resource_* |
339 | and iomap*/iounmap. See the Linux device driver book for more | 337 | and iomap*/iounmap. See the Linux device driver book for more |
340 | info. | 338 | info. |
341 | </para> | 339 | </para> |
342 | <para> | 340 | <para> |
343 | Once you have a register map, you can use the DRM_READn() and | 341 | Once you have a register map, you may use the DRM_READn() and |
344 | DRM_WRITEn() macros to access the registers on your device, or | 342 | DRM_WRITEn() macros to access the registers on your device, or |
345 | use driver specific versions to offset into your MMIO space | 343 | use driver-specific versions to offset into your MMIO space |
346 | relative to a driver specific base pointer (see I915_READ for | 344 | relative to a driver-specific base pointer (see I915_READ for |
347 | example). | 345 | an example). |
348 | </para> | 346 | </para> |
349 | <para> | 347 | <para> |
350 | If your device supports interrupt generation, you may want to | 348 | If your device supports interrupt generation, you may want to |
351 | setup an interrupt handler at driver load time as well. This | 349 | set up an interrupt handler when the driver is loaded. This |
352 | is done using the drm_irq_install() function. If your device | 350 | is done using the drm_irq_install() function. If your device |
353 | supports vertical blank interrupts, it should call | 351 | supports vertical blank interrupts, it should call |
354 | drm_vblank_init() to initialize the core vblank handling code before | 352 | drm_vblank_init() to initialize the core vblank handling code before |
@@ -357,7 +355,7 @@ | |||
357 | </para> | 355 | </para> |
358 | <!--!Fdrivers/char/drm/drm_irq.c drm_irq_install--> | 356 | <!--!Fdrivers/char/drm/drm_irq.c drm_irq_install--> |
359 | <para> | 357 | <para> |
360 | Once your interrupt handler is registered (it'll use your | 358 | Once your interrupt handler is registered (it uses your |
361 | drm_driver.irq_handler as the actual interrupt handling | 359 | drm_driver.irq_handler as the actual interrupt handling |
362 | function), you can safely enable interrupts on your device, | 360 | function), you can safely enable interrupts on your device, |
363 | assuming any other state your interrupt handler uses is also | 361 | assuming any other state your interrupt handler uses is also |
@@ -371,10 +369,10 @@ | |||
371 | using the pci_map_rom() call, a convenience function that | 369 | using the pci_map_rom() call, a convenience function that |
372 | takes care of mapping the actual ROM, whether it has been | 370 | takes care of mapping the actual ROM, whether it has been |
373 | shadowed into memory (typically at address 0xc0000) or exists | 371 | shadowed into memory (typically at address 0xc0000) or exists |
374 | on the PCI device in the ROM BAR. Note that once you've | 372 | on the PCI device in the ROM BAR. Note that after the ROM |
375 | mapped the ROM and extracted any necessary information, be | 373 | has been mapped and any necessary information has been extracted, |
376 | sure to unmap it; on many devices the ROM address decoder is | 374 | it should be unmapped; on many devices, the ROM address decoder is |
377 | shared with other BARs, so leaving it mapped can cause | 375 | shared with other BARs, so leaving it mapped could cause |
378 | undesired behavior like hangs or memory corruption. | 376 | undesired behavior like hangs or memory corruption. |
379 | <!--!Fdrivers/pci/rom.c pci_map_rom--> | 377 | <!--!Fdrivers/pci/rom.c pci_map_rom--> |
380 | </para> | 378 | </para> |
@@ -389,9 +387,9 @@ | |||
389 | should support a memory manager. | 387 | should support a memory manager. |
390 | </para> | 388 | </para> |
391 | <para> | 389 | <para> |
392 | If your driver supports memory management (it should!), you'll | 390 | If your driver supports memory management (it should!), you |
393 | need to set that up at load time as well. How you initialize | 391 | need to set that up at load time as well. How you initialize |
394 | it depends on which memory manager you're using, TTM or GEM. | 392 | it depends on which memory manager you're using: TTM or GEM. |
395 | </para> | 393 | </para> |
396 | <sect3> | 394 | <sect3> |
397 | <title>TTM initialization</title> | 395 | <title>TTM initialization</title> |
@@ -401,7 +399,7 @@ | |||
401 | and devices with dedicated video RAM (VRAM), i.e. most discrete | 399 | and devices with dedicated video RAM (VRAM), i.e. most discrete |
402 | graphics devices. If your device has dedicated RAM, supporting | 400 | graphics devices. If your device has dedicated RAM, supporting |
403 | TTM is desirable. TTM also integrates tightly with your | 401 | TTM is desirable. TTM also integrates tightly with your |
404 | driver specific buffer execution function. See the radeon | 402 | driver-specific buffer execution function. See the radeon |
405 | driver for examples. | 403 | driver for examples. |
406 | </para> | 404 | </para> |
407 | <para> | 405 | <para> |
@@ -429,21 +427,21 @@ | |||
429 | created by the memory manager at runtime. Your global TTM should | 427 | created by the memory manager at runtime. Your global TTM should |
430 | have a type of TTM_GLOBAL_TTM_MEM. The size field for the global | 428 | have a type of TTM_GLOBAL_TTM_MEM. The size field for the global |
431 | object should be sizeof(struct ttm_mem_global), and the init and | 429 | object should be sizeof(struct ttm_mem_global), and the init and |
432 | release hooks should point at your driver specific init and | 430 | release hooks should point at your driver-specific init and |
433 | release routines, which will probably eventually call | 431 | release routines, which probably eventually call |
434 | ttm_mem_global_init and ttm_mem_global_release respectively. | 432 | ttm_mem_global_init and ttm_mem_global_release, respectively. |
435 | </para> | 433 | </para> |
436 | <para> | 434 | <para> |
437 | Once your global TTM accounting structure is set up and initialized | 435 | Once your global TTM accounting structure is set up and initialized |
438 | (done by calling ttm_global_item_ref on the global object you | 436 | by calling ttm_global_item_ref() on it, |
439 | just created), you'll need to create a buffer object TTM to | 437 | you need to create a buffer object TTM to |
440 | provide a pool for buffer object allocation by clients and the | 438 | provide a pool for buffer object allocation by clients and the |
441 | kernel itself. The type of this object should be TTM_GLOBAL_TTM_BO, | 439 | kernel itself. The type of this object should be TTM_GLOBAL_TTM_BO, |
442 | and its size should be sizeof(struct ttm_bo_global). Again, | 440 | and its size should be sizeof(struct ttm_bo_global). Again, |
443 | driver specific init and release functions can be provided, | 441 | driver-specific init and release functions may be provided, |
444 | likely eventually calling ttm_bo_global_init and | 442 | likely eventually calling ttm_bo_global_init() and |
445 | ttm_bo_global_release, respectively. Also like the previous | 443 | ttm_bo_global_release(), respectively. Also, like the previous |
446 | object, ttm_global_item_ref is used to create an initial reference | 444 | object, ttm_global_item_ref() is used to create an initial reference |
447 | count for the TTM, which will call your initialization function. | 445 | count for the TTM, which will call your initialization function. |
448 | </para> | 446 | </para> |
449 | </sect3> | 447 | </sect3> |
@@ -453,27 +451,26 @@ | |||
453 | GEM is an alternative to TTM, designed specifically for UMA | 451 | GEM is an alternative to TTM, designed specifically for UMA |
454 | devices. It has simpler initialization and execution requirements | 452 | devices. It has simpler initialization and execution requirements |
455 | than TTM, but has no VRAM management capability. Core GEM | 453 | than TTM, but has no VRAM management capability. Core GEM |
456 | initialization is comprised of a basic drm_mm_init call to create | 454 | is initialized by calling drm_mm_init() to create |
457 | a GTT DRM MM object, which provides an address space pool for | 455 | a GTT DRM MM object, which provides an address space pool for |
458 | object allocation. In a KMS configuration, the driver will | 456 | object allocation. In a KMS configuration, the driver |
459 | need to allocate and initialize a command ring buffer following | 457 | needs to allocate and initialize a command ring buffer following |
460 | basic GEM initialization. Most UMA devices have a so-called | 458 | core GEM initialization. A UMA device usually has what is called a |
461 | "stolen" memory region, which provides space for the initial | 459 | "stolen" memory region, which provides space for the initial |
462 | framebuffer and large, contiguous memory regions required by the | 460 | framebuffer and large, contiguous memory regions required by the |
463 | device. This space is not typically managed by GEM, and must | 461 | device. This space is not typically managed by GEM, and it must |
464 | be initialized separately into its own DRM MM object. | 462 | be initialized separately into its own DRM MM object. |
465 | </para> | 463 | </para> |
466 | <para> | 464 | <para> |
467 | Initialization will be driver specific, and will depend on | 465 | Initialization is driver-specific. In the case of Intel |
468 | the architecture of the device. In the case of Intel | ||
469 | integrated graphics chips like 965GM, GEM initialization can | 466 | integrated graphics chips like 965GM, GEM initialization can |
470 | be done by calling the internal GEM init function, | 467 | be done by calling the internal GEM init function, |
471 | i915_gem_do_init(). Since the 965GM is a UMA device | 468 | i915_gem_do_init(). Since the 965GM is a UMA device |
472 | (i.e. it doesn't have dedicated VRAM), GEM will manage | 469 | (i.e. it doesn't have dedicated VRAM), GEM manages |
473 | making regular RAM available for GPU operations. Memory set | 470 | making regular RAM available for GPU operations. Memory set |
474 | aside by the BIOS (called "stolen" memory by the i915 | 471 | aside by the BIOS (called "stolen" memory by the i915 |
475 | driver) will be managed by the DRM memrange allocator; the | 472 | driver) is managed by the DRM memrange allocator; the |
476 | rest of the aperture will be managed by GEM. | 473 | rest of the aperture is managed by GEM. |
477 | <programlisting> | 474 | <programlisting> |
478 | /* Basic memrange allocator for stolen space (aka vram) */ | 475 | /* Basic memrange allocator for stolen space (aka vram) */ |
479 | drm_memrange_init(&dev_priv->vram, 0, prealloc_size); | 476 | drm_memrange_init(&dev_priv->vram, 0, prealloc_size); |
@@ -483,7 +480,7 @@ | |||
483 | <!--!Edrivers/char/drm/drm_memrange.c--> | 480 | <!--!Edrivers/char/drm/drm_memrange.c--> |
484 | </para> | 481 | </para> |
485 | <para> | 482 | <para> |
486 | Once the memory manager has been set up, we can allocate the | 483 | Once the memory manager has been set up, we may allocate the |
487 | command buffer. In the i915 case, this is also done with a | 484 | command buffer. In the i915 case, this is also done with a |
488 | GEM function, i915_gem_init_ringbuffer(). | 485 | GEM function, i915_gem_init_ringbuffer(). |
489 | </para> | 486 | </para> |
@@ -493,16 +490,25 @@ | |||
493 | <sect2> | 490 | <sect2> |
494 | <title>Output configuration</title> | 491 | <title>Output configuration</title> |
495 | <para> | 492 | <para> |
496 | The final initialization task is output configuration. This involves | 493 | The final initialization task is output configuration. This involves: |
497 | finding and initializing the CRTCs, encoders and connectors | 494 | <itemizedlist> |
498 | for your device, creating an initial configuration and | 495 | <listitem> |
499 | registering a framebuffer console driver. | 496 | Finding and initializing the CRTCs, encoders, and connectors |
497 | for the device. | ||
498 | </listitem> | ||
499 | <listitem> | ||
500 | Creating an initial configuration. | ||
501 | </listitem> | ||
502 | <listitem> | ||
503 | Registering a framebuffer console driver. | ||
504 | </listitem> | ||
505 | </itemizedlist> | ||
500 | </para> | 506 | </para> |
501 | <sect3> | 507 | <sect3> |
502 | <title>Output discovery and initialization</title> | 508 | <title>Output discovery and initialization</title> |
503 | <para> | 509 | <para> |
504 | Several core functions exist to create CRTCs, encoders and | 510 | Several core functions exist to create CRTCs, encoders, and |
505 | connectors, namely drm_crtc_init(), drm_connector_init() and | 511 | connectors, namely: drm_crtc_init(), drm_connector_init(), and |
506 | drm_encoder_init(), along with several "helper" functions to | 512 | drm_encoder_init(), along with several "helper" functions to |
507 | perform common tasks. | 513 | perform common tasks. |
508 | </para> | 514 | </para> |
@@ -555,10 +561,10 @@ void intel_crt_init(struct drm_device *dev) | |||
555 | </programlisting> | 561 | </programlisting> |
556 | <para> | 562 | <para> |
557 | In the example above (again, taken from the i915 driver), a | 563 | In the example above (again, taken from the i915 driver), a |
558 | CRT connector and encoder combination is created. A device | 564 | CRT connector and encoder combination is created. A device-specific |
559 | specific i2c bus is also created, for fetching EDID data and | 565 | i2c bus is also created for fetching EDID data and |
560 | performing monitor detection. Once the process is complete, | 566 | performing monitor detection. Once the process is complete, |
561 | the new connector is registered with sysfs, to make its | 567 | the new connector is registered with sysfs to make its |
562 | properties available to applications. | 568 | properties available to applications. |
563 | </para> | 569 | </para> |
564 | <sect4> | 570 | <sect4> |
@@ -567,12 +573,12 @@ void intel_crt_init(struct drm_device *dev) | |||
567 | Since many PC-class graphics devices have similar display output | 573 | Since many PC-class graphics devices have similar display output |
568 | designs, the DRM provides a set of helper functions to make | 574 | designs, the DRM provides a set of helper functions to make |
569 | output management easier. The core helper routines handle | 575 | output management easier. The core helper routines handle |
570 | encoder re-routing and disabling of unused functions following | 576 | encoder re-routing and the disabling of unused functions following |
571 | mode set. Using the helpers is optional, but recommended for | 577 | mode setting. Using the helpers is optional, but recommended for |
572 | devices with PC-style architectures (i.e. a set of display planes | 578 | devices with PC-style architectures (i.e. a set of display planes |
573 | for feeding pixels to encoders which are in turn routed to | 579 | for feeding pixels to encoders which are in turn routed to |
574 | connectors). Devices with more complex requirements needing | 580 | connectors). Devices with more complex requirements needing |
575 | finer grained management can opt to use the core callbacks | 581 | finer grained management may opt to use the core callbacks |
576 | directly. | 582 | directly. |
577 | </para> | 583 | </para> |
578 | <para> | 584 | <para> |
@@ -580,17 +586,25 @@ void intel_crt_init(struct drm_device *dev) | |||
580 | </para> | 586 | </para> |
581 | </sect4> | 587 | </sect4> |
582 | <para> | 588 | <para> |
583 | For each encoder, CRTC and connector, several functions must | 589 | Each encoder object needs to provide: |
584 | be provided, depending on the object type. Encoder objects | 590 | <itemizedlist> |
585 | need to provide a DPMS (basically on/off) function, mode fixup | 591 | <listitem> |
586 | (for converting requested modes into native hardware timings), | 592 | A DPMS (basically on/off) function. |
587 | and prepare, set and commit functions for use by the core DRM | 593 | </listitem> |
588 | helper functions. Connector helpers need to provide mode fetch and | 594 | <listitem> |
589 | validity functions as well as an encoder matching function for | 595 | A mode-fixup function (for converting requested modes into |
590 | returning an ideal encoder for a given connector. The core | 596 | native hardware timings). |
591 | connector functions include a DPMS callback, (deprecated) | 597 | </listitem> |
592 | save/restore routines, detection, mode probing, property handling, | 598 | <listitem> |
593 | and cleanup functions. | 599 | Functions (prepare, set, and commit) for use by the core DRM |
600 | helper functions. | ||
601 | </listitem> | ||
602 | </itemizedlist> | ||
603 | Connector helpers need to provide functions (mode-fetch, validity, | ||
604 | and encoder-matching) for returning an ideal encoder for a given | ||
605 | connector. The core connector functions include a DPMS callback, | ||
606 | save/restore routines (deprecated), detection, mode probing, | ||
607 | property handling, and cleanup functions. | ||
594 | </para> | 608 | </para> |
595 | <!--!Edrivers/char/drm/drm_crtc.h--> | 609 | <!--!Edrivers/char/drm/drm_crtc.h--> |
596 | <!--!Edrivers/char/drm/drm_crtc.c--> | 610 | <!--!Edrivers/char/drm/drm_crtc.c--> |
@@ -605,23 +619,34 @@ void intel_crt_init(struct drm_device *dev) | |||
605 | <title>VBlank event handling</title> | 619 | <title>VBlank event handling</title> |
606 | <para> | 620 | <para> |
607 | The DRM core exposes two vertical blank related ioctls: | 621 | The DRM core exposes two vertical blank related ioctls: |
608 | DRM_IOCTL_WAIT_VBLANK and DRM_IOCTL_MODESET_CTL. | 622 | <variablelist> |
623 | <varlistentry> | ||
624 | <term>DRM_IOCTL_WAIT_VBLANK</term> | ||
625 | <listitem> | ||
626 | <para> | ||
627 | This takes a struct drm_wait_vblank structure as its argument, | ||
628 | and it is used to block or request a signal when a specified | ||
629 | vblank event occurs. | ||
630 | </para> | ||
631 | </listitem> | ||
632 | </varlistentry> | ||
633 | <varlistentry> | ||
634 | <term>DRM_IOCTL_MODESET_CTL</term> | ||
635 | <listitem> | ||
636 | <para> | ||
637 | This should be called by application level drivers before and | ||
638 | after mode setting, since on many devices the vertical blank | ||
639 | counter is reset at that time. Internally, the DRM snapshots | ||
640 | the last vblank count when the ioctl is called with the | ||
641 | _DRM_PRE_MODESET command, so that the counter won't go backwards | ||
642 | (which is dealt with when _DRM_POST_MODESET is used). | ||
643 | </para> | ||
644 | </listitem> | ||
645 | </varlistentry> | ||
646 | </variablelist> | ||
609 | <!--!Edrivers/char/drm/drm_irq.c--> | 647 | <!--!Edrivers/char/drm/drm_irq.c--> |
610 | </para> | 648 | </para> |
611 | <para> | 649 | <para> |
612 | DRM_IOCTL_WAIT_VBLANK takes a struct drm_wait_vblank structure | ||
613 | as its argument, and is used to block or request a signal when a | ||
614 | specified vblank event occurs. | ||
615 | </para> | ||
616 | <para> | ||
617 | DRM_IOCTL_MODESET_CTL should be called by application level | ||
618 | drivers before and after mode setting, since on many devices the | ||
619 | vertical blank counter will be reset at that time. Internally, | ||
620 | the DRM snapshots the last vblank count when the ioctl is called | ||
621 | with the _DRM_PRE_MODESET command so that the counter won't go | ||
622 | backwards (which is dealt with when _DRM_POST_MODESET is used). | ||
623 | </para> | ||
624 | <para> | ||
625 | To support the functions above, the DRM core provides several | 650 | To support the functions above, the DRM core provides several |
626 | helper functions for tracking vertical blank counters, and | 651 | helper functions for tracking vertical blank counters, and |
627 | requires drivers to provide several callbacks: | 652 | requires drivers to provide several callbacks: |
@@ -632,24 +657,24 @@ void intel_crt_init(struct drm_device *dev) | |||
632 | register. The enable and disable vblank callbacks should enable | 657 | register. The enable and disable vblank callbacks should enable |
633 | and disable vertical blank interrupts, respectively. In the | 658 | and disable vertical blank interrupts, respectively. In the |
634 | absence of DRM clients waiting on vblank events, the core DRM | 659 | absence of DRM clients waiting on vblank events, the core DRM |
635 | code will use the disable_vblank() function to disable | 660 | code uses the disable_vblank() function to disable |
636 | interrupts, which saves power. They'll be re-enabled again when | 661 | interrupts, which saves power. They are re-enabled again when |
637 | a client calls the vblank wait ioctl above. | 662 | a client calls the vblank wait ioctl above. |
638 | </para> | 663 | </para> |
639 | <para> | 664 | <para> |
640 | Devices that don't provide a count register can simply use an | 665 | A device that doesn't provide a count register may simply use an |
641 | internal atomic counter incremented on every vertical blank | 666 | internal atomic counter incremented on every vertical blank |
642 | interrupt, and can make their enable and disable vblank | 667 | interrupt (and then treat the enable_vblank() and disable_vblank() |
643 | functions into no-ops. | 668 | callbacks as no-ops). |
644 | </para> | 669 | </para> |
645 | </sect1> | 670 | </sect1> |
646 | 671 | ||
647 | <sect1> | 672 | <sect1> |
648 | <title>Memory management</title> | 673 | <title>Memory management</title> |
649 | <para> | 674 | <para> |
650 | The memory manager lies at the heart of many DRM operations, and | 675 | The memory manager lies at the heart of many DRM operations; it |
651 | is also required to support advanced client features like OpenGL | 676 | is required to support advanced client features like OpenGL |
652 | pbuffers. The DRM currently contains two memory managers, TTM | 677 | pbuffers. The DRM currently contains two memory managers: TTM |
653 | and GEM. | 678 | and GEM. |
654 | </para> | 679 | </para> |
655 | 680 | ||
@@ -679,41 +704,46 @@ void intel_crt_init(struct drm_device *dev) | |||
679 | <para> | 704 | <para> |
680 | GEM-enabled drivers must provide gem_init_object() and | 705 | GEM-enabled drivers must provide gem_init_object() and |
681 | gem_free_object() callbacks to support the core memory | 706 | gem_free_object() callbacks to support the core memory |
682 | allocation routines. They should also provide several driver | 707 | allocation routines. They should also provide several driver-specific |
683 | specific ioctls to support command execution, pinning, buffer | 708 | ioctls to support command execution, pinning, buffer |
684 | read & write, mapping, and domain ownership transfers. | 709 | read & write, mapping, and domain ownership transfers. |
685 | </para> | 710 | </para> |
686 | <para> | 711 | <para> |
687 | On a fundamental level, GEM involves several operations: memory | 712 | On a fundamental level, GEM involves several operations: |
688 | allocation and freeing, command execution, and aperture management | 713 | <itemizedlist> |
689 | at command execution time. Buffer object allocation is relatively | 714 | <listitem>Memory allocation and freeing</listitem> |
715 | <listitem>Command execution</listitem> | ||
716 | <listitem>Aperture management at command execution time</listitem> | ||
717 | </itemizedlist> | ||
718 | Buffer object allocation is relatively | ||
690 | straightforward and largely provided by Linux's shmem layer, which | 719 | straightforward and largely provided by Linux's shmem layer, which |
691 | provides memory to back each object. When mapped into the GTT | 720 | provides memory to back each object. When mapped into the GTT |
692 | or used in a command buffer, the backing pages for an object are | 721 | or used in a command buffer, the backing pages for an object are |
693 | flushed to memory and marked write combined so as to be coherent | 722 | flushed to memory and marked write combined so as to be coherent |
694 | with the GPU. Likewise, when the GPU finishes rendering to an object, | 723 | with the GPU. Likewise, if the CPU accesses an object after the GPU |
695 | if the CPU accesses it, it must be made coherent with the CPU's view | 724 | has finished rendering to the object, then the object must be made |
725 | coherent with the CPU's view | ||
696 | of memory, usually involving GPU cache flushing of various kinds. | 726 | of memory, usually involving GPU cache flushing of various kinds. |
697 | This core CPU<->GPU coherency management is provided by the GEM | 727 | This core CPU<->GPU coherency management is provided by a |
698 | set domain function, which evaluates an object's current domain and | 728 | device-specific ioctl, which evaluates an object's current domain and |
699 | performs any necessary flushing or synchronization to put the object | 729 | performs any necessary flushing or synchronization to put the object |
700 | into the desired coherency domain (note that the object may be busy, | 730 | into the desired coherency domain (note that the object may be busy, |
701 | i.e. an active render target; in that case the set domain function | 731 | i.e. an active render target; in that case, setting the domain |
702 | will block the client and wait for rendering to complete before | 732 | blocks the client and waits for rendering to complete before |
703 | performing any necessary flushing operations). | 733 | performing any necessary flushing operations). |
704 | </para> | 734 | </para> |
705 | <para> | 735 | <para> |
706 | Perhaps the most important GEM function is providing a command | 736 | Perhaps the most important GEM function is providing a command |
707 | execution interface to clients. Client programs construct command | 737 | execution interface to clients. Client programs construct command |
708 | buffers containing references to previously allocated memory objects | 738 | buffers containing references to previously allocated memory objects, |
709 | and submit them to GEM. At that point, GEM will take care to bind | 739 | and then submit them to GEM. At that point, GEM takes care to bind |
710 | all the objects into the GTT, execute the buffer, and provide | 740 | all the objects into the GTT, execute the buffer, and provide |
711 | necessary synchronization between clients accessing the same buffers. | 741 | necessary synchronization between clients accessing the same buffers. |
712 | This often involves evicting some objects from the GTT and re-binding | 742 | This often involves evicting some objects from the GTT and re-binding |
713 | others (a fairly expensive operation), and providing relocation | 743 | others (a fairly expensive operation), and providing relocation |
714 | support which hides fixed GTT offsets from clients. Clients must | 744 | support which hides fixed GTT offsets from clients. Clients must |
715 | take care not to submit command buffers that reference more objects | 745 | take care not to submit command buffers that reference more objects |
716 | than can fit in the GTT or GEM will reject them and no rendering | 746 | than can fit in the GTT; otherwise, GEM will reject them and no rendering |
717 | will occur. Similarly, if several objects in the buffer require | 747 | will occur. Similarly, if several objects in the buffer require |
718 | fence registers to be allocated for correct rendering (e.g. 2D blits | 748 | fence registers to be allocated for correct rendering (e.g. 2D blits |
719 | on pre-965 chips), care must be taken not to require more fence | 749 | on pre-965 chips), care must be taken not to require more fence |
@@ -729,7 +759,7 @@ void intel_crt_init(struct drm_device *dev) | |||
729 | <title>Output management</title> | 759 | <title>Output management</title> |
730 | <para> | 760 | <para> |
731 | At the core of the DRM output management code is a set of | 761 | At the core of the DRM output management code is a set of |
732 | structures representing CRTCs, encoders and connectors. | 762 | structures representing CRTCs, encoders, and connectors. |
733 | </para> | 763 | </para> |
734 | <para> | 764 | <para> |
735 | A CRTC is an abstraction representing a part of the chip that | 765 | A CRTC is an abstraction representing a part of the chip that |
@@ -765,21 +795,19 @@ void intel_crt_init(struct drm_device *dev) | |||
765 | <sect1> | 795 | <sect1> |
766 | <title>Framebuffer management</title> | 796 | <title>Framebuffer management</title> |
767 | <para> | 797 | <para> |
768 | In order to set a mode on a given CRTC, encoder and connector | 798 | Clients need to provide a framebuffer object which provides a source |
769 | configuration, clients need to provide a framebuffer object which | 799 | of pixels for a CRTC to deliver to the encoder(s) and ultimately the |
770 | will provide a source of pixels for the CRTC to deliver to the encoder(s) | 800 | connector(s). A framebuffer is fundamentally a driver-specific memory |
771 | and ultimately the connector(s) in the configuration. A framebuffer | 801 | object, made into an opaque handle by the DRM's addfb() function. |
772 | is fundamentally a driver specific memory object, made into an opaque | 802 | Once a framebuffer has been created this way, it may be passed to the |
773 | handle by the DRM addfb function. Once an fb has been created this | 803 | KMS mode setting routines for use in a completed configuration. |
774 | way it can be passed to the KMS mode setting routines for use in | ||
775 | a configuration. | ||
776 | </para> | 804 | </para> |
777 | </sect1> | 805 | </sect1> |
778 | 806 | ||
779 | <sect1> | 807 | <sect1> |
780 | <title>Command submission & fencing</title> | 808 | <title>Command submission & fencing</title> |
781 | <para> | 809 | <para> |
782 | This should cover a few device specific command submission | 810 | This should cover a few device-specific command submission |
783 | implementations. | 811 | implementations. |
784 | </para> | 812 | </para> |
785 | </sect1> | 813 | </sect1> |
@@ -789,7 +817,7 @@ void intel_crt_init(struct drm_device *dev) | |||
789 | <para> | 817 | <para> |
790 | The DRM core provides some suspend/resume code, but drivers | 818 | The DRM core provides some suspend/resume code, but drivers |
791 | wanting full suspend/resume support should provide save() and | 819 | wanting full suspend/resume support should provide save() and |
792 | restore() functions. These will be called at suspend, | 820 | restore() functions. These are called at suspend, |
793 | hibernate, or resume time, and should perform any state save or | 821 | hibernate, or resume time, and should perform any state save or |
794 | restore required by your device across suspend or hibernate | 822 | restore required by your device across suspend or hibernate |
795 | states. | 823 | states. |
@@ -812,8 +840,8 @@ void intel_crt_init(struct drm_device *dev) | |||
812 | <para> | 840 | <para> |
813 | The DRM core exports several interfaces to applications, | 841 | The DRM core exports several interfaces to applications, |
814 | generally intended to be used through corresponding libdrm | 842 | generally intended to be used through corresponding libdrm |
815 | wrapper functions. In addition, drivers export device specific | 843 | wrapper functions. In addition, drivers export device-specific |
816 | interfaces for use by userspace drivers & device aware | 844 | interfaces for use by userspace drivers & device-aware |
817 | applications through ioctls and sysfs files. | 845 | applications through ioctls and sysfs files. |
818 | </para> | 846 | </para> |
819 | <para> | 847 | <para> |
@@ -822,8 +850,8 @@ void intel_crt_init(struct drm_device *dev) | |||
822 | management, memory management, and output management. | 850 | management, memory management, and output management. |
823 | </para> | 851 | </para> |
824 | <para> | 852 | <para> |
825 | Cover generic ioctls and sysfs layout here. Only need high | 853 | Cover generic ioctls and sysfs layout here. We only need high-level |
826 | level info, since man pages will cover the rest. | 854 | info, since man pages should cover the rest. |
827 | </para> | 855 | </para> |
828 | </chapter> | 856 | </chapter> |
829 | 857 | ||
diff --git a/Documentation/cgroups/freezer-subsystem.txt b/Documentation/cgroups/freezer-subsystem.txt index c21d77742a07..7e62de1e59ff 100644 --- a/Documentation/cgroups/freezer-subsystem.txt +++ b/Documentation/cgroups/freezer-subsystem.txt | |||
@@ -33,9 +33,9 @@ demonstrate this problem using nested bash shells: | |||
33 | 33 | ||
34 | From a second, unrelated bash shell: | 34 | From a second, unrelated bash shell: |
35 | $ kill -SIGSTOP 16690 | 35 | $ kill -SIGSTOP 16690 |
36 | $ kill -SIGCONT 16990 | 36 | $ kill -SIGCONT 16690 |
37 | 37 | ||
38 | <at this point 16990 exits and causes 16644 to exit too> | 38 | <at this point 16690 exits and causes 16644 to exit too> |
39 | 39 | ||
40 | This happens because bash can observe both signals and choose how it | 40 | This happens because bash can observe both signals and choose how it |
41 | responds to them. | 41 | responds to them. |
diff --git a/arch/sparc/include/asm/unistd.h b/arch/sparc/include/asm/unistd.h index 6260d5deeabc..c7cb0af0eb59 100644 --- a/arch/sparc/include/asm/unistd.h +++ b/arch/sparc/include/asm/unistd.h | |||
@@ -406,8 +406,10 @@ | |||
406 | #define __NR_syncfs 335 | 406 | #define __NR_syncfs 335 |
407 | #define __NR_sendmmsg 336 | 407 | #define __NR_sendmmsg 336 |
408 | #define __NR_setns 337 | 408 | #define __NR_setns 337 |
409 | #define __NR_process_vm_readv 338 | ||
410 | #define __NR_process_vm_writev 339 | ||
409 | 411 | ||
410 | #define NR_syscalls 338 | 412 | #define NR_syscalls 340 |
411 | 413 | ||
412 | #ifdef __32bit_syscall_numbers__ | 414 | #ifdef __32bit_syscall_numbers__ |
413 | /* Sparc 32-bit only has the "setresuid32", "getresuid32" variants, | 415 | /* Sparc 32-bit only has the "setresuid32", "getresuid32" variants, |
diff --git a/arch/sparc/kernel/systbls_32.S b/arch/sparc/kernel/systbls_32.S index 09d8ec454450..63402f9e9f51 100644 --- a/arch/sparc/kernel/systbls_32.S +++ b/arch/sparc/kernel/systbls_32.S | |||
@@ -84,4 +84,4 @@ sys_call_table: | |||
84 | /*320*/ .long sys_dup3, sys_pipe2, sys_inotify_init1, sys_accept4, sys_preadv | 84 | /*320*/ .long sys_dup3, sys_pipe2, sys_inotify_init1, sys_accept4, sys_preadv |
85 | /*325*/ .long sys_pwritev, sys_rt_tgsigqueueinfo, sys_perf_event_open, sys_recvmmsg, sys_fanotify_init | 85 | /*325*/ .long sys_pwritev, sys_rt_tgsigqueueinfo, sys_perf_event_open, sys_recvmmsg, sys_fanotify_init |
86 | /*330*/ .long sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, sys_open_by_handle_at, sys_clock_adjtime | 86 | /*330*/ .long sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, sys_open_by_handle_at, sys_clock_adjtime |
87 | /*335*/ .long sys_syncfs, sys_sendmmsg, sys_setns | 87 | /*335*/ .long sys_syncfs, sys_sendmmsg, sys_setns, sys_process_vm_readv, sys_process_vm_writev |
diff --git a/arch/sparc/kernel/systbls_64.S b/arch/sparc/kernel/systbls_64.S index edbec45d4688..db86b1a0e9a9 100644 --- a/arch/sparc/kernel/systbls_64.S +++ b/arch/sparc/kernel/systbls_64.S | |||
@@ -85,7 +85,7 @@ sys_call_table32: | |||
85 | /*320*/ .word sys_dup3, sys_pipe2, sys_inotify_init1, sys_accept4, compat_sys_preadv | 85 | /*320*/ .word sys_dup3, sys_pipe2, sys_inotify_init1, sys_accept4, compat_sys_preadv |
86 | .word compat_sys_pwritev, compat_sys_rt_tgsigqueueinfo, sys_perf_event_open, compat_sys_recvmmsg, sys_fanotify_init | 86 | .word compat_sys_pwritev, compat_sys_rt_tgsigqueueinfo, sys_perf_event_open, compat_sys_recvmmsg, sys_fanotify_init |
87 | /*330*/ .word sys32_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, compat_sys_open_by_handle_at, compat_sys_clock_adjtime | 87 | /*330*/ .word sys32_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, compat_sys_open_by_handle_at, compat_sys_clock_adjtime |
88 | .word sys_syncfs, compat_sys_sendmmsg, sys_setns | 88 | .word sys_syncfs, compat_sys_sendmmsg, sys_setns, compat_sys_process_vm_readv, compat_sys_process_vm_writev |
89 | 89 | ||
90 | #endif /* CONFIG_COMPAT */ | 90 | #endif /* CONFIG_COMPAT */ |
91 | 91 | ||
@@ -162,4 +162,4 @@ sys_call_table: | |||
162 | /*320*/ .word sys_dup3, sys_pipe2, sys_inotify_init1, sys_accept4, sys_preadv | 162 | /*320*/ .word sys_dup3, sys_pipe2, sys_inotify_init1, sys_accept4, sys_preadv |
163 | .word sys_pwritev, sys_rt_tgsigqueueinfo, sys_perf_event_open, sys_recvmmsg, sys_fanotify_init | 163 | .word sys_pwritev, sys_rt_tgsigqueueinfo, sys_perf_event_open, sys_recvmmsg, sys_fanotify_init |
164 | /*330*/ .word sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, sys_open_by_handle_at, sys_clock_adjtime | 164 | /*330*/ .word sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, sys_open_by_handle_at, sys_clock_adjtime |
165 | .word sys_syncfs, sys_sendmmsg, sys_setns | 165 | .word sys_syncfs, sys_sendmmsg, sys_setns, sys_process_vm_readv, sys_process_vm_writev |
diff --git a/crypto/ablkcipher.c b/crypto/ablkcipher.c index a816f24f2d52..a0f768c1d9aa 100644 --- a/crypto/ablkcipher.c +++ b/crypto/ablkcipher.c | |||
@@ -383,6 +383,7 @@ static int crypto_init_ablkcipher_ops(struct crypto_tfm *tfm, u32 type, | |||
383 | return 0; | 383 | return 0; |
384 | } | 384 | } |
385 | 385 | ||
386 | #ifdef CONFIG_NET | ||
386 | static int crypto_ablkcipher_report(struct sk_buff *skb, struct crypto_alg *alg) | 387 | static int crypto_ablkcipher_report(struct sk_buff *skb, struct crypto_alg *alg) |
387 | { | 388 | { |
388 | struct crypto_report_blkcipher rblkcipher; | 389 | struct crypto_report_blkcipher rblkcipher; |
@@ -404,6 +405,12 @@ static int crypto_ablkcipher_report(struct sk_buff *skb, struct crypto_alg *alg) | |||
404 | nla_put_failure: | 405 | nla_put_failure: |
405 | return -EMSGSIZE; | 406 | return -EMSGSIZE; |
406 | } | 407 | } |
408 | #else | ||
409 | static int crypto_ablkcipher_report(struct sk_buff *skb, struct crypto_alg *alg) | ||
410 | { | ||
411 | return -ENOSYS; | ||
412 | } | ||
413 | #endif | ||
407 | 414 | ||
408 | static void crypto_ablkcipher_show(struct seq_file *m, struct crypto_alg *alg) | 415 | static void crypto_ablkcipher_show(struct seq_file *m, struct crypto_alg *alg) |
409 | __attribute__ ((unused)); | 416 | __attribute__ ((unused)); |
@@ -457,6 +464,7 @@ static int crypto_init_givcipher_ops(struct crypto_tfm *tfm, u32 type, | |||
457 | return 0; | 464 | return 0; |
458 | } | 465 | } |
459 | 466 | ||
467 | #ifdef CONFIG_NET | ||
460 | static int crypto_givcipher_report(struct sk_buff *skb, struct crypto_alg *alg) | 468 | static int crypto_givcipher_report(struct sk_buff *skb, struct crypto_alg *alg) |
461 | { | 469 | { |
462 | struct crypto_report_blkcipher rblkcipher; | 470 | struct crypto_report_blkcipher rblkcipher; |
@@ -478,6 +486,12 @@ static int crypto_givcipher_report(struct sk_buff *skb, struct crypto_alg *alg) | |||
478 | nla_put_failure: | 486 | nla_put_failure: |
479 | return -EMSGSIZE; | 487 | return -EMSGSIZE; |
480 | } | 488 | } |
489 | #else | ||
490 | static int crypto_givcipher_report(struct sk_buff *skb, struct crypto_alg *alg) | ||
491 | { | ||
492 | return -ENOSYS; | ||
493 | } | ||
494 | #endif | ||
481 | 495 | ||
482 | static void crypto_givcipher_show(struct seq_file *m, struct crypto_alg *alg) | 496 | static void crypto_givcipher_show(struct seq_file *m, struct crypto_alg *alg) |
483 | __attribute__ ((unused)); | 497 | __attribute__ ((unused)); |
diff --git a/crypto/aead.c b/crypto/aead.c index 701556ffaaef..04add3dca6fe 100644 --- a/crypto/aead.c +++ b/crypto/aead.c | |||
@@ -111,6 +111,7 @@ static int crypto_init_aead_ops(struct crypto_tfm *tfm, u32 type, u32 mask) | |||
111 | return 0; | 111 | return 0; |
112 | } | 112 | } |
113 | 113 | ||
114 | #ifdef CONFIG_NET | ||
114 | static int crypto_aead_report(struct sk_buff *skb, struct crypto_alg *alg) | 115 | static int crypto_aead_report(struct sk_buff *skb, struct crypto_alg *alg) |
115 | { | 116 | { |
116 | struct crypto_report_aead raead; | 117 | struct crypto_report_aead raead; |
@@ -132,6 +133,12 @@ static int crypto_aead_report(struct sk_buff *skb, struct crypto_alg *alg) | |||
132 | nla_put_failure: | 133 | nla_put_failure: |
133 | return -EMSGSIZE; | 134 | return -EMSGSIZE; |
134 | } | 135 | } |
136 | #else | ||
137 | static int crypto_aead_report(struct sk_buff *skb, struct crypto_alg *alg) | ||
138 | { | ||
139 | return -ENOSYS; | ||
140 | } | ||
141 | #endif | ||
135 | 142 | ||
136 | static void crypto_aead_show(struct seq_file *m, struct crypto_alg *alg) | 143 | static void crypto_aead_show(struct seq_file *m, struct crypto_alg *alg) |
137 | __attribute__ ((unused)); | 144 | __attribute__ ((unused)); |
@@ -190,6 +197,7 @@ static int crypto_init_nivaead_ops(struct crypto_tfm *tfm, u32 type, u32 mask) | |||
190 | return 0; | 197 | return 0; |
191 | } | 198 | } |
192 | 199 | ||
200 | #ifdef CONFIG_NET | ||
193 | static int crypto_nivaead_report(struct sk_buff *skb, struct crypto_alg *alg) | 201 | static int crypto_nivaead_report(struct sk_buff *skb, struct crypto_alg *alg) |
194 | { | 202 | { |
195 | struct crypto_report_aead raead; | 203 | struct crypto_report_aead raead; |
@@ -210,6 +218,12 @@ static int crypto_nivaead_report(struct sk_buff *skb, struct crypto_alg *alg) | |||
210 | nla_put_failure: | 218 | nla_put_failure: |
211 | return -EMSGSIZE; | 219 | return -EMSGSIZE; |
212 | } | 220 | } |
221 | #else | ||
222 | static int crypto_nivaead_report(struct sk_buff *skb, struct crypto_alg *alg) | ||
223 | { | ||
224 | return -ENOSYS; | ||
225 | } | ||
226 | #endif | ||
213 | 227 | ||
214 | 228 | ||
215 | static void crypto_nivaead_show(struct seq_file *m, struct crypto_alg *alg) | 229 | static void crypto_nivaead_show(struct seq_file *m, struct crypto_alg *alg) |
diff --git a/crypto/ahash.c b/crypto/ahash.c index a3e6ef99394a..ac93c99cfae8 100644 --- a/crypto/ahash.c +++ b/crypto/ahash.c | |||
@@ -399,6 +399,7 @@ static unsigned int crypto_ahash_extsize(struct crypto_alg *alg) | |||
399 | return sizeof(struct crypto_shash *); | 399 | return sizeof(struct crypto_shash *); |
400 | } | 400 | } |
401 | 401 | ||
402 | #ifdef CONFIG_NET | ||
402 | static int crypto_ahash_report(struct sk_buff *skb, struct crypto_alg *alg) | 403 | static int crypto_ahash_report(struct sk_buff *skb, struct crypto_alg *alg) |
403 | { | 404 | { |
404 | struct crypto_report_hash rhash; | 405 | struct crypto_report_hash rhash; |
@@ -416,6 +417,12 @@ static int crypto_ahash_report(struct sk_buff *skb, struct crypto_alg *alg) | |||
416 | nla_put_failure: | 417 | nla_put_failure: |
417 | return -EMSGSIZE; | 418 | return -EMSGSIZE; |
418 | } | 419 | } |
420 | #else | ||
421 | static int crypto_ahash_report(struct sk_buff *skb, struct crypto_alg *alg) | ||
422 | { | ||
423 | return -ENOSYS; | ||
424 | } | ||
425 | #endif | ||
419 | 426 | ||
420 | static void crypto_ahash_show(struct seq_file *m, struct crypto_alg *alg) | 427 | static void crypto_ahash_show(struct seq_file *m, struct crypto_alg *alg) |
421 | __attribute__ ((unused)); | 428 | __attribute__ ((unused)); |
diff --git a/crypto/blkcipher.c b/crypto/blkcipher.c index 2572d2600136..1e61d1a888b2 100644 --- a/crypto/blkcipher.c +++ b/crypto/blkcipher.c | |||
@@ -494,6 +494,7 @@ static int crypto_init_blkcipher_ops(struct crypto_tfm *tfm, u32 type, u32 mask) | |||
494 | return crypto_init_blkcipher_ops_async(tfm); | 494 | return crypto_init_blkcipher_ops_async(tfm); |
495 | } | 495 | } |
496 | 496 | ||
497 | #ifdef CONFIG_NET | ||
497 | static int crypto_blkcipher_report(struct sk_buff *skb, struct crypto_alg *alg) | 498 | static int crypto_blkcipher_report(struct sk_buff *skb, struct crypto_alg *alg) |
498 | { | 499 | { |
499 | struct crypto_report_blkcipher rblkcipher; | 500 | struct crypto_report_blkcipher rblkcipher; |
@@ -515,6 +516,12 @@ static int crypto_blkcipher_report(struct sk_buff *skb, struct crypto_alg *alg) | |||
515 | nla_put_failure: | 516 | nla_put_failure: |
516 | return -EMSGSIZE; | 517 | return -EMSGSIZE; |
517 | } | 518 | } |
519 | #else | ||
520 | static int crypto_blkcipher_report(struct sk_buff *skb, struct crypto_alg *alg) | ||
521 | { | ||
522 | return -ENOSYS; | ||
523 | } | ||
524 | #endif | ||
518 | 525 | ||
519 | static void crypto_blkcipher_show(struct seq_file *m, struct crypto_alg *alg) | 526 | static void crypto_blkcipher_show(struct seq_file *m, struct crypto_alg *alg) |
520 | __attribute__ ((unused)); | 527 | __attribute__ ((unused)); |
diff --git a/crypto/crypto_user.c b/crypto/crypto_user.c index 2abca780312d..0605a2bbba75 100644 --- a/crypto/crypto_user.c +++ b/crypto/crypto_user.c | |||
@@ -44,9 +44,6 @@ static struct crypto_alg *crypto_alg_match(struct crypto_user_alg *p, int exact) | |||
44 | 44 | ||
45 | down_read(&crypto_alg_sem); | 45 | down_read(&crypto_alg_sem); |
46 | 46 | ||
47 | if (list_empty(&crypto_alg_list)) | ||
48 | return NULL; | ||
49 | |||
50 | list_for_each_entry(q, &crypto_alg_list, cra_list) { | 47 | list_for_each_entry(q, &crypto_alg_list, cra_list) { |
51 | int match = 0; | 48 | int match = 0; |
52 | 49 | ||
diff --git a/crypto/pcompress.c b/crypto/pcompress.c index fefda78a6a2a..2e458e5482d0 100644 --- a/crypto/pcompress.c +++ b/crypto/pcompress.c | |||
@@ -48,6 +48,7 @@ static int crypto_pcomp_init_tfm(struct crypto_tfm *tfm) | |||
48 | return 0; | 48 | return 0; |
49 | } | 49 | } |
50 | 50 | ||
51 | #ifdef CONFIG_NET | ||
51 | static int crypto_pcomp_report(struct sk_buff *skb, struct crypto_alg *alg) | 52 | static int crypto_pcomp_report(struct sk_buff *skb, struct crypto_alg *alg) |
52 | { | 53 | { |
53 | struct crypto_report_comp rpcomp; | 54 | struct crypto_report_comp rpcomp; |
@@ -62,6 +63,12 @@ static int crypto_pcomp_report(struct sk_buff *skb, struct crypto_alg *alg) | |||
62 | nla_put_failure: | 63 | nla_put_failure: |
63 | return -EMSGSIZE; | 64 | return -EMSGSIZE; |
64 | } | 65 | } |
66 | #else | ||
67 | static int crypto_pcomp_report(struct sk_buff *skb, struct crypto_alg *alg) | ||
68 | { | ||
69 | return -ENOSYS; | ||
70 | } | ||
71 | #endif | ||
65 | 72 | ||
66 | static void crypto_pcomp_show(struct seq_file *m, struct crypto_alg *alg) | 73 | static void crypto_pcomp_show(struct seq_file *m, struct crypto_alg *alg) |
67 | __attribute__ ((unused)); | 74 | __attribute__ ((unused)); |
diff --git a/crypto/rng.c b/crypto/rng.c index feb7de00f437..64f864fa8043 100644 --- a/crypto/rng.c +++ b/crypto/rng.c | |||
@@ -60,6 +60,7 @@ static int crypto_init_rng_ops(struct crypto_tfm *tfm, u32 type, u32 mask) | |||
60 | return 0; | 60 | return 0; |
61 | } | 61 | } |
62 | 62 | ||
63 | #ifdef CONFIG_NET | ||
63 | static int crypto_rng_report(struct sk_buff *skb, struct crypto_alg *alg) | 64 | static int crypto_rng_report(struct sk_buff *skb, struct crypto_alg *alg) |
64 | { | 65 | { |
65 | struct crypto_report_rng rrng; | 66 | struct crypto_report_rng rrng; |
@@ -76,6 +77,12 @@ static int crypto_rng_report(struct sk_buff *skb, struct crypto_alg *alg) | |||
76 | nla_put_failure: | 77 | nla_put_failure: |
77 | return -EMSGSIZE; | 78 | return -EMSGSIZE; |
78 | } | 79 | } |
80 | #else | ||
81 | static int crypto_rng_report(struct sk_buff *skb, struct crypto_alg *alg) | ||
82 | { | ||
83 | return -ENOSYS; | ||
84 | } | ||
85 | #endif | ||
79 | 86 | ||
80 | static void crypto_rng_show(struct seq_file *m, struct crypto_alg *alg) | 87 | static void crypto_rng_show(struct seq_file *m, struct crypto_alg *alg) |
81 | __attribute__ ((unused)); | 88 | __attribute__ ((unused)); |
diff --git a/crypto/shash.c b/crypto/shash.c index ea8a9c6e21e3..9100912716ae 100644 --- a/crypto/shash.c +++ b/crypto/shash.c | |||
@@ -524,6 +524,7 @@ static unsigned int crypto_shash_extsize(struct crypto_alg *alg) | |||
524 | return alg->cra_ctxsize; | 524 | return alg->cra_ctxsize; |
525 | } | 525 | } |
526 | 526 | ||
527 | #ifdef CONFIG_NET | ||
527 | static int crypto_shash_report(struct sk_buff *skb, struct crypto_alg *alg) | 528 | static int crypto_shash_report(struct sk_buff *skb, struct crypto_alg *alg) |
528 | { | 529 | { |
529 | struct crypto_report_hash rhash; | 530 | struct crypto_report_hash rhash; |
@@ -541,6 +542,12 @@ static int crypto_shash_report(struct sk_buff *skb, struct crypto_alg *alg) | |||
541 | nla_put_failure: | 542 | nla_put_failure: |
542 | return -EMSGSIZE; | 543 | return -EMSGSIZE; |
543 | } | 544 | } |
545 | #else | ||
546 | static int crypto_shash_report(struct sk_buff *skb, struct crypto_alg *alg) | ||
547 | { | ||
548 | return -ENOSYS; | ||
549 | } | ||
550 | #endif | ||
544 | 551 | ||
545 | static void crypto_shash_show(struct seq_file *m, struct crypto_alg *alg) | 552 | static void crypto_shash_show(struct seq_file *m, struct crypto_alg *alg) |
546 | __attribute__ ((unused)); | 553 | __attribute__ ((unused)); |
diff --git a/drivers/base/power/opp.c b/drivers/base/power/opp.c index 434a6c011675..95706fa24c73 100644 --- a/drivers/base/power/opp.c +++ b/drivers/base/power/opp.c | |||
@@ -669,7 +669,7 @@ struct srcu_notifier_head *opp_get_notifier(struct device *dev) | |||
669 | struct device_opp *dev_opp = find_device_opp(dev); | 669 | struct device_opp *dev_opp = find_device_opp(dev); |
670 | 670 | ||
671 | if (IS_ERR(dev_opp)) | 671 | if (IS_ERR(dev_opp)) |
672 | return ERR_PTR(PTR_ERR(dev_opp)); /* matching type */ | 672 | return ERR_CAST(dev_opp); /* matching type */ |
673 | 673 | ||
674 | return &dev_opp->head; | 674 | return &dev_opp->head; |
675 | } | 675 | } |
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index cc531bb59c26..e9c2cfe45daa 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c | |||
@@ -789,8 +789,8 @@ static struct vm_operations_struct i915_gem_vm_ops = { | |||
789 | }; | 789 | }; |
790 | 790 | ||
791 | static struct drm_driver driver = { | 791 | static struct drm_driver driver = { |
792 | /* don't use mtrr's here, the Xserver or user space app should | 792 | /* Don't use MTRRs here; the Xserver or userspace app should |
793 | * deal with them for intel hardware. | 793 | * deal with them for Intel hardware. |
794 | */ | 794 | */ |
795 | .driver_features = | 795 | .driver_features = |
796 | DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | /* DRIVER_USE_MTRR |*/ | 796 | DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | /* DRIVER_USE_MTRR |*/ |
diff --git a/drivers/hwspinlock/u8500_hsem.c b/drivers/hwspinlock/u8500_hsem.c index 143461a95ae4..86980fe04117 100644 --- a/drivers/hwspinlock/u8500_hsem.c +++ b/drivers/hwspinlock/u8500_hsem.c | |||
@@ -21,6 +21,7 @@ | |||
21 | * General Public License for more details. | 21 | * General Public License for more details. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <linux/module.h> | ||
24 | #include <linux/delay.h> | 25 | #include <linux/delay.h> |
25 | #include <linux/io.h> | 26 | #include <linux/io.h> |
26 | #include <linux/pm_runtime.h> | 27 | #include <linux/pm_runtime.h> |
@@ -108,10 +109,8 @@ static int __devinit u8500_hsem_probe(struct platform_device *pdev) | |||
108 | return -ENODEV; | 109 | return -ENODEV; |
109 | 110 | ||
110 | io_base = ioremap(res->start, resource_size(res)); | 111 | io_base = ioremap(res->start, resource_size(res)); |
111 | if (!io_base) { | 112 | if (!io_base) |
112 | ret = -ENOMEM; | 113 | return -ENOMEM; |
113 | goto free_state; | ||
114 | } | ||
115 | 114 | ||
116 | /* make sure protocol 1 is selected */ | 115 | /* make sure protocol 1 is selected */ |
117 | val = readl(io_base + HSEM_CTRL_REG); | 116 | val = readl(io_base + HSEM_CTRL_REG); |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 472aedfb07cf..297e26092178 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -3110,7 +3110,7 @@ static void handle_stripe(struct stripe_head *sh) | |||
3110 | struct r5dev *pdev, *qdev; | 3110 | struct r5dev *pdev, *qdev; |
3111 | 3111 | ||
3112 | clear_bit(STRIPE_HANDLE, &sh->state); | 3112 | clear_bit(STRIPE_HANDLE, &sh->state); |
3113 | if (test_and_set_bit(STRIPE_ACTIVE, &sh->state)) { | 3113 | if (test_and_set_bit_lock(STRIPE_ACTIVE, &sh->state)) { |
3114 | /* already being handled, ensure it gets handled | 3114 | /* already being handled, ensure it gets handled |
3115 | * again when current action finishes */ | 3115 | * again when current action finishes */ |
3116 | set_bit(STRIPE_HANDLE, &sh->state); | 3116 | set_bit(STRIPE_HANDLE, &sh->state); |
@@ -3159,10 +3159,14 @@ static void handle_stripe(struct stripe_head *sh) | |||
3159 | /* check if the array has lost more than max_degraded devices and, | 3159 | /* check if the array has lost more than max_degraded devices and, |
3160 | * if so, some requests might need to be failed. | 3160 | * if so, some requests might need to be failed. |
3161 | */ | 3161 | */ |
3162 | if (s.failed > conf->max_degraded && s.to_read+s.to_write+s.written) | 3162 | if (s.failed > conf->max_degraded) { |
3163 | handle_failed_stripe(conf, sh, &s, disks, &s.return_bi); | 3163 | sh->check_state = 0; |
3164 | if (s.failed > conf->max_degraded && s.syncing) | 3164 | sh->reconstruct_state = 0; |
3165 | handle_failed_sync(conf, sh, &s); | 3165 | if (s.to_read+s.to_write+s.written) |
3166 | handle_failed_stripe(conf, sh, &s, disks, &s.return_bi); | ||
3167 | if (s.syncing) | ||
3168 | handle_failed_sync(conf, sh, &s); | ||
3169 | } | ||
3166 | 3170 | ||
3167 | /* | 3171 | /* |
3168 | * might be able to return some write requests if the parity blocks | 3172 | * might be able to return some write requests if the parity blocks |
@@ -3371,7 +3375,7 @@ finish: | |||
3371 | 3375 | ||
3372 | return_io(s.return_bi); | 3376 | return_io(s.return_bi); |
3373 | 3377 | ||
3374 | clear_bit(STRIPE_ACTIVE, &sh->state); | 3378 | clear_bit_unlock(STRIPE_ACTIVE, &sh->state); |
3375 | } | 3379 | } |
3376 | 3380 | ||
3377 | static void raid5_activate_delayed(struct r5conf *conf) | 3381 | static void raid5_activate_delayed(struct r5conf *conf) |
diff --git a/drivers/media/video/s5k6aa.c b/drivers/media/video/s5k6aa.c index 2446736b7871..0df7f2a41814 100644 --- a/drivers/media/video/s5k6aa.c +++ b/drivers/media/video/s5k6aa.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/gpio.h> | 19 | #include <linux/gpio.h> |
20 | #include <linux/i2c.h> | 20 | #include <linux/i2c.h> |
21 | #include <linux/media.h> | 21 | #include <linux/media.h> |
22 | #include <linux/module.h> | ||
22 | #include <linux/regulator/consumer.h> | 23 | #include <linux/regulator/consumer.h> |
23 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
24 | 25 | ||
diff --git a/drivers/mfd/ab5500-core.c b/drivers/mfd/ab5500-core.c index 4175544b491b..ec10629a0b0b 100644 --- a/drivers/mfd/ab5500-core.c +++ b/drivers/mfd/ab5500-core.c | |||
@@ -13,6 +13,7 @@ | |||
13 | * TODO: Event handling with irq_chip. Waiting for PRCMU fw support. | 13 | * TODO: Event handling with irq_chip. Waiting for PRCMU fw support. |
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include <linux/module.h> | ||
16 | #include <linux/mutex.h> | 17 | #include <linux/mutex.h> |
17 | #include <linux/err.h> | 18 | #include <linux/err.h> |
18 | #include <linux/platform_device.h> | 19 | #include <linux/platform_device.h> |
diff --git a/drivers/mfd/ab5500-debugfs.c b/drivers/mfd/ab5500-debugfs.c index 6be1fe6b5f9a..43c0ebb81956 100644 --- a/drivers/mfd/ab5500-debugfs.c +++ b/drivers/mfd/ab5500-debugfs.c | |||
@@ -4,6 +4,7 @@ | |||
4 | * Debugfs support for the AB5500 MFD driver | 4 | * Debugfs support for the AB5500 MFD driver |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #include <linux/export.h> | ||
7 | #include <linux/debugfs.h> | 8 | #include <linux/debugfs.h> |
8 | #include <linux/seq_file.h> | 9 | #include <linux/seq_file.h> |
9 | #include <linux/mfd/ab5500/ab5500.h> | 10 | #include <linux/mfd/ab5500/ab5500.h> |
diff --git a/drivers/mtd/maps/bcm963xx-flash.c b/drivers/mtd/maps/bcm963xx-flash.c index 608967fe74c6..736ca10ca9f1 100644 --- a/drivers/mtd/maps/bcm963xx-flash.c +++ b/drivers/mtd/maps/bcm963xx-flash.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/init.h> | 21 | #include <linux/init.h> |
22 | #include <linux/kernel.h> | 22 | #include <linux/kernel.h> |
23 | #include <linux/slab.h> | 23 | #include <linux/slab.h> |
24 | #include <linux/module.h> | ||
24 | #include <linux/mtd/map.h> | 25 | #include <linux/mtd/map.h> |
25 | #include <linux/mtd/mtd.h> | 26 | #include <linux/mtd/mtd.h> |
26 | #include <linux/mtd/partitions.h> | 27 | #include <linux/mtd/partitions.h> |
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig index f4e3d82379d7..7f43cf86d776 100644 --- a/drivers/platform/x86/Kconfig +++ b/drivers/platform/x86/Kconfig | |||
@@ -83,8 +83,10 @@ config DELL_LAPTOP | |||
83 | depends on EXPERIMENTAL | 83 | depends on EXPERIMENTAL |
84 | depends on BACKLIGHT_CLASS_DEVICE | 84 | depends on BACKLIGHT_CLASS_DEVICE |
85 | depends on RFKILL || RFKILL = n | 85 | depends on RFKILL || RFKILL = n |
86 | depends on POWER_SUPPLY | ||
87 | depends on SERIO_I8042 | 86 | depends on SERIO_I8042 |
87 | select POWER_SUPPLY | ||
88 | select LEDS_CLASS | ||
89 | select NEW_LEDS | ||
88 | default n | 90 | default n |
89 | ---help--- | 91 | ---help--- |
90 | This driver adds support for rfkill and backlight control to Dell | 92 | This driver adds support for rfkill and backlight control to Dell |
diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index 4cb0d0a3e57b..fc7bbba585ce 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c | |||
@@ -66,14 +66,16 @@ | |||
66 | static int debug; | 66 | static int debug; |
67 | module_param(debug, int, 0600); | 67 | module_param(debug, int, 0600); |
68 | 68 | ||
69 | #define T1 (HZ/10) | 69 | /* Defaults: these are from the specification */ |
70 | #define T2 (HZ/3) | 70 | |
71 | #define N2 3 | 71 | #define T1 10 /* 100mS */ |
72 | #define T2 34 /* 333mS */ | ||
73 | #define N2 3 /* Retry 3 times */ | ||
72 | 74 | ||
73 | /* Use long timers for testing at low speed with debug on */ | 75 | /* Use long timers for testing at low speed with debug on */ |
74 | #ifdef DEBUG_TIMING | 76 | #ifdef DEBUG_TIMING |
75 | #define T1 HZ | 77 | #define T1 100 |
76 | #define T2 (2 * HZ) | 78 | #define T2 200 |
77 | #endif | 79 | #endif |
78 | 80 | ||
79 | /* | 81 | /* |
diff --git a/fs/proc/base.c b/fs/proc/base.c index 2db1bd3173b2..851ba3dcdc29 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -1652,46 +1652,12 @@ out: | |||
1652 | return error; | 1652 | return error; |
1653 | } | 1653 | } |
1654 | 1654 | ||
1655 | static int proc_pid_fd_link_getattr(struct vfsmount *mnt, struct dentry *dentry, | ||
1656 | struct kstat *stat) | ||
1657 | { | ||
1658 | struct inode *inode = dentry->d_inode; | ||
1659 | struct task_struct *task = get_proc_task(inode); | ||
1660 | int rc; | ||
1661 | |||
1662 | if (task == NULL) | ||
1663 | return -ESRCH; | ||
1664 | |||
1665 | rc = -EACCES; | ||
1666 | if (lock_trace(task)) | ||
1667 | goto out_task; | ||
1668 | |||
1669 | generic_fillattr(inode, stat); | ||
1670 | unlock_trace(task); | ||
1671 | rc = 0; | ||
1672 | out_task: | ||
1673 | put_task_struct(task); | ||
1674 | return rc; | ||
1675 | } | ||
1676 | |||
1677 | static const struct inode_operations proc_pid_link_inode_operations = { | 1655 | static const struct inode_operations proc_pid_link_inode_operations = { |
1678 | .readlink = proc_pid_readlink, | 1656 | .readlink = proc_pid_readlink, |
1679 | .follow_link = proc_pid_follow_link, | 1657 | .follow_link = proc_pid_follow_link, |
1680 | .setattr = proc_setattr, | 1658 | .setattr = proc_setattr, |
1681 | }; | 1659 | }; |
1682 | 1660 | ||
1683 | static const struct inode_operations proc_fdinfo_link_inode_operations = { | ||
1684 | .setattr = proc_setattr, | ||
1685 | .getattr = proc_pid_fd_link_getattr, | ||
1686 | }; | ||
1687 | |||
1688 | static const struct inode_operations proc_fd_link_inode_operations = { | ||
1689 | .readlink = proc_pid_readlink, | ||
1690 | .follow_link = proc_pid_follow_link, | ||
1691 | .setattr = proc_setattr, | ||
1692 | .getattr = proc_pid_fd_link_getattr, | ||
1693 | }; | ||
1694 | |||
1695 | 1661 | ||
1696 | /* building an inode */ | 1662 | /* building an inode */ |
1697 | 1663 | ||
@@ -1923,61 +1889,49 @@ out: | |||
1923 | 1889 | ||
1924 | static int proc_fd_info(struct inode *inode, struct path *path, char *info) | 1890 | static int proc_fd_info(struct inode *inode, struct path *path, char *info) |
1925 | { | 1891 | { |
1926 | struct task_struct *task; | 1892 | struct task_struct *task = get_proc_task(inode); |
1927 | struct files_struct *files; | 1893 | struct files_struct *files = NULL; |
1928 | struct file *file; | 1894 | struct file *file; |
1929 | int fd = proc_fd(inode); | 1895 | int fd = proc_fd(inode); |
1930 | int rc; | ||
1931 | |||
1932 | task = get_proc_task(inode); | ||
1933 | if (!task) | ||
1934 | return -ENOENT; | ||
1935 | |||
1936 | rc = -EACCES; | ||
1937 | if (lock_trace(task)) | ||
1938 | goto out_task; | ||
1939 | |||
1940 | rc = -ENOENT; | ||
1941 | files = get_files_struct(task); | ||
1942 | if (files == NULL) | ||
1943 | goto out_unlock; | ||
1944 | 1896 | ||
1945 | /* | 1897 | if (task) { |
1946 | * We are not taking a ref to the file structure, so we must | 1898 | files = get_files_struct(task); |
1947 | * hold ->file_lock. | 1899 | put_task_struct(task); |
1948 | */ | 1900 | } |
1949 | spin_lock(&files->file_lock); | 1901 | if (files) { |
1950 | file = fcheck_files(files, fd); | 1902 | /* |
1951 | if (file) { | 1903 | * We are not taking a ref to the file structure, so we must |
1952 | unsigned int f_flags; | 1904 | * hold ->file_lock. |
1953 | struct fdtable *fdt; | 1905 | */ |
1954 | 1906 | spin_lock(&files->file_lock); | |
1955 | fdt = files_fdtable(files); | 1907 | file = fcheck_files(files, fd); |
1956 | f_flags = file->f_flags & ~O_CLOEXEC; | 1908 | if (file) { |
1957 | if (FD_ISSET(fd, fdt->close_on_exec)) | 1909 | unsigned int f_flags; |
1958 | f_flags |= O_CLOEXEC; | 1910 | struct fdtable *fdt; |
1959 | 1911 | ||
1960 | if (path) { | 1912 | fdt = files_fdtable(files); |
1961 | *path = file->f_path; | 1913 | f_flags = file->f_flags & ~O_CLOEXEC; |
1962 | path_get(&file->f_path); | 1914 | if (FD_ISSET(fd, fdt->close_on_exec)) |
1915 | f_flags |= O_CLOEXEC; | ||
1916 | |||
1917 | if (path) { | ||
1918 | *path = file->f_path; | ||
1919 | path_get(&file->f_path); | ||
1920 | } | ||
1921 | if (info) | ||
1922 | snprintf(info, PROC_FDINFO_MAX, | ||
1923 | "pos:\t%lli\n" | ||
1924 | "flags:\t0%o\n", | ||
1925 | (long long) file->f_pos, | ||
1926 | f_flags); | ||
1927 | spin_unlock(&files->file_lock); | ||
1928 | put_files_struct(files); | ||
1929 | return 0; | ||
1963 | } | 1930 | } |
1964 | if (info) | 1931 | spin_unlock(&files->file_lock); |
1965 | snprintf(info, PROC_FDINFO_MAX, | 1932 | put_files_struct(files); |
1966 | "pos:\t%lli\n" | 1933 | } |
1967 | "flags:\t0%o\n", | 1934 | return -ENOENT; |
1968 | (long long) file->f_pos, | ||
1969 | f_flags); | ||
1970 | rc = 0; | ||
1971 | } else | ||
1972 | rc = -ENOENT; | ||
1973 | spin_unlock(&files->file_lock); | ||
1974 | put_files_struct(files); | ||
1975 | |||
1976 | out_unlock: | ||
1977 | unlock_trace(task); | ||
1978 | out_task: | ||
1979 | put_task_struct(task); | ||
1980 | return rc; | ||
1981 | } | 1935 | } |
1982 | 1936 | ||
1983 | static int proc_fd_link(struct inode *inode, struct path *path) | 1937 | static int proc_fd_link(struct inode *inode, struct path *path) |
@@ -2072,7 +2026,7 @@ static struct dentry *proc_fd_instantiate(struct inode *dir, | |||
2072 | spin_unlock(&files->file_lock); | 2026 | spin_unlock(&files->file_lock); |
2073 | put_files_struct(files); | 2027 | put_files_struct(files); |
2074 | 2028 | ||
2075 | inode->i_op = &proc_fd_link_inode_operations; | 2029 | inode->i_op = &proc_pid_link_inode_operations; |
2076 | inode->i_size = 64; | 2030 | inode->i_size = 64; |
2077 | ei->op.proc_get_link = proc_fd_link; | 2031 | ei->op.proc_get_link = proc_fd_link; |
2078 | d_set_d_op(dentry, &tid_fd_dentry_operations); | 2032 | d_set_d_op(dentry, &tid_fd_dentry_operations); |
@@ -2104,12 +2058,7 @@ static struct dentry *proc_lookupfd_common(struct inode *dir, | |||
2104 | if (fd == ~0U) | 2058 | if (fd == ~0U) |
2105 | goto out; | 2059 | goto out; |
2106 | 2060 | ||
2107 | result = ERR_PTR(-EACCES); | ||
2108 | if (lock_trace(task)) | ||
2109 | goto out; | ||
2110 | |||
2111 | result = instantiate(dir, dentry, task, &fd); | 2061 | result = instantiate(dir, dentry, task, &fd); |
2112 | unlock_trace(task); | ||
2113 | out: | 2062 | out: |
2114 | put_task_struct(task); | 2063 | put_task_struct(task); |
2115 | out_no_task: | 2064 | out_no_task: |
@@ -2129,28 +2078,23 @@ static int proc_readfd_common(struct file * filp, void * dirent, | |||
2129 | retval = -ENOENT; | 2078 | retval = -ENOENT; |
2130 | if (!p) | 2079 | if (!p) |
2131 | goto out_no_task; | 2080 | goto out_no_task; |
2132 | |||
2133 | retval = -EACCES; | ||
2134 | if (lock_trace(p)) | ||
2135 | goto out; | ||
2136 | |||
2137 | retval = 0; | 2081 | retval = 0; |
2138 | 2082 | ||
2139 | fd = filp->f_pos; | 2083 | fd = filp->f_pos; |
2140 | switch (fd) { | 2084 | switch (fd) { |
2141 | case 0: | 2085 | case 0: |
2142 | if (filldir(dirent, ".", 1, 0, inode->i_ino, DT_DIR) < 0) | 2086 | if (filldir(dirent, ".", 1, 0, inode->i_ino, DT_DIR) < 0) |
2143 | goto out_unlock; | 2087 | goto out; |
2144 | filp->f_pos++; | 2088 | filp->f_pos++; |
2145 | case 1: | 2089 | case 1: |
2146 | ino = parent_ino(dentry); | 2090 | ino = parent_ino(dentry); |
2147 | if (filldir(dirent, "..", 2, 1, ino, DT_DIR) < 0) | 2091 | if (filldir(dirent, "..", 2, 1, ino, DT_DIR) < 0) |
2148 | goto out_unlock; | 2092 | goto out; |
2149 | filp->f_pos++; | 2093 | filp->f_pos++; |
2150 | default: | 2094 | default: |
2151 | files = get_files_struct(p); | 2095 | files = get_files_struct(p); |
2152 | if (!files) | 2096 | if (!files) |
2153 | goto out_unlock; | 2097 | goto out; |
2154 | rcu_read_lock(); | 2098 | rcu_read_lock(); |
2155 | for (fd = filp->f_pos-2; | 2099 | for (fd = filp->f_pos-2; |
2156 | fd < files_fdtable(files)->max_fds; | 2100 | fd < files_fdtable(files)->max_fds; |
@@ -2174,9 +2118,6 @@ static int proc_readfd_common(struct file * filp, void * dirent, | |||
2174 | rcu_read_unlock(); | 2118 | rcu_read_unlock(); |
2175 | put_files_struct(files); | 2119 | put_files_struct(files); |
2176 | } | 2120 | } |
2177 | |||
2178 | out_unlock: | ||
2179 | unlock_trace(p); | ||
2180 | out: | 2121 | out: |
2181 | put_task_struct(p); | 2122 | put_task_struct(p); |
2182 | out_no_task: | 2123 | out_no_task: |
@@ -2254,7 +2195,6 @@ static struct dentry *proc_fdinfo_instantiate(struct inode *dir, | |||
2254 | ei->fd = fd; | 2195 | ei->fd = fd; |
2255 | inode->i_mode = S_IFREG | S_IRUSR; | 2196 | inode->i_mode = S_IFREG | S_IRUSR; |
2256 | inode->i_fop = &proc_fdinfo_file_operations; | 2197 | inode->i_fop = &proc_fdinfo_file_operations; |
2257 | inode->i_op = &proc_fdinfo_link_inode_operations; | ||
2258 | d_set_d_op(dentry, &tid_fd_dentry_operations); | 2198 | d_set_d_op(dentry, &tid_fd_dentry_operations); |
2259 | d_add(dentry, inode); | 2199 | d_add(dentry, inode); |
2260 | /* Close the race of the process dying before we return the dentry */ | 2200 | /* Close the race of the process dying before we return the dentry */ |
diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c index 33b13310ee0c..574d4ee9b625 100644 --- a/fs/xfs/xfs_aops.c +++ b/fs/xfs/xfs_aops.c | |||
@@ -189,7 +189,7 @@ xfs_end_io( | |||
189 | int error = 0; | 189 | int error = 0; |
190 | 190 | ||
191 | if (XFS_FORCED_SHUTDOWN(ip->i_mount)) { | 191 | if (XFS_FORCED_SHUTDOWN(ip->i_mount)) { |
192 | error = -EIO; | 192 | ioend->io_error = -EIO; |
193 | goto done; | 193 | goto done; |
194 | } | 194 | } |
195 | if (ioend->io_error) | 195 | if (ioend->io_error) |
diff --git a/fs/xfs/xfs_buf_item.c b/fs/xfs/xfs_buf_item.c index 1a3513881bce..eac97ef81e2a 100644 --- a/fs/xfs/xfs_buf_item.c +++ b/fs/xfs/xfs_buf_item.c | |||
@@ -656,7 +656,7 @@ xfs_buf_item_committing( | |||
656 | /* | 656 | /* |
657 | * This is the ops vector shared by all buf log items. | 657 | * This is the ops vector shared by all buf log items. |
658 | */ | 658 | */ |
659 | static struct xfs_item_ops xfs_buf_item_ops = { | 659 | static const struct xfs_item_ops xfs_buf_item_ops = { |
660 | .iop_size = xfs_buf_item_size, | 660 | .iop_size = xfs_buf_item_size, |
661 | .iop_format = xfs_buf_item_format, | 661 | .iop_format = xfs_buf_item_format, |
662 | .iop_pin = xfs_buf_item_pin, | 662 | .iop_pin = xfs_buf_item_pin, |
diff --git a/fs/xfs/xfs_dquot_item.c b/fs/xfs/xfs_dquot_item.c index bb3f71d236d2..0dee0b71029d 100644 --- a/fs/xfs/xfs_dquot_item.c +++ b/fs/xfs/xfs_dquot_item.c | |||
@@ -295,7 +295,7 @@ xfs_qm_dquot_logitem_committing( | |||
295 | /* | 295 | /* |
296 | * This is the ops vector for dquots | 296 | * This is the ops vector for dquots |
297 | */ | 297 | */ |
298 | static struct xfs_item_ops xfs_dquot_item_ops = { | 298 | static const struct xfs_item_ops xfs_dquot_item_ops = { |
299 | .iop_size = xfs_qm_dquot_logitem_size, | 299 | .iop_size = xfs_qm_dquot_logitem_size, |
300 | .iop_format = xfs_qm_dquot_logitem_format, | 300 | .iop_format = xfs_qm_dquot_logitem_format, |
301 | .iop_pin = xfs_qm_dquot_logitem_pin, | 301 | .iop_pin = xfs_qm_dquot_logitem_pin, |
@@ -483,7 +483,7 @@ xfs_qm_qoff_logitem_committing( | |||
483 | { | 483 | { |
484 | } | 484 | } |
485 | 485 | ||
486 | static struct xfs_item_ops xfs_qm_qoffend_logitem_ops = { | 486 | static const struct xfs_item_ops xfs_qm_qoffend_logitem_ops = { |
487 | .iop_size = xfs_qm_qoff_logitem_size, | 487 | .iop_size = xfs_qm_qoff_logitem_size, |
488 | .iop_format = xfs_qm_qoff_logitem_format, | 488 | .iop_format = xfs_qm_qoff_logitem_format, |
489 | .iop_pin = xfs_qm_qoff_logitem_pin, | 489 | .iop_pin = xfs_qm_qoff_logitem_pin, |
@@ -498,7 +498,7 @@ static struct xfs_item_ops xfs_qm_qoffend_logitem_ops = { | |||
498 | /* | 498 | /* |
499 | * This is the ops vector shared by all quotaoff-start log items. | 499 | * This is the ops vector shared by all quotaoff-start log items. |
500 | */ | 500 | */ |
501 | static struct xfs_item_ops xfs_qm_qoff_logitem_ops = { | 501 | static const struct xfs_item_ops xfs_qm_qoff_logitem_ops = { |
502 | .iop_size = xfs_qm_qoff_logitem_size, | 502 | .iop_size = xfs_qm_qoff_logitem_size, |
503 | .iop_format = xfs_qm_qoff_logitem_format, | 503 | .iop_format = xfs_qm_qoff_logitem_format, |
504 | .iop_pin = xfs_qm_qoff_logitem_pin, | 504 | .iop_pin = xfs_qm_qoff_logitem_pin, |
diff --git a/fs/xfs/xfs_extfree_item.c b/fs/xfs/xfs_extfree_item.c index d22e62623437..35c2aff38b20 100644 --- a/fs/xfs/xfs_extfree_item.c +++ b/fs/xfs/xfs_extfree_item.c | |||
@@ -217,7 +217,7 @@ xfs_efi_item_committing( | |||
217 | /* | 217 | /* |
218 | * This is the ops vector shared by all efi log items. | 218 | * This is the ops vector shared by all efi log items. |
219 | */ | 219 | */ |
220 | static struct xfs_item_ops xfs_efi_item_ops = { | 220 | static const struct xfs_item_ops xfs_efi_item_ops = { |
221 | .iop_size = xfs_efi_item_size, | 221 | .iop_size = xfs_efi_item_size, |
222 | .iop_format = xfs_efi_item_format, | 222 | .iop_format = xfs_efi_item_format, |
223 | .iop_pin = xfs_efi_item_pin, | 223 | .iop_pin = xfs_efi_item_pin, |
@@ -477,7 +477,7 @@ xfs_efd_item_committing( | |||
477 | /* | 477 | /* |
478 | * This is the ops vector shared by all efd log items. | 478 | * This is the ops vector shared by all efd log items. |
479 | */ | 479 | */ |
480 | static struct xfs_item_ops xfs_efd_item_ops = { | 480 | static const struct xfs_item_ops xfs_efd_item_ops = { |
481 | .iop_size = xfs_efd_item_size, | 481 | .iop_size = xfs_efd_item_size, |
482 | .iop_format = xfs_efd_item_format, | 482 | .iop_format = xfs_efd_item_format, |
483 | .iop_pin = xfs_efd_item_pin, | 483 | .iop_pin = xfs_efd_item_pin, |
diff --git a/fs/xfs/xfs_inode_item.c b/fs/xfs/xfs_inode_item.c index b7cf21ba240f..abaafdbb3e65 100644 --- a/fs/xfs/xfs_inode_item.c +++ b/fs/xfs/xfs_inode_item.c | |||
@@ -795,7 +795,7 @@ xfs_inode_item_committing( | |||
795 | /* | 795 | /* |
796 | * This is the ops vector shared by all buf log items. | 796 | * This is the ops vector shared by all buf log items. |
797 | */ | 797 | */ |
798 | static struct xfs_item_ops xfs_inode_item_ops = { | 798 | static const struct xfs_item_ops xfs_inode_item_ops = { |
799 | .iop_size = xfs_inode_item_size, | 799 | .iop_size = xfs_inode_item_size, |
800 | .iop_format = xfs_inode_item_format, | 800 | .iop_format = xfs_inode_item_format, |
801 | .iop_pin = xfs_inode_item_pin, | 801 | .iop_pin = xfs_inode_item_pin, |
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c index 2758a6277c52..a14cd89fe465 100644 --- a/fs/xfs/xfs_log.c +++ b/fs/xfs/xfs_log.c | |||
@@ -626,7 +626,7 @@ xfs_log_item_init( | |||
626 | struct xfs_mount *mp, | 626 | struct xfs_mount *mp, |
627 | struct xfs_log_item *item, | 627 | struct xfs_log_item *item, |
628 | int type, | 628 | int type, |
629 | struct xfs_item_ops *ops) | 629 | const struct xfs_item_ops *ops) |
630 | { | 630 | { |
631 | item->li_mountp = mp; | 631 | item->li_mountp = mp; |
632 | item->li_ailp = mp->m_ail; | 632 | item->li_ailp = mp->m_ail; |
diff --git a/fs/xfs/xfs_log.h b/fs/xfs/xfs_log.h index 78c9039994af..3f7bf451c034 100644 --- a/fs/xfs/xfs_log.h +++ b/fs/xfs/xfs_log.h | |||
@@ -137,7 +137,7 @@ struct xfs_trans; | |||
137 | void xfs_log_item_init(struct xfs_mount *mp, | 137 | void xfs_log_item_init(struct xfs_mount *mp, |
138 | struct xfs_log_item *item, | 138 | struct xfs_log_item *item, |
139 | int type, | 139 | int type, |
140 | struct xfs_item_ops *ops); | 140 | const struct xfs_item_ops *ops); |
141 | 141 | ||
142 | xfs_lsn_t xfs_log_done(struct xfs_mount *mp, | 142 | xfs_lsn_t xfs_log_done(struct xfs_mount *mp, |
143 | struct xlog_ticket *ticket, | 143 | struct xlog_ticket *ticket, |
diff --git a/fs/xfs/xfs_trans.h b/fs/xfs/xfs_trans.h index 603f3eb52041..3ae713c0abd9 100644 --- a/fs/xfs/xfs_trans.h +++ b/fs/xfs/xfs_trans.h | |||
@@ -326,7 +326,7 @@ typedef struct xfs_log_item { | |||
326 | struct xfs_log_item *); | 326 | struct xfs_log_item *); |
327 | /* buffer item iodone */ | 327 | /* buffer item iodone */ |
328 | /* callback func */ | 328 | /* callback func */ |
329 | struct xfs_item_ops *li_ops; /* function list */ | 329 | const struct xfs_item_ops *li_ops; /* function list */ |
330 | 330 | ||
331 | /* delayed logging */ | 331 | /* delayed logging */ |
332 | struct list_head li_cil; /* CIL pointers */ | 332 | struct list_head li_cil; /* CIL pointers */ |
@@ -341,7 +341,7 @@ typedef struct xfs_log_item { | |||
341 | { XFS_LI_IN_AIL, "IN_AIL" }, \ | 341 | { XFS_LI_IN_AIL, "IN_AIL" }, \ |
342 | { XFS_LI_ABORTED, "ABORTED" } | 342 | { XFS_LI_ABORTED, "ABORTED" } |
343 | 343 | ||
344 | typedef struct xfs_item_ops { | 344 | struct xfs_item_ops { |
345 | uint (*iop_size)(xfs_log_item_t *); | 345 | uint (*iop_size)(xfs_log_item_t *); |
346 | void (*iop_format)(xfs_log_item_t *, struct xfs_log_iovec *); | 346 | void (*iop_format)(xfs_log_item_t *, struct xfs_log_iovec *); |
347 | void (*iop_pin)(xfs_log_item_t *); | 347 | void (*iop_pin)(xfs_log_item_t *); |
@@ -352,7 +352,7 @@ typedef struct xfs_item_ops { | |||
352 | void (*iop_push)(xfs_log_item_t *); | 352 | void (*iop_push)(xfs_log_item_t *); |
353 | bool (*iop_pushbuf)(xfs_log_item_t *); | 353 | bool (*iop_pushbuf)(xfs_log_item_t *); |
354 | void (*iop_committing)(xfs_log_item_t *, xfs_lsn_t); | 354 | void (*iop_committing)(xfs_log_item_t *, xfs_lsn_t); |
355 | } xfs_item_ops_t; | 355 | }; |
356 | 356 | ||
357 | #define IOP_SIZE(ip) (*(ip)->li_ops->iop_size)(ip) | 357 | #define IOP_SIZE(ip) (*(ip)->li_ops->iop_size)(ip) |
358 | #define IOP_FORMAT(ip,vp) (*(ip)->li_ops->iop_format)(ip, vp) | 358 | #define IOP_FORMAT(ip,vp) (*(ip)->li_ops->iop_format)(ip, vp) |
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c index 4ecf2a549060..ce9268a2f56b 100644 --- a/fs/xfs/xfs_vnodeops.c +++ b/fs/xfs/xfs_vnodeops.c | |||
@@ -112,7 +112,7 @@ xfs_readlink( | |||
112 | char *link) | 112 | char *link) |
113 | { | 113 | { |
114 | xfs_mount_t *mp = ip->i_mount; | 114 | xfs_mount_t *mp = ip->i_mount; |
115 | int pathlen; | 115 | xfs_fsize_t pathlen; |
116 | int error = 0; | 116 | int error = 0; |
117 | 117 | ||
118 | trace_xfs_readlink(ip); | 118 | trace_xfs_readlink(ip); |
@@ -122,13 +122,19 @@ xfs_readlink( | |||
122 | 122 | ||
123 | xfs_ilock(ip, XFS_ILOCK_SHARED); | 123 | xfs_ilock(ip, XFS_ILOCK_SHARED); |
124 | 124 | ||
125 | ASSERT(S_ISLNK(ip->i_d.di_mode)); | ||
126 | ASSERT(ip->i_d.di_size <= MAXPATHLEN); | ||
127 | |||
128 | pathlen = ip->i_d.di_size; | 125 | pathlen = ip->i_d.di_size; |
129 | if (!pathlen) | 126 | if (!pathlen) |
130 | goto out; | 127 | goto out; |
131 | 128 | ||
129 | if (pathlen < 0 || pathlen > MAXPATHLEN) { | ||
130 | xfs_alert(mp, "%s: inode (%llu) bad symlink length (%lld)", | ||
131 | __func__, (unsigned long long) ip->i_ino, | ||
132 | (long long) pathlen); | ||
133 | ASSERT(0); | ||
134 | return XFS_ERROR(EFSCORRUPTED); | ||
135 | } | ||
136 | |||
137 | |||
132 | if (ip->i_df.if_flags & XFS_IFINLINE) { | 138 | if (ip->i_df.if_flags & XFS_IFINLINE) { |
133 | memcpy(link, ip->i_df.if_u1.if_data, pathlen); | 139 | memcpy(link, ip->i_df.if_u1.if_data, pathlen); |
134 | link[pathlen] = '\0'; | 140 | link[pathlen] = '\0'; |
diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h index afb94583960c..98ce8124b1cc 100644 --- a/include/linux/devfreq.h +++ b/include/linux/devfreq.h | |||
@@ -41,7 +41,7 @@ struct devfreq_dev_status { | |||
41 | unsigned long total_time; | 41 | unsigned long total_time; |
42 | unsigned long busy_time; | 42 | unsigned long busy_time; |
43 | unsigned long current_frequency; | 43 | unsigned long current_frequency; |
44 | void *private_date; | 44 | void *private_data; |
45 | }; | 45 | }; |
46 | 46 | ||
47 | /** | 47 | /** |
diff --git a/include/linux/hwspinlock.h b/include/linux/hwspinlock.h index 08a2fee40659..aad6bd4b3efd 100644 --- a/include/linux/hwspinlock.h +++ b/include/linux/hwspinlock.h | |||
@@ -118,7 +118,6 @@ int __hwspin_trylock(struct hwspinlock *hwlock, int mode, unsigned long *flags) | |||
118 | static inline | 118 | static inline |
119 | void __hwspin_unlock(struct hwspinlock *hwlock, int mode, unsigned long *flags) | 119 | void __hwspin_unlock(struct hwspinlock *hwlock, int mode, unsigned long *flags) |
120 | { | 120 | { |
121 | return 0; | ||
122 | } | 121 | } |
123 | 122 | ||
124 | static inline int hwspin_lock_get_id(struct hwspinlock *hwlock) | 123 | static inline int hwspin_lock_get_id(struct hwspinlock *hwlock) |
diff --git a/kernel/power/qos.c b/kernel/power/qos.c index 56db75147186..995e3bd3417b 100644 --- a/kernel/power/qos.c +++ b/kernel/power/qos.c | |||
@@ -70,6 +70,7 @@ static struct pm_qos_constraints cpu_dma_constraints = { | |||
70 | }; | 70 | }; |
71 | static struct pm_qos_object cpu_dma_pm_qos = { | 71 | static struct pm_qos_object cpu_dma_pm_qos = { |
72 | .constraints = &cpu_dma_constraints, | 72 | .constraints = &cpu_dma_constraints, |
73 | .name = "cpu_dma_latency", | ||
73 | }; | 74 | }; |
74 | 75 | ||
75 | static BLOCKING_NOTIFIER_HEAD(network_lat_notifier); | 76 | static BLOCKING_NOTIFIER_HEAD(network_lat_notifier); |
diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl index 8d02ccb10c59..30e2befd6f2a 100755 --- a/tools/testing/ktest/ktest.pl +++ b/tools/testing/ktest/ktest.pl | |||
@@ -42,6 +42,7 @@ $default{"BISECT_MANUAL"} = 0; | |||
42 | $default{"BISECT_SKIP"} = 1; | 42 | $default{"BISECT_SKIP"} = 1; |
43 | $default{"SUCCESS_LINE"} = "login:"; | 43 | $default{"SUCCESS_LINE"} = "login:"; |
44 | $default{"DETECT_TRIPLE_FAULT"} = 1; | 44 | $default{"DETECT_TRIPLE_FAULT"} = 1; |
45 | $default{"NO_INSTALL"} = 0; | ||
45 | $default{"BOOTED_TIMEOUT"} = 1; | 46 | $default{"BOOTED_TIMEOUT"} = 1; |
46 | $default{"DIE_ON_FAILURE"} = 1; | 47 | $default{"DIE_ON_FAILURE"} = 1; |
47 | $default{"SSH_EXEC"} = "ssh \$SSH_USER\@\$MACHINE \$SSH_COMMAND"; | 48 | $default{"SSH_EXEC"} = "ssh \$SSH_USER\@\$MACHINE \$SSH_COMMAND"; |
@@ -84,6 +85,7 @@ my $grub_number; | |||
84 | my $target; | 85 | my $target; |
85 | my $make; | 86 | my $make; |
86 | my $post_install; | 87 | my $post_install; |
88 | my $no_install; | ||
87 | my $noclean; | 89 | my $noclean; |
88 | my $minconfig; | 90 | my $minconfig; |
89 | my $start_minconfig; | 91 | my $start_minconfig; |
@@ -115,6 +117,7 @@ my $timeout; | |||
115 | my $booted_timeout; | 117 | my $booted_timeout; |
116 | my $detect_triplefault; | 118 | my $detect_triplefault; |
117 | my $console; | 119 | my $console; |
120 | my $reboot_success_line; | ||
118 | my $success_line; | 121 | my $success_line; |
119 | my $stop_after_success; | 122 | my $stop_after_success; |
120 | my $stop_after_failure; | 123 | my $stop_after_failure; |
@@ -130,6 +133,12 @@ my %config_help; | |||
130 | my %variable; | 133 | my %variable; |
131 | my %force_config; | 134 | my %force_config; |
132 | 135 | ||
136 | # do not force reboots on config problems | ||
137 | my $no_reboot = 1; | ||
138 | |||
139 | # default variables that can be used | ||
140 | chomp ($variable{"PWD"} = `pwd`); | ||
141 | |||
133 | $config_help{"MACHINE"} = << "EOF" | 142 | $config_help{"MACHINE"} = << "EOF" |
134 | The machine hostname that you will test. | 143 | The machine hostname that you will test. |
135 | EOF | 144 | EOF |
@@ -241,6 +250,7 @@ sub read_yn { | |||
241 | 250 | ||
242 | sub get_ktest_config { | 251 | sub get_ktest_config { |
243 | my ($config) = @_; | 252 | my ($config) = @_; |
253 | my $ans; | ||
244 | 254 | ||
245 | return if (defined($opt{$config})); | 255 | return if (defined($opt{$config})); |
246 | 256 | ||
@@ -254,16 +264,17 @@ sub get_ktest_config { | |||
254 | if (defined($default{$config})) { | 264 | if (defined($default{$config})) { |
255 | print "\[$default{$config}\] "; | 265 | print "\[$default{$config}\] "; |
256 | } | 266 | } |
257 | $entered_configs{$config} = <STDIN>; | 267 | $ans = <STDIN>; |
258 | $entered_configs{$config} =~ s/^\s*(.*\S)\s*$/$1/; | 268 | $ans =~ s/^\s*(.*\S)\s*$/$1/; |
259 | if ($entered_configs{$config} =~ /^\s*$/) { | 269 | if ($ans =~ /^\s*$/) { |
260 | if ($default{$config}) { | 270 | if ($default{$config}) { |
261 | $entered_configs{$config} = $default{$config}; | 271 | $ans = $default{$config}; |
262 | } else { | 272 | } else { |
263 | print "Your answer can not be blank\n"; | 273 | print "Your answer can not be blank\n"; |
264 | next; | 274 | next; |
265 | } | 275 | } |
266 | } | 276 | } |
277 | $entered_configs{$config} = process_variables($ans); | ||
267 | last; | 278 | last; |
268 | } | 279 | } |
269 | } | 280 | } |
@@ -298,7 +309,7 @@ sub get_ktest_configs { | |||
298 | } | 309 | } |
299 | 310 | ||
300 | sub process_variables { | 311 | sub process_variables { |
301 | my ($value) = @_; | 312 | my ($value, $remove_undef) = @_; |
302 | my $retval = ""; | 313 | my $retval = ""; |
303 | 314 | ||
304 | # We want to check for '\', and it is just easier | 315 | # We want to check for '\', and it is just easier |
@@ -316,6 +327,10 @@ sub process_variables { | |||
316 | $retval = "$retval$begin"; | 327 | $retval = "$retval$begin"; |
317 | if (defined($variable{$var})) { | 328 | if (defined($variable{$var})) { |
318 | $retval = "$retval$variable{$var}"; | 329 | $retval = "$retval$variable{$var}"; |
330 | } elsif (defined($remove_undef) && $remove_undef) { | ||
331 | # for if statements, any variable that is not defined, | ||
332 | # we simple convert to 0 | ||
333 | $retval = "${retval}0"; | ||
319 | } else { | 334 | } else { |
320 | # put back the origin piece. | 335 | # put back the origin piece. |
321 | $retval = "$retval\$\{$var\}"; | 336 | $retval = "$retval\$\{$var\}"; |
@@ -331,10 +346,17 @@ sub process_variables { | |||
331 | } | 346 | } |
332 | 347 | ||
333 | sub set_value { | 348 | sub set_value { |
334 | my ($lvalue, $rvalue) = @_; | 349 | my ($lvalue, $rvalue, $override, $overrides, $name) = @_; |
335 | 350 | ||
336 | if (defined($opt{$lvalue})) { | 351 | if (defined($opt{$lvalue})) { |
337 | die "Error: Option $lvalue defined more than once!\n"; | 352 | if (!$override || defined(${$overrides}{$lvalue})) { |
353 | my $extra = ""; | ||
354 | if ($override) { | ||
355 | $extra = "In the same override section!\n"; | ||
356 | } | ||
357 | die "$name: $.: Option $lvalue defined more than once!\n$extra"; | ||
358 | } | ||
359 | ${$overrides}{$lvalue} = $rvalue; | ||
338 | } | 360 | } |
339 | if ($rvalue =~ /^\s*$/) { | 361 | if ($rvalue =~ /^\s*$/) { |
340 | delete $opt{$lvalue}; | 362 | delete $opt{$lvalue}; |
@@ -355,86 +377,274 @@ sub set_variable { | |||
355 | } | 377 | } |
356 | } | 378 | } |
357 | 379 | ||
358 | sub read_config { | 380 | sub process_compare { |
359 | my ($config) = @_; | 381 | my ($lval, $cmp, $rval) = @_; |
382 | |||
383 | # remove whitespace | ||
384 | |||
385 | $lval =~ s/^\s*//; | ||
386 | $lval =~ s/\s*$//; | ||
387 | |||
388 | $rval =~ s/^\s*//; | ||
389 | $rval =~ s/\s*$//; | ||
390 | |||
391 | if ($cmp eq "==") { | ||
392 | return $lval eq $rval; | ||
393 | } elsif ($cmp eq "!=") { | ||
394 | return $lval ne $rval; | ||
395 | } | ||
396 | |||
397 | my $statement = "$lval $cmp $rval"; | ||
398 | my $ret = eval $statement; | ||
399 | |||
400 | # $@ stores error of eval | ||
401 | if ($@) { | ||
402 | return -1; | ||
403 | } | ||
404 | |||
405 | return $ret; | ||
406 | } | ||
407 | |||
408 | sub value_defined { | ||
409 | my ($val) = @_; | ||
410 | |||
411 | return defined($variable{$2}) || | ||
412 | defined($opt{$2}); | ||
413 | } | ||
414 | |||
415 | my $d = 0; | ||
416 | sub process_expression { | ||
417 | my ($name, $val) = @_; | ||
418 | |||
419 | my $c = $d++; | ||
420 | |||
421 | while ($val =~ s/\(([^\(]*?)\)/\&\&\&\&VAL\&\&\&\&/) { | ||
422 | my $express = $1; | ||
423 | |||
424 | if (process_expression($name, $express)) { | ||
425 | $val =~ s/\&\&\&\&VAL\&\&\&\&/ 1 /; | ||
426 | } else { | ||
427 | $val =~ s/\&\&\&\&VAL\&\&\&\&/ 0 /; | ||
428 | } | ||
429 | } | ||
430 | |||
431 | $d--; | ||
432 | my $OR = "\\|\\|"; | ||
433 | my $AND = "\\&\\&"; | ||
434 | |||
435 | while ($val =~ s/^(.*?)($OR|$AND)//) { | ||
436 | my $express = $1; | ||
437 | my $op = $2; | ||
438 | |||
439 | if (process_expression($name, $express)) { | ||
440 | if ($op eq "||") { | ||
441 | return 1; | ||
442 | } | ||
443 | } else { | ||
444 | if ($op eq "&&") { | ||
445 | return 0; | ||
446 | } | ||
447 | } | ||
448 | } | ||
449 | |||
450 | if ($val =~ /(.*)(==|\!=|>=|<=|>|<)(.*)/) { | ||
451 | my $ret = process_compare($1, $2, $3); | ||
452 | if ($ret < 0) { | ||
453 | die "$name: $.: Unable to process comparison\n"; | ||
454 | } | ||
455 | return $ret; | ||
456 | } | ||
457 | |||
458 | if ($val =~ /^\s*(NOT\s*)?DEFINED\s+(\S+)\s*$/) { | ||
459 | if (defined $1) { | ||
460 | return !value_defined($2); | ||
461 | } else { | ||
462 | return value_defined($2); | ||
463 | } | ||
464 | } | ||
465 | |||
466 | if ($val =~ /^\s*0\s*$/) { | ||
467 | return 0; | ||
468 | } elsif ($val =~ /^\s*\d+\s*$/) { | ||
469 | return 1; | ||
470 | } | ||
471 | |||
472 | die ("$name: $.: Undefined content $val in if statement\n"); | ||
473 | } | ||
474 | |||
475 | sub process_if { | ||
476 | my ($name, $value) = @_; | ||
477 | |||
478 | # Convert variables and replace undefined ones with 0 | ||
479 | my $val = process_variables($value, 1); | ||
480 | my $ret = process_expression $name, $val; | ||
481 | |||
482 | return $ret; | ||
483 | } | ||
360 | 484 | ||
361 | open(IN, $config) || die "can't read file $config"; | 485 | sub __read_config { |
486 | my ($config, $current_test_num) = @_; | ||
487 | |||
488 | my $in; | ||
489 | open($in, $config) || die "can't read file $config"; | ||
362 | 490 | ||
363 | my $name = $config; | 491 | my $name = $config; |
364 | $name =~ s,.*/(.*),$1,; | 492 | $name =~ s,.*/(.*),$1,; |
365 | 493 | ||
366 | my $test_num = 0; | 494 | my $test_num = $$current_test_num; |
367 | my $default = 1; | 495 | my $default = 1; |
368 | my $repeat = 1; | 496 | my $repeat = 1; |
369 | my $num_tests_set = 0; | 497 | my $num_tests_set = 0; |
370 | my $skip = 0; | 498 | my $skip = 0; |
371 | my $rest; | 499 | my $rest; |
500 | my $line; | ||
372 | my $test_case = 0; | 501 | my $test_case = 0; |
502 | my $if = 0; | ||
503 | my $if_set = 0; | ||
504 | my $override = 0; | ||
373 | 505 | ||
374 | while (<IN>) { | 506 | my %overrides; |
507 | |||
508 | while (<$in>) { | ||
375 | 509 | ||
376 | # ignore blank lines and comments | 510 | # ignore blank lines and comments |
377 | next if (/^\s*$/ || /\s*\#/); | 511 | next if (/^\s*$/ || /\s*\#/); |
378 | 512 | ||
379 | if (/^\s*TEST_START(.*)/) { | 513 | if (/^\s*(TEST_START|DEFAULTS)\b(.*)/) { |
380 | 514 | ||
381 | $rest = $1; | 515 | my $type = $1; |
516 | $rest = $2; | ||
517 | $line = $2; | ||
382 | 518 | ||
383 | if ($num_tests_set) { | 519 | my $old_test_num; |
384 | die "$name: $.: Can not specify both NUM_TESTS and TEST_START\n"; | 520 | my $old_repeat; |
385 | } | 521 | $override = 0; |
522 | |||
523 | if ($type eq "TEST_START") { | ||
524 | |||
525 | if ($num_tests_set) { | ||
526 | die "$name: $.: Can not specify both NUM_TESTS and TEST_START\n"; | ||
527 | } | ||
386 | 528 | ||
387 | my $old_test_num = $test_num; | 529 | $old_test_num = $test_num; |
388 | my $old_repeat = $repeat; | 530 | $old_repeat = $repeat; |
389 | 531 | ||
390 | $test_num += $repeat; | 532 | $test_num += $repeat; |
391 | $default = 0; | 533 | $default = 0; |
392 | $repeat = 1; | 534 | $repeat = 1; |
535 | } else { | ||
536 | $default = 1; | ||
537 | } | ||
393 | 538 | ||
394 | if ($rest =~ /\s+SKIP(.*)/) { | 539 | # If SKIP is anywhere in the line, the command will be skipped |
395 | $rest = $1; | 540 | if ($rest =~ s/\s+SKIP\b//) { |
396 | $skip = 1; | 541 | $skip = 1; |
397 | } else { | 542 | } else { |
398 | $test_case = 1; | 543 | $test_case = 1; |
399 | $skip = 0; | 544 | $skip = 0; |
400 | } | 545 | } |
401 | 546 | ||
402 | if ($rest =~ /\s+ITERATE\s+(\d+)(.*)$/) { | 547 | if ($rest =~ s/\sELSE\b//) { |
403 | $repeat = $1; | 548 | if (!$if) { |
404 | $rest = $2; | 549 | die "$name: $.: ELSE found with out matching IF section\n$_"; |
405 | $repeat_tests{"$test_num"} = $repeat; | 550 | } |
551 | $if = 0; | ||
552 | |||
553 | if ($if_set) { | ||
554 | $skip = 1; | ||
555 | } else { | ||
556 | $skip = 0; | ||
557 | } | ||
406 | } | 558 | } |
407 | 559 | ||
408 | if ($rest =~ /\s+SKIP(.*)/) { | 560 | if ($rest =~ s/\sIF\s+(.*)//) { |
409 | $rest = $1; | 561 | if (process_if($name, $1)) { |
410 | $skip = 1; | 562 | $if_set = 1; |
563 | } else { | ||
564 | $skip = 1; | ||
565 | } | ||
566 | $if = 1; | ||
567 | } else { | ||
568 | $if = 0; | ||
569 | $if_set = 0; | ||
411 | } | 570 | } |
412 | 571 | ||
413 | if ($rest !~ /^\s*$/) { | 572 | if (!$skip) { |
414 | die "$name: $.: Gargbage found after TEST_START\n$_"; | 573 | if ($type eq "TEST_START") { |
574 | if ($rest =~ s/\s+ITERATE\s+(\d+)//) { | ||
575 | $repeat = $1; | ||
576 | $repeat_tests{"$test_num"} = $repeat; | ||
577 | } | ||
578 | } elsif ($rest =~ s/\sOVERRIDE\b//) { | ||
579 | # DEFAULT only | ||
580 | $override = 1; | ||
581 | # Clear previous overrides | ||
582 | %overrides = (); | ||
583 | } | ||
584 | } | ||
585 | |||
586 | if (!$skip && $rest !~ /^\s*$/) { | ||
587 | die "$name: $.: Gargbage found after $type\n$_"; | ||
415 | } | 588 | } |
416 | 589 | ||
417 | if ($skip) { | 590 | if ($skip && $type eq "TEST_START") { |
418 | $test_num = $old_test_num; | 591 | $test_num = $old_test_num; |
419 | $repeat = $old_repeat; | 592 | $repeat = $old_repeat; |
420 | } | 593 | } |
421 | 594 | ||
422 | } elsif (/^\s*DEFAULTS(.*)$/) { | 595 | } elsif (/^\s*ELSE\b(.*)$/) { |
423 | $default = 1; | 596 | if (!$if) { |
424 | 597 | die "$name: $.: ELSE found with out matching IF section\n$_"; | |
598 | } | ||
425 | $rest = $1; | 599 | $rest = $1; |
426 | 600 | if ($if_set) { | |
427 | if ($rest =~ /\s+SKIP(.*)/) { | ||
428 | $rest = $1; | ||
429 | $skip = 1; | 601 | $skip = 1; |
602 | $rest = ""; | ||
430 | } else { | 603 | } else { |
431 | $skip = 0; | 604 | $skip = 0; |
605 | |||
606 | if ($rest =~ /\sIF\s+(.*)/) { | ||
607 | # May be a ELSE IF section. | ||
608 | if (!process_if($name, $1)) { | ||
609 | $skip = 1; | ||
610 | } | ||
611 | $rest = ""; | ||
612 | } else { | ||
613 | $if = 0; | ||
614 | } | ||
432 | } | 615 | } |
433 | 616 | ||
434 | if ($rest !~ /^\s*$/) { | 617 | if ($rest !~ /^\s*$/) { |
435 | die "$name: $.: Gargbage found after DEFAULTS\n$_"; | 618 | die "$name: $.: Gargbage found after DEFAULTS\n$_"; |
436 | } | 619 | } |
437 | 620 | ||
621 | } elsif (/^\s*INCLUDE\s+(\S+)/) { | ||
622 | |||
623 | next if ($skip); | ||
624 | |||
625 | if (!$default) { | ||
626 | die "$name: $.: INCLUDE can only be done in default sections\n$_"; | ||
627 | } | ||
628 | |||
629 | my $file = process_variables($1); | ||
630 | |||
631 | if ($file !~ m,^/,) { | ||
632 | # check the path of the config file first | ||
633 | if ($config =~ m,(.*)/,) { | ||
634 | if (-f "$1/$file") { | ||
635 | $file = "$1/$file"; | ||
636 | } | ||
637 | } | ||
638 | } | ||
639 | |||
640 | if ( ! -r $file ) { | ||
641 | die "$name: $.: Can't read file $file\n$_"; | ||
642 | } | ||
643 | |||
644 | if (__read_config($file, \$test_num)) { | ||
645 | $test_case = 1; | ||
646 | } | ||
647 | |||
438 | } elsif (/^\s*([A-Z_\[\]\d]+)\s*=\s*(.*?)\s*$/) { | 648 | } elsif (/^\s*([A-Z_\[\]\d]+)\s*=\s*(.*?)\s*$/) { |
439 | 649 | ||
440 | next if ($skip); | 650 | next if ($skip); |
@@ -460,10 +670,10 @@ sub read_config { | |||
460 | } | 670 | } |
461 | 671 | ||
462 | if ($default || $lvalue =~ /\[\d+\]$/) { | 672 | if ($default || $lvalue =~ /\[\d+\]$/) { |
463 | set_value($lvalue, $rvalue); | 673 | set_value($lvalue, $rvalue, $override, \%overrides, $name); |
464 | } else { | 674 | } else { |
465 | my $val = "$lvalue\[$test_num\]"; | 675 | my $val = "$lvalue\[$test_num\]"; |
466 | set_value($val, $rvalue); | 676 | set_value($val, $rvalue, $override, \%overrides, $name); |
467 | 677 | ||
468 | if ($repeat > 1) { | 678 | if ($repeat > 1) { |
469 | $repeats{$val} = $repeat; | 679 | $repeats{$val} = $repeat; |
@@ -490,13 +700,26 @@ sub read_config { | |||
490 | } | 700 | } |
491 | } | 701 | } |
492 | 702 | ||
493 | close(IN); | ||
494 | |||
495 | if ($test_num) { | 703 | if ($test_num) { |
496 | $test_num += $repeat - 1; | 704 | $test_num += $repeat - 1; |
497 | $opt{"NUM_TESTS"} = $test_num; | 705 | $opt{"NUM_TESTS"} = $test_num; |
498 | } | 706 | } |
499 | 707 | ||
708 | close($in); | ||
709 | |||
710 | $$current_test_num = $test_num; | ||
711 | |||
712 | return $test_case; | ||
713 | } | ||
714 | |||
715 | sub read_config { | ||
716 | my ($config) = @_; | ||
717 | |||
718 | my $test_case; | ||
719 | my $test_num = 0; | ||
720 | |||
721 | $test_case = __read_config $config, \$test_num; | ||
722 | |||
500 | # make sure we have all mandatory configs | 723 | # make sure we have all mandatory configs |
501 | get_ktest_configs; | 724 | get_ktest_configs; |
502 | 725 | ||
@@ -603,8 +826,20 @@ sub doprint { | |||
603 | } | 826 | } |
604 | 827 | ||
605 | sub run_command; | 828 | sub run_command; |
829 | sub start_monitor; | ||
830 | sub end_monitor; | ||
831 | sub wait_for_monitor; | ||
606 | 832 | ||
607 | sub reboot { | 833 | sub reboot { |
834 | my ($time) = @_; | ||
835 | |||
836 | if (defined($time)) { | ||
837 | start_monitor; | ||
838 | # flush out current monitor | ||
839 | # May contain the reboot success line | ||
840 | wait_for_monitor 1; | ||
841 | } | ||
842 | |||
608 | # try to reboot normally | 843 | # try to reboot normally |
609 | if (run_command $reboot) { | 844 | if (run_command $reboot) { |
610 | if (defined($powercycle_after_reboot)) { | 845 | if (defined($powercycle_after_reboot)) { |
@@ -615,12 +850,17 @@ sub reboot { | |||
615 | # nope? power cycle it. | 850 | # nope? power cycle it. |
616 | run_command "$power_cycle"; | 851 | run_command "$power_cycle"; |
617 | } | 852 | } |
853 | |||
854 | if (defined($time)) { | ||
855 | wait_for_monitor($time, $reboot_success_line); | ||
856 | end_monitor; | ||
857 | } | ||
618 | } | 858 | } |
619 | 859 | ||
620 | sub do_not_reboot { | 860 | sub do_not_reboot { |
621 | my $i = $iteration; | 861 | my $i = $iteration; |
622 | 862 | ||
623 | return $test_type eq "build" || | 863 | return $test_type eq "build" || $no_reboot || |
624 | ($test_type eq "patchcheck" && $opt{"PATCHCHECK_TYPE[$i]"} eq "build") || | 864 | ($test_type eq "patchcheck" && $opt{"PATCHCHECK_TYPE[$i]"} eq "build") || |
625 | ($test_type eq "bisect" && $opt{"BISECT_TYPE[$i]"} eq "build"); | 865 | ($test_type eq "bisect" && $opt{"BISECT_TYPE[$i]"} eq "build"); |
626 | } | 866 | } |
@@ -693,16 +933,29 @@ sub end_monitor { | |||
693 | } | 933 | } |
694 | 934 | ||
695 | sub wait_for_monitor { | 935 | sub wait_for_monitor { |
696 | my ($time) = @_; | 936 | my ($time, $stop) = @_; |
937 | my $full_line = ""; | ||
697 | my $line; | 938 | my $line; |
939 | my $booted = 0; | ||
698 | 940 | ||
699 | doprint "** Wait for monitor to settle down **\n"; | 941 | doprint "** Wait for monitor to settle down **\n"; |
700 | 942 | ||
701 | # read the monitor and wait for the system to calm down | 943 | # read the monitor and wait for the system to calm down |
702 | do { | 944 | while (!$booted) { |
703 | $line = wait_for_input($monitor_fp, $time); | 945 | $line = wait_for_input($monitor_fp, $time); |
704 | print "$line" if (defined($line)); | 946 | last if (!defined($line)); |
705 | } while (defined($line)); | 947 | print "$line"; |
948 | $full_line .= $line; | ||
949 | |||
950 | if (defined($stop) && $full_line =~ /$stop/) { | ||
951 | doprint "wait for monitor detected $stop\n"; | ||
952 | $booted = 1; | ||
953 | } | ||
954 | |||
955 | if ($line =~ /\n/) { | ||
956 | $full_line = ""; | ||
957 | } | ||
958 | } | ||
706 | print "** Monitor flushed **\n"; | 959 | print "** Monitor flushed **\n"; |
707 | } | 960 | } |
708 | 961 | ||
@@ -719,10 +972,7 @@ sub fail { | |||
719 | # no need to reboot for just building. | 972 | # no need to reboot for just building. |
720 | if (!do_not_reboot) { | 973 | if (!do_not_reboot) { |
721 | doprint "REBOOTING\n"; | 974 | doprint "REBOOTING\n"; |
722 | reboot; | 975 | reboot $sleep_time; |
723 | start_monitor; | ||
724 | wait_for_monitor $sleep_time; | ||
725 | end_monitor; | ||
726 | } | 976 | } |
727 | 977 | ||
728 | my $name = ""; | 978 | my $name = ""; |
@@ -854,9 +1104,12 @@ sub get_grub_index { | |||
854 | open(IN, "$ssh_grub |") | 1104 | open(IN, "$ssh_grub |") |
855 | or die "unable to get menu.lst"; | 1105 | or die "unable to get menu.lst"; |
856 | 1106 | ||
1107 | my $found = 0; | ||
1108 | |||
857 | while (<IN>) { | 1109 | while (<IN>) { |
858 | if (/^\s*title\s+$grub_menu\s*$/) { | 1110 | if (/^\s*title\s+$grub_menu\s*$/) { |
859 | $grub_number++; | 1111 | $grub_number++; |
1112 | $found = 1; | ||
860 | last; | 1113 | last; |
861 | } elsif (/^\s*title\s/) { | 1114 | } elsif (/^\s*title\s/) { |
862 | $grub_number++; | 1115 | $grub_number++; |
@@ -865,7 +1118,7 @@ sub get_grub_index { | |||
865 | close(IN); | 1118 | close(IN); |
866 | 1119 | ||
867 | die "Could not find '$grub_menu' in /boot/grub/menu on $machine" | 1120 | die "Could not find '$grub_menu' in /boot/grub/menu on $machine" |
868 | if ($grub_number < 0); | 1121 | if (!$found); |
869 | doprint "$grub_number\n"; | 1122 | doprint "$grub_number\n"; |
870 | } | 1123 | } |
871 | 1124 | ||
@@ -902,7 +1155,8 @@ sub wait_for_input | |||
902 | 1155 | ||
903 | sub reboot_to { | 1156 | sub reboot_to { |
904 | if ($reboot_type eq "grub") { | 1157 | if ($reboot_type eq "grub") { |
905 | run_ssh "'(echo \"savedefault --default=$grub_number --once\" | grub --batch && reboot)'"; | 1158 | run_ssh "'(echo \"savedefault --default=$grub_number --once\" | grub --batch)'"; |
1159 | reboot; | ||
906 | return; | 1160 | return; |
907 | } | 1161 | } |
908 | 1162 | ||
@@ -1083,6 +1337,8 @@ sub do_post_install { | |||
1083 | 1337 | ||
1084 | sub install { | 1338 | sub install { |
1085 | 1339 | ||
1340 | return if ($no_install); | ||
1341 | |||
1086 | run_scp "$outputdir/$build_target", "$target_image" or | 1342 | run_scp "$outputdir/$build_target", "$target_image" or |
1087 | dodie "failed to copy image"; | 1343 | dodie "failed to copy image"; |
1088 | 1344 | ||
@@ -1140,6 +1396,11 @@ sub get_version { | |||
1140 | } | 1396 | } |
1141 | 1397 | ||
1142 | sub start_monitor_and_boot { | 1398 | sub start_monitor_and_boot { |
1399 | # Make sure the stable kernel has finished booting | ||
1400 | start_monitor; | ||
1401 | wait_for_monitor 5; | ||
1402 | end_monitor; | ||
1403 | |||
1143 | get_grub_index; | 1404 | get_grub_index; |
1144 | get_version; | 1405 | get_version; |
1145 | install; | 1406 | install; |
@@ -1250,6 +1511,10 @@ sub build { | |||
1250 | 1511 | ||
1251 | unlink $buildlog; | 1512 | unlink $buildlog; |
1252 | 1513 | ||
1514 | # Failed builds should not reboot the target | ||
1515 | my $save_no_reboot = $no_reboot; | ||
1516 | $no_reboot = 1; | ||
1517 | |||
1253 | if (defined($pre_build)) { | 1518 | if (defined($pre_build)) { |
1254 | my $ret = run_command $pre_build; | 1519 | my $ret = run_command $pre_build; |
1255 | if (!$ret && defined($pre_build_die) && | 1520 | if (!$ret && defined($pre_build_die) && |
@@ -1272,15 +1537,15 @@ sub build { | |||
1272 | # allow for empty configs | 1537 | # allow for empty configs |
1273 | run_command "touch $output_config"; | 1538 | run_command "touch $output_config"; |
1274 | 1539 | ||
1275 | run_command "mv $output_config $outputdir/config_temp" or | 1540 | if (!$noclean) { |
1276 | dodie "moving .config"; | 1541 | run_command "mv $output_config $outputdir/config_temp" or |
1542 | dodie "moving .config"; | ||
1277 | 1543 | ||
1278 | if (!$noclean && !run_command "$make mrproper") { | 1544 | run_command "$make mrproper" or dodie "make mrproper"; |
1279 | dodie "make mrproper"; | ||
1280 | } | ||
1281 | 1545 | ||
1282 | run_command "mv $outputdir/config_temp $output_config" or | 1546 | run_command "mv $outputdir/config_temp $output_config" or |
1283 | dodie "moving config_temp"; | 1547 | dodie "moving config_temp"; |
1548 | } | ||
1284 | 1549 | ||
1285 | } elsif (!$noclean) { | 1550 | } elsif (!$noclean) { |
1286 | unlink "$output_config"; | 1551 | unlink "$output_config"; |
@@ -1318,10 +1583,15 @@ sub build { | |||
1318 | 1583 | ||
1319 | if (!$build_ret) { | 1584 | if (!$build_ret) { |
1320 | # bisect may need this to pass | 1585 | # bisect may need this to pass |
1321 | return 0 if ($in_bisect); | 1586 | if ($in_bisect) { |
1587 | $no_reboot = $save_no_reboot; | ||
1588 | return 0; | ||
1589 | } | ||
1322 | fail "failed build" and return 0; | 1590 | fail "failed build" and return 0; |
1323 | } | 1591 | } |
1324 | 1592 | ||
1593 | $no_reboot = $save_no_reboot; | ||
1594 | |||
1325 | return 1; | 1595 | return 1; |
1326 | } | 1596 | } |
1327 | 1597 | ||
@@ -1356,10 +1626,7 @@ sub success { | |||
1356 | 1626 | ||
1357 | if ($i != $opt{"NUM_TESTS"} && !do_not_reboot) { | 1627 | if ($i != $opt{"NUM_TESTS"} && !do_not_reboot) { |
1358 | doprint "Reboot and wait $sleep_time seconds\n"; | 1628 | doprint "Reboot and wait $sleep_time seconds\n"; |
1359 | reboot; | 1629 | reboot $sleep_time; |
1360 | start_monitor; | ||
1361 | wait_for_monitor $sleep_time; | ||
1362 | end_monitor; | ||
1363 | } | 1630 | } |
1364 | } | 1631 | } |
1365 | 1632 | ||
@@ -1500,10 +1767,7 @@ sub run_git_bisect { | |||
1500 | 1767 | ||
1501 | sub bisect_reboot { | 1768 | sub bisect_reboot { |
1502 | doprint "Reboot and sleep $bisect_sleep_time seconds\n"; | 1769 | doprint "Reboot and sleep $bisect_sleep_time seconds\n"; |
1503 | reboot; | 1770 | reboot $bisect_sleep_time; |
1504 | start_monitor; | ||
1505 | wait_for_monitor $bisect_sleep_time; | ||
1506 | end_monitor; | ||
1507 | } | 1771 | } |
1508 | 1772 | ||
1509 | # returns 1 on success, 0 on failure, -1 on skip | 1773 | # returns 1 on success, 0 on failure, -1 on skip |
@@ -2066,10 +2330,7 @@ sub config_bisect { | |||
2066 | 2330 | ||
2067 | sub patchcheck_reboot { | 2331 | sub patchcheck_reboot { |
2068 | doprint "Reboot and sleep $patchcheck_sleep_time seconds\n"; | 2332 | doprint "Reboot and sleep $patchcheck_sleep_time seconds\n"; |
2069 | reboot; | 2333 | reboot $patchcheck_sleep_time; |
2070 | start_monitor; | ||
2071 | wait_for_monitor $patchcheck_sleep_time; | ||
2072 | end_monitor; | ||
2073 | } | 2334 | } |
2074 | 2335 | ||
2075 | sub patchcheck { | 2336 | sub patchcheck { |
@@ -2178,12 +2439,31 @@ sub patchcheck { | |||
2178 | } | 2439 | } |
2179 | 2440 | ||
2180 | my %depends; | 2441 | my %depends; |
2442 | my %depcount; | ||
2181 | my $iflevel = 0; | 2443 | my $iflevel = 0; |
2182 | my @ifdeps; | 2444 | my @ifdeps; |
2183 | 2445 | ||
2184 | # prevent recursion | 2446 | # prevent recursion |
2185 | my %read_kconfigs; | 2447 | my %read_kconfigs; |
2186 | 2448 | ||
2449 | sub add_dep { | ||
2450 | # $config depends on $dep | ||
2451 | my ($config, $dep) = @_; | ||
2452 | |||
2453 | if (defined($depends{$config})) { | ||
2454 | $depends{$config} .= " " . $dep; | ||
2455 | } else { | ||
2456 | $depends{$config} = $dep; | ||
2457 | } | ||
2458 | |||
2459 | # record the number of configs depending on $dep | ||
2460 | if (defined $depcount{$dep}) { | ||
2461 | $depcount{$dep}++; | ||
2462 | } else { | ||
2463 | $depcount{$dep} = 1; | ||
2464 | } | ||
2465 | } | ||
2466 | |||
2187 | # taken from streamline_config.pl | 2467 | # taken from streamline_config.pl |
2188 | sub read_kconfig { | 2468 | sub read_kconfig { |
2189 | my ($kconfig) = @_; | 2469 | my ($kconfig) = @_; |
@@ -2230,30 +2510,19 @@ sub read_kconfig { | |||
2230 | $config = $2; | 2510 | $config = $2; |
2231 | 2511 | ||
2232 | for (my $i = 0; $i < $iflevel; $i++) { | 2512 | for (my $i = 0; $i < $iflevel; $i++) { |
2233 | if ($i) { | 2513 | add_dep $config, $ifdeps[$i]; |
2234 | $depends{$config} .= " " . $ifdeps[$i]; | ||
2235 | } else { | ||
2236 | $depends{$config} = $ifdeps[$i]; | ||
2237 | } | ||
2238 | $state = "DEP"; | ||
2239 | } | 2514 | } |
2240 | 2515 | ||
2241 | # collect the depends for the config | 2516 | # collect the depends for the config |
2242 | } elsif ($state eq "NEW" && /^\s*depends\s+on\s+(.*)$/) { | 2517 | } elsif ($state eq "NEW" && /^\s*depends\s+on\s+(.*)$/) { |
2243 | 2518 | ||
2244 | if (defined($depends{$1})) { | 2519 | add_dep $config, $1; |
2245 | $depends{$config} .= " " . $1; | ||
2246 | } else { | ||
2247 | $depends{$config} = $1; | ||
2248 | } | ||
2249 | 2520 | ||
2250 | # Get the configs that select this config | 2521 | # Get the configs that select this config |
2251 | } elsif ($state ne "NONE" && /^\s*select\s+(\S+)/) { | 2522 | } elsif ($state eq "NEW" && /^\s*select\s+(\S+)/) { |
2252 | if (defined($depends{$1})) { | 2523 | |
2253 | $depends{$1} .= " " . $config; | 2524 | # selected by depends on config |
2254 | } else { | 2525 | add_dep $1, $config; |
2255 | $depends{$1} = $config; | ||
2256 | } | ||
2257 | 2526 | ||
2258 | # Check for if statements | 2527 | # Check for if statements |
2259 | } elsif (/^if\s+(.*\S)\s*$/) { | 2528 | } elsif (/^if\s+(.*\S)\s*$/) { |
@@ -2365,11 +2634,18 @@ sub make_new_config { | |||
2365 | close OUT; | 2634 | close OUT; |
2366 | } | 2635 | } |
2367 | 2636 | ||
2637 | sub chomp_config { | ||
2638 | my ($config) = @_; | ||
2639 | |||
2640 | $config =~ s/CONFIG_//; | ||
2641 | |||
2642 | return $config; | ||
2643 | } | ||
2644 | |||
2368 | sub get_depends { | 2645 | sub get_depends { |
2369 | my ($dep) = @_; | 2646 | my ($dep) = @_; |
2370 | 2647 | ||
2371 | my $kconfig = $dep; | 2648 | my $kconfig = chomp_config $dep; |
2372 | $kconfig =~ s/CONFIG_//; | ||
2373 | 2649 | ||
2374 | $dep = $depends{"$kconfig"}; | 2650 | $dep = $depends{"$kconfig"}; |
2375 | 2651 | ||
@@ -2419,8 +2695,7 @@ sub test_this_config { | |||
2419 | return undef; | 2695 | return undef; |
2420 | } | 2696 | } |
2421 | 2697 | ||
2422 | my $kconfig = $config; | 2698 | my $kconfig = chomp_config $config; |
2423 | $kconfig =~ s/CONFIG_//; | ||
2424 | 2699 | ||
2425 | # Test dependencies first | 2700 | # Test dependencies first |
2426 | if (defined($depends{"$kconfig"})) { | 2701 | if (defined($depends{"$kconfig"})) { |
@@ -2510,6 +2785,14 @@ sub make_min_config { | |||
2510 | 2785 | ||
2511 | my @config_keys = keys %min_configs; | 2786 | my @config_keys = keys %min_configs; |
2512 | 2787 | ||
2788 | # All configs need a depcount | ||
2789 | foreach my $config (@config_keys) { | ||
2790 | my $kconfig = chomp_config $config; | ||
2791 | if (!defined $depcount{$kconfig}) { | ||
2792 | $depcount{$kconfig} = 0; | ||
2793 | } | ||
2794 | } | ||
2795 | |||
2513 | # Remove anything that was set by the make allnoconfig | 2796 | # Remove anything that was set by the make allnoconfig |
2514 | # we shouldn't need them as they get set for us anyway. | 2797 | # we shouldn't need them as they get set for us anyway. |
2515 | foreach my $config (@config_keys) { | 2798 | foreach my $config (@config_keys) { |
@@ -2548,8 +2831,13 @@ sub make_min_config { | |||
2548 | # Now disable each config one by one and do a make oldconfig | 2831 | # Now disable each config one by one and do a make oldconfig |
2549 | # till we find a config that changes our list. | 2832 | # till we find a config that changes our list. |
2550 | 2833 | ||
2551 | # Put configs that did not modify the config at the end. | ||
2552 | my @test_configs = keys %min_configs; | 2834 | my @test_configs = keys %min_configs; |
2835 | |||
2836 | # Sort keys by who is most dependent on | ||
2837 | @test_configs = sort { $depcount{chomp_config($b)} <=> $depcount{chomp_config($a)} } | ||
2838 | @test_configs ; | ||
2839 | |||
2840 | # Put configs that did not modify the config at the end. | ||
2553 | my $reset = 1; | 2841 | my $reset = 1; |
2554 | for (my $i = 0; $i < $#test_configs; $i++) { | 2842 | for (my $i = 0; $i < $#test_configs; $i++) { |
2555 | if (!defined($nochange_config{$test_configs[0]})) { | 2843 | if (!defined($nochange_config{$test_configs[0]})) { |
@@ -2659,10 +2947,7 @@ sub make_min_config { | |||
2659 | } | 2947 | } |
2660 | 2948 | ||
2661 | doprint "Reboot and wait $sleep_time seconds\n"; | 2949 | doprint "Reboot and wait $sleep_time seconds\n"; |
2662 | reboot; | 2950 | reboot $sleep_time; |
2663 | start_monitor; | ||
2664 | wait_for_monitor $sleep_time; | ||
2665 | end_monitor; | ||
2666 | } | 2951 | } |
2667 | 2952 | ||
2668 | success $i; | 2953 | success $i; |
@@ -2783,6 +3068,9 @@ sub set_test_option { | |||
2783 | # First we need to do is the builds | 3068 | # First we need to do is the builds |
2784 | for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) { | 3069 | for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) { |
2785 | 3070 | ||
3071 | # Do not reboot on failing test options | ||
3072 | $no_reboot = 1; | ||
3073 | |||
2786 | $iteration = $i; | 3074 | $iteration = $i; |
2787 | 3075 | ||
2788 | my $makecmd = set_test_option("MAKE_CMD", $i); | 3076 | my $makecmd = set_test_option("MAKE_CMD", $i); |
@@ -2811,6 +3099,7 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) { | |||
2811 | $reboot_type = set_test_option("REBOOT_TYPE", $i); | 3099 | $reboot_type = set_test_option("REBOOT_TYPE", $i); |
2812 | $grub_menu = set_test_option("GRUB_MENU", $i); | 3100 | $grub_menu = set_test_option("GRUB_MENU", $i); |
2813 | $post_install = set_test_option("POST_INSTALL", $i); | 3101 | $post_install = set_test_option("POST_INSTALL", $i); |
3102 | $no_install = set_test_option("NO_INSTALL", $i); | ||
2814 | $reboot_script = set_test_option("REBOOT_SCRIPT", $i); | 3103 | $reboot_script = set_test_option("REBOOT_SCRIPT", $i); |
2815 | $reboot_on_error = set_test_option("REBOOT_ON_ERROR", $i); | 3104 | $reboot_on_error = set_test_option("REBOOT_ON_ERROR", $i); |
2816 | $poweroff_on_error = set_test_option("POWEROFF_ON_ERROR", $i); | 3105 | $poweroff_on_error = set_test_option("POWEROFF_ON_ERROR", $i); |
@@ -2832,6 +3121,7 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) { | |||
2832 | $console = set_test_option("CONSOLE", $i); | 3121 | $console = set_test_option("CONSOLE", $i); |
2833 | $detect_triplefault = set_test_option("DETECT_TRIPLE_FAULT", $i); | 3122 | $detect_triplefault = set_test_option("DETECT_TRIPLE_FAULT", $i); |
2834 | $success_line = set_test_option("SUCCESS_LINE", $i); | 3123 | $success_line = set_test_option("SUCCESS_LINE", $i); |
3124 | $reboot_success_line = set_test_option("REBOOT_SUCCESS_LINE", $i); | ||
2835 | $stop_after_success = set_test_option("STOP_AFTER_SUCCESS", $i); | 3125 | $stop_after_success = set_test_option("STOP_AFTER_SUCCESS", $i); |
2836 | $stop_after_failure = set_test_option("STOP_AFTER_FAILURE", $i); | 3126 | $stop_after_failure = set_test_option("STOP_AFTER_FAILURE", $i); |
2837 | $stop_test_after = set_test_option("STOP_TEST_AFTER", $i); | 3127 | $stop_test_after = set_test_option("STOP_TEST_AFTER", $i); |
@@ -2850,9 +3140,11 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) { | |||
2850 | 3140 | ||
2851 | chdir $builddir || die "can't change directory to $builddir"; | 3141 | chdir $builddir || die "can't change directory to $builddir"; |
2852 | 3142 | ||
2853 | if (!-d $tmpdir) { | 3143 | foreach my $dir ($tmpdir, $outputdir) { |
2854 | mkpath($tmpdir) or | 3144 | if (!-d $dir) { |
2855 | die "can't create $tmpdir"; | 3145 | mkpath($dir) or |
3146 | die "can't create $dir"; | ||
3147 | } | ||
2856 | } | 3148 | } |
2857 | 3149 | ||
2858 | $ENV{"SSH_USER"} = $ssh_user; | 3150 | $ENV{"SSH_USER"} = $ssh_user; |
@@ -2889,8 +3181,11 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) { | |||
2889 | $run_type = "ERROR"; | 3181 | $run_type = "ERROR"; |
2890 | } | 3182 | } |
2891 | 3183 | ||
3184 | my $installme = ""; | ||
3185 | $installme = " no_install" if ($no_install); | ||
3186 | |||
2892 | doprint "\n\n"; | 3187 | doprint "\n\n"; |
2893 | doprint "RUNNING TEST $i of $opt{NUM_TESTS} with option $test_type $run_type\n\n"; | 3188 | doprint "RUNNING TEST $i of $opt{NUM_TESTS} with option $test_type $run_type$installme\n\n"; |
2894 | 3189 | ||
2895 | unlink $dmesg; | 3190 | unlink $dmesg; |
2896 | unlink $buildlog; | 3191 | unlink $buildlog; |
@@ -2911,6 +3206,9 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) { | |||
2911 | die "failed to checkout $checkout"; | 3206 | die "failed to checkout $checkout"; |
2912 | } | 3207 | } |
2913 | 3208 | ||
3209 | $no_reboot = 0; | ||
3210 | |||
3211 | |||
2914 | if ($test_type eq "bisect") { | 3212 | if ($test_type eq "bisect") { |
2915 | bisect $i; | 3213 | bisect $i; |
2916 | next; | 3214 | next; |
@@ -2929,6 +3227,13 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) { | |||
2929 | build $build_type or next; | 3227 | build $build_type or next; |
2930 | } | 3228 | } |
2931 | 3229 | ||
3230 | if ($test_type eq "install") { | ||
3231 | get_version; | ||
3232 | install; | ||
3233 | success $i; | ||
3234 | next; | ||
3235 | } | ||
3236 | |||
2932 | if ($test_type ne "build") { | 3237 | if ($test_type ne "build") { |
2933 | my $failed = 0; | 3238 | my $failed = 0; |
2934 | start_monitor_and_boot or $failed = 1; | 3239 | start_monitor_and_boot or $failed = 1; |
diff --git a/tools/testing/ktest/sample.conf b/tools/testing/ktest/sample.conf index b8bcd14b5a4d..dbedfa196727 100644 --- a/tools/testing/ktest/sample.conf +++ b/tools/testing/ktest/sample.conf | |||
@@ -72,6 +72,128 @@ | |||
72 | # the same option name under the same test or as default | 72 | # the same option name under the same test or as default |
73 | # ktest will fail to execute, and no tests will run. | 73 | # ktest will fail to execute, and no tests will run. |
74 | # | 74 | # |
75 | # DEFAULTS OVERRIDE | ||
76 | # | ||
77 | # Options defined in the DEFAULTS section can not be duplicated | ||
78 | # even if they are defined in two different DEFAULT sections. | ||
79 | # This is done to catch mistakes where an option is added but | ||
80 | # the previous option was forgotten about and not commented. | ||
81 | # | ||
82 | # The OVERRIDE keyword can be added to a section to allow this | ||
83 | # section to override other DEFAULT sections values that have | ||
84 | # been defined previously. It will only override options that | ||
85 | # have been defined before its use. Options defined later | ||
86 | # in a non override section will still error. The same option | ||
87 | # can not be defined in the same section even if that section | ||
88 | # is marked OVERRIDE. | ||
89 | # | ||
90 | # | ||
91 | # | ||
92 | # Both TEST_START and DEFAULTS sections can also have the IF keyword | ||
93 | # The value after the IF must evaluate into a 0 or non 0 positive | ||
94 | # integer, and can use the config variables (explained below). | ||
95 | # | ||
96 | # DEFAULTS IF ${IS_X86_32} | ||
97 | # | ||
98 | # The above will process the DEFAULTS section if the config | ||
99 | # variable IS_X86_32 evaluates to a non zero positive integer | ||
100 | # otherwise if it evaluates to zero, it will act the same | ||
101 | # as if the SKIP keyword was used. | ||
102 | # | ||
103 | # The ELSE keyword can be used directly after a section with | ||
104 | # a IF statement. | ||
105 | # | ||
106 | # TEST_START IF ${RUN_NET_TESTS} | ||
107 | # BUILD_TYPE = useconfig:${CONFIG_DIR}/config-network | ||
108 | # | ||
109 | # ELSE | ||
110 | # | ||
111 | # BUILD_TYPE = useconfig:${CONFIG_DIR}/config-normal | ||
112 | # | ||
113 | # | ||
114 | # The ELSE keyword can also contain an IF statement to allow multiple | ||
115 | # if then else sections. But all the sections must be either | ||
116 | # DEFAULT or TEST_START, they can not be a mixture. | ||
117 | # | ||
118 | # TEST_START IF ${RUN_NET_TESTS} | ||
119 | # BUILD_TYPE = useconfig:${CONFIG_DIR}/config-network | ||
120 | # | ||
121 | # ELSE IF ${RUN_DISK_TESTS} | ||
122 | # BUILD_TYPE = useconfig:${CONFIG_DIR}/config-tests | ||
123 | # | ||
124 | # ELSE IF ${RUN_CPU_TESTS} | ||
125 | # BUILD_TYPE = useconfig:${CONFIG_DIR}/config-cpu | ||
126 | # | ||
127 | # ELSE | ||
128 | # BUILD_TYPE = useconfig:${CONFIG_DIR}/config-network | ||
129 | # | ||
130 | # The if statement may also have comparisons that will and for | ||
131 | # == and !=, strings may be used for both sides. | ||
132 | # | ||
133 | # BOX_TYPE := x86_32 | ||
134 | # | ||
135 | # DEFAULTS IF ${BOX_TYPE} == x86_32 | ||
136 | # BUILD_TYPE = useconfig:${CONFIG_DIR}/config-32 | ||
137 | # ELSE | ||
138 | # BUILD_TYPE = useconfig:${CONFIG_DIR}/config-64 | ||
139 | # | ||
140 | # The DEFINED keyword can be used by the IF statements too. | ||
141 | # It returns true if the given config variable or option has been defined | ||
142 | # or false otherwise. | ||
143 | # | ||
144 | # | ||
145 | # DEFAULTS IF DEFINED USE_CC | ||
146 | # CC := ${USE_CC} | ||
147 | # ELSE | ||
148 | # CC := gcc | ||
149 | # | ||
150 | # | ||
151 | # As well as NOT DEFINED. | ||
152 | # | ||
153 | # DEFAULTS IF NOT DEFINED MAKE_CMD | ||
154 | # MAKE_CMD := make ARCH=x86 | ||
155 | # | ||
156 | # | ||
157 | # And/or ops (&&,||) may also be used to make complex conditionals. | ||
158 | # | ||
159 | # TEST_START IF (DEFINED ALL_TESTS || ${MYTEST} == boottest) && ${MACHINE} == gandalf | ||
160 | # | ||
161 | # Notice the use of paranthesis. Without any paranthesis the above would be | ||
162 | # processed the same as: | ||
163 | # | ||
164 | # TEST_START IF DEFINED ALL_TESTS || (${MYTEST} == boottest && ${MACHINE} == gandalf) | ||
165 | # | ||
166 | # | ||
167 | # | ||
168 | # INCLUDE file | ||
169 | # | ||
170 | # The INCLUDE keyword may be used in DEFAULT sections. This will | ||
171 | # read another config file and process that file as well. The included | ||
172 | # file can include other files, add new test cases or default | ||
173 | # statements. Config variables will be passed to these files and changes | ||
174 | # to config variables will be seen by top level config files. Including | ||
175 | # a file is processed just like the contents of the file was cut and pasted | ||
176 | # into the top level file, except, that include files that end with | ||
177 | # TEST_START sections will have that section ended at the end of | ||
178 | # the include file. That is, an included file is included followed | ||
179 | # by another DEFAULT keyword. | ||
180 | # | ||
181 | # Unlike other files referenced in this config, the file path does not need | ||
182 | # to be absolute. If the file does not start with '/', then the directory | ||
183 | # that the current config file was located in is used. If no config by the | ||
184 | # given name is found there, then the current directory is searched. | ||
185 | # | ||
186 | # INCLUDE myfile | ||
187 | # DEFAULT | ||
188 | # | ||
189 | # is the same as: | ||
190 | # | ||
191 | # INCLUDE myfile | ||
192 | # | ||
193 | # Note, if the include file does not contain a full path, the file is | ||
194 | # searched first by the location of the original include file, and then | ||
195 | # by the location that ktest.pl was executed in. | ||
196 | # | ||
75 | 197 | ||
76 | #### Config variables #### | 198 | #### Config variables #### |
77 | # | 199 | # |
@@ -253,9 +375,10 @@ | |||
253 | 375 | ||
254 | # The default test type (default test) | 376 | # The default test type (default test) |
255 | # The test types may be: | 377 | # The test types may be: |
256 | # build - only build the kernel, do nothing else | 378 | # build - only build the kernel, do nothing else |
257 | # boot - build and boot the kernel | 379 | # install - build and install, but do nothing else (does not reboot) |
258 | # test - build, boot and if TEST is set, run the test script | 380 | # boot - build, install, and boot the kernel |
381 | # test - build, boot and if TEST is set, run the test script | ||
259 | # (If TEST is not set, it defaults back to boot) | 382 | # (If TEST is not set, it defaults back to boot) |
260 | # bisect - Perform a bisect on the kernel (see BISECT_TYPE below) | 383 | # bisect - Perform a bisect on the kernel (see BISECT_TYPE below) |
261 | # patchcheck - Do a test on a series of commits in git (see PATCHCHECK below) | 384 | # patchcheck - Do a test on a series of commits in git (see PATCHCHECK below) |
@@ -293,6 +416,13 @@ | |||
293 | # or on some systems: | 416 | # or on some systems: |
294 | #POST_INSTALL = ssh user@target /sbin/dracut -f /boot/initramfs-test.img $KERNEL_VERSION | 417 | #POST_INSTALL = ssh user@target /sbin/dracut -f /boot/initramfs-test.img $KERNEL_VERSION |
295 | 418 | ||
419 | # If for some reason you just want to boot the kernel and you do not | ||
420 | # want the test to install anything new. For example, you may just want | ||
421 | # to boot test the same kernel over and over and do not want to go through | ||
422 | # the hassle of installing anything, you can set this option to 1 | ||
423 | # (default 0) | ||
424 | #NO_INSTALL = 1 | ||
425 | |||
296 | # If there is a script that you require to run before the build is done | 426 | # If there is a script that you require to run before the build is done |
297 | # you can specify it with PRE_BUILD. | 427 | # you can specify it with PRE_BUILD. |
298 | # | 428 | # |
@@ -415,6 +545,14 @@ | |||
415 | # (default "login:") | 545 | # (default "login:") |
416 | #SUCCESS_LINE = login: | 546 | #SUCCESS_LINE = login: |
417 | 547 | ||
548 | # To speed up between reboots, defining a line that the | ||
549 | # default kernel produces that represents that the default | ||
550 | # kernel has successfully booted and can be used to pass | ||
551 | # a new test kernel to it. Otherwise ktest.pl will wait till | ||
552 | # SLEEP_TIME to continue. | ||
553 | # (default undefined) | ||
554 | #REBOOT_SUCCESS_LINE = login: | ||
555 | |||
418 | # In case the console constantly fills the screen, having | 556 | # In case the console constantly fills the screen, having |
419 | # a specified time to stop the test after success is recommended. | 557 | # a specified time to stop the test after success is recommended. |
420 | # (in seconds) | 558 | # (in seconds) |
@@ -480,6 +618,8 @@ | |||
480 | # another test. If a reboot to the reliable kernel happens, | 618 | # another test. If a reboot to the reliable kernel happens, |
481 | # we wait SLEEP_TIME for the console to stop producing output | 619 | # we wait SLEEP_TIME for the console to stop producing output |
482 | # before starting the next test. | 620 | # before starting the next test. |
621 | # | ||
622 | # You can speed up reboot times even more by setting REBOOT_SUCCESS_LINE. | ||
483 | # (default 60) | 623 | # (default 60) |
484 | #SLEEP_TIME = 60 | 624 | #SLEEP_TIME = 60 |
485 | 625 | ||