Handling PNP paging request

Source: Internet
Author: User
  1. The following explains why the do_power_pagable bit must be set on the way down and not on the way up:

    The power requirements state that if any lower device object sets the do_power_pagable bit, all higher-level drivers must do the same. if the filter driver fails to set the do_power_pagable bit prior to sending the paging request IRP down the stack, it cocould violate this condition as follows:

    Suppose the filter driver does not set the do_power_pagable bit in its filter do before forwarding the paging request IRP to the drivers beneath it in the driver stack. next suppose that a lower driver sets the do_power_pagable bit in its own do. finally, suppose that prior to the completion of the IRP by the filter driver a power IRP occurs. at that point, the do_power_pagable bit wocould be cleared in the filter do but wocould be set in the do of the lower-level driver, causing a system crash.

    It is safe to set the do_power_pagable bit before forwarding a paging request down the stack, because there is no longer an active paging file on the filter driver's device, and therefore no more paging I/O will occur on it. if the request to remove this paging file succeeds, the filter driver will be done. if the request fails, the filter driver can restore the original state of its flags by simply clearing the do_power_pagable bit prior to completing the IRP. because the paging file requests are serialized, there is no danger that some other thread will have modified this bit since the filter driver last altered it.

    The requirement for Power Management specifies that if the do_power_pagable bit is set for a lower-layer device object, this is also required for all higher-level drivers. If the filter driver does not set the do_power_pagable bit before sending the paging IRP, it may violate the following conditions: assume that the filter driver does not set the do_power_pagable bit before the paging IRP is sent, assume that the lower-layer driver sets the do_power_pagable bit of the device object. Finally, assume that a power supply IRP occurs before the IRP of the filter driver is completed. At this time, the do_power_pagable bit will be cleared by the filter driver, but it will be set by the lower-layer driver, causing a system crash.
    It is safe to set the do_power_pagable bit before a paging request is sent, because there is no longer an active paging file on this filtering driver device, therefore, no paging I/O occurs on the page. If the request to remove this page file is successfully executed, the filter driver will do it. If the request fails, the filter driver can restore the original status of its flag, you only need to clear the do_power_pagable bit before completing this IRP. Because page file requests are serialized. Even if the other threads modify the bit after the filter driver finally changes it, this is no danger.
    Link: http://msdn.microsoft.com/zh-cn/ff554992

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.