Hi, I have a bus driver which calls WdfChildListAddOrUpdateChildDescriptionAsPresent to plugin a child device. In my unplug routine, I will enumerate the child device list with WdfRetrievePresentChildren flag and call WdfChildListUpdateChildDescriptionAsMissing. This works fine if EvtChildListCreateDevice has been called before the unplug takes place. However if the unplug happens before EvtChildListCreateDevice has been called, I will have issue. I know that I can enumerate the child device list with WdfRetrieveAddedChildren flag to get both present and pending devices. I wonder how do I handle the pending child device? Will calling WdfChildListUpdateChildDescriptionAsMissing for the pending device prevent the EvtChildListCreateDevice from executing?
The WDFCHILDLIST will handle the case where you report a child as present and then report it as missing before the child PDO WDFDEVICE is created. There are many intermediate states here, even if you mark the child as missing before the WDFDEVICE is created, the WDFCHILDLIST might be right at the point where the create child callback is about to be invoke so it will be created and then reported as missing right after.
What bigger problem are you trying to solve? KMDF handles all of this state for you, you should just report state changes and let KMDF take care of it.
d
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Monday, October 20, 2014 11:44 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] How to prevent EvtChildListCreateDevice from executing?
Hi, I have a bus driver which calls WdfChildListAddOrUpdateChildDescriptionAsPresent to plugin a child device. In my unplug routine, I will enumerate the child device list with WdfRetrievePresentChildren flag and call WdfChildListUpdateChildDescriptionAsMissing. This works fine if EvtChildListCreateDevice has been called before the unplug takes place. However if the unplug happens before EvtChildListCreateDevice has been called, I will have issue. I know that I can enumerate the child device list with WdfRetrieveAddedChildren flag to get both present and pending devices. I wonder how do I handle the pending child device? Will calling WdfChildListUpdateChildDescriptionAsMissing for the pending device prevent the EvtChildListCreateDevice from executing?
NTDEV is sponsored by OSR
Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
OSR is HIRING!! See http://www.osr.com/careers
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
Hi Doron, thanks for your reply. My bus driver has a bug which I think the
root cause is that the cleanup is not done completely.
When unplug a child device, I will enumerate the parent’s child device
list, if I device is as present state, I will do PART I cleanup
work(cleanup something done in the create callback) and mark it as missing.
Then in the cleanup callback, I will do the PART II cleanup work. However,
if the child device is in pending state, I don’t know where I can do the
PART I and PART II cleanup work(If I mark it as missing, is it guaranteed
that the create and cleanup callback will be called?).
I call WdfChildListBeginScan and then mark a device as missing. Won’t
WdfChildListBeginScan/WdfChildListEndScan synchronize with the framework
code that calls the create callback?
2014-10-22 1:17 GMT+08:00 Doron Holan :
> The WDFCHILDLIST will handle the case where you report a child as present
> and then report it as missing before the child PDO WDFDEVICE is created.
> There are many intermediate states here, even if you mark the child as
> missing before the WDFDEVICE is created, the WDFCHILDLIST might be right at
> the point where the create child callback is about to be invoke so it will
> be created and then reported as missing right after.
>
> What bigger problem are you trying to solve? KMDF handles all of this
> state for you, you should just report state changes and let KMDF take care
> of it.
>
> d
>
> -----Original Message-----
> From: xxxxx@lists.osr.com [mailto:
> xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
> Sent: Monday, October 20, 2014 11:44 PM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] How to prevent EvtChildListCreateDevice from executing?
>
> Hi, I have a bus driver which calls
> WdfChildListAddOrUpdateChildDescriptionAsPresent to plugin a child device.
> In my unplug routine, I will enumerate the child device list with
> WdfRetrievePresentChildren flag and call
> WdfChildListUpdateChildDescriptionAsMissing. This works fine if
> EvtChildListCreateDevice has been called before the unplug takes place.
> However if the unplug happens before EvtChildListCreateDevice has been
> called, I will have issue. I know that I can enumerate the child device
> list with WdfRetrieveAddedChildren flag to get both present and pending
> devices. I wonder how do I handle the pending child device? Will calling
> WdfChildListUpdateChildDescriptionAsMissing for the pending device prevent
> the EvtChildListCreateDevice from executing?
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
> Won’t WdfChildListBeginScan/WdfChildListEndScan synchronize with the framework code that calls the create callback?
They don’t. Think of a wdfchildlist as a list of two stage transactions. You insert a state change into the list and then at some point later it becomes committed. BeginScan will bump up the number of active changes by one and EndScan decrements the count. This allows multiple threads to add changes in a nin blocking fashion. When the count goes to zero, the changes are committed. For device creation, at some point later a qdr/busrelations comes and the second stage of the transaction is committed (reporting the pdo to pnp as present or missing). The create callback can come during a scan while the active count is not zero.
d
Bent from my phone
From: Si Gangmailto:xxxxx
Sent: ?10/?21/?2014 7:11 PM
To: Windows System Software Devs Interest Listmailto:xxxxx
Subject: Re: [ntdev] How to prevent EvtChildListCreateDevice from executing?
Hi Doron, thanks for your reply. My bus driver has a bug which I think the root cause is that the cleanup is not done completely.
When unplug a child device, I will enumerate the parent’s child device list, if I device is as present state, I will do PART I cleanup work(cleanup something done in the create callback) and mark it as missing. Then in the cleanup callback, I will do the PART II cleanup work. However, if the child device is in pending state, I don’t know where I can do the PART I and PART II cleanup work(If I mark it as missing, is it guaranteed that the create and cleanup callback will be called?).
I call WdfChildListBeginScan and then mark a device as missing. Won’t WdfChildListBeginScan/WdfChildListEndScan synchronize with the framework code that calls the create callback?
2014-10-22 1:17 GMT+08:00 Doron Holan >:
The WDFCHILDLIST will handle the case where you report a child as present and then report it as missing before the child PDO WDFDEVICE is created. There are many intermediate states here, even if you mark the child as missing before the WDFDEVICE is created, the WDFCHILDLIST might be right at the point where the create child callback is about to be invoke so it will be created and then reported as missing right after.
What bigger problem are you trying to solve? KMDF handles all of this state for you, you should just report state changes and let KMDF take care of it.
d
-----Original Message-----
From: xxxxx@lists.osr.commailto:xxxxx [mailto:xxxxx@lists.osr.commailto:xxxxx] On Behalf Of xxxxx@gmail.commailto:xxxxx
Sent: Monday, October 20, 2014 11:44 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] How to prevent EvtChildListCreateDevice from executing?
Hi, I have a bus driver which calls WdfChildListAddOrUpdateChildDescriptionAsPresent to plugin a child device. In my unplug routine, I will enumerate the child device list with WdfRetrievePresentChildren flag and call WdfChildListUpdateChildDescriptionAsMissing. This works fine if EvtChildListCreateDevice has been called before the unplug takes place. However if the unplug happens before EvtChildListCreateDevice has been called, I will have issue. I know that I can enumerate the child device list with WdfRetrieveAddedChildren flag to get both present and pending devices. I wonder how do I handle the pending child device? Will calling WdfChildListUpdateChildDescriptionAsMissing for the pending device prevent the EvtChildListCreateDevice from executing?
—
NTDEV is sponsored by OSR
Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
OSR is HIRING!! See http://www.osr.com/careers
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
—
NTDEV is sponsored by OSR
Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
OSR is HIRING!! See http://www.osr.com/careers
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
— NTDEV is sponsored by OSR Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev OSR is HIRING!! See http://www.osr.com/careers For our schedule of WDF, WDM, debugging and other seminars visit: http://www.osr.com/seminars To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer</mailto:xxxxx></mailto:xxxxx></mailto:xxxxx></mailto:xxxxx></mailto:xxxxx>
Hi Doron, thanks for the detailed explanation.
2014-10-22 10:33 GMT+08:00 Doron Holan :
> > Won’t WdfChildListBeginScan/WdfChildListEndScan synchronize with the
> framework code that calls the create callback?
>
> They don’t. Think of a wdfchildlist as a list of two stage transactions.
> You insert a state change into the list and then at some point later it
> becomes committed. BeginScan will bump up the number of active changes by
> one and EndScan decrements the count. This allows multiple threads to add
> changes in a nin blocking fashion. When the count goes to zero, the changes
> are committed. For device creation, at some point later a qdr/busrelations
> comes and the second stage of the transaction is committed (reporting the
> pdo to pnp as present or missing). The create callback can come during a
> scan while the active count is not zero.
>
> d
>
> Bent from my phone
> ------------------------------
> From: Si Gang
> Sent: 10/21/2014 7:11 PM
> To: Windows System Software Devs Interest List
> Subject: Re: [ntdev] How to prevent EvtChildListCreateDevice from
> executing?
>
> Hi Doron, thanks for your reply. My bus driver has a bug which I think
> the root cause is that the cleanup is not done completely.
> When unplug a child device, I will enumerate the parent’s child device
> list, if I device is as present state, I will do PART I cleanup
> work(cleanup something done in the create callback) and mark it as missing.
> Then in the cleanup callback, I will do the PART II cleanup work. However,
> if the child device is in pending state, I don’t know where I can do the
> PART I and PART II cleanup work(If I mark it as missing, is it guaranteed
> that the create and cleanup callback will be called?).
> I call WdfChildListBeginScan and then mark a device as missing. Won’t
> WdfChildListBeginScan/WdfChildListEndScan synchronize with the framework
> code that calls the create callback?
>
> 2014-10-22 1:17 GMT+08:00 Doron Holan :
>
>> The WDFCHILDLIST will handle the case where you report a child as present
>> and then report it as missing before the child PDO WDFDEVICE is created.
>> There are many intermediate states here, even if you mark the child as
>> missing before the WDFDEVICE is created, the WDFCHILDLIST might be right at
>> the point where the create child callback is about to be invoke so it will
>> be created and then reported as missing right after.
>>
>> What bigger problem are you trying to solve? KMDF handles all of this
>> state for you, you should just report state changes and let KMDF take care
>> of it.
>>
>> d
>>
>> -----Original Message-----
>> From: xxxxx@lists.osr.com [mailto:
>> xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
>> Sent: Monday, October 20, 2014 11:44 PM
>> To: Windows System Software Devs Interest List
>> Subject: [ntdev] How to prevent EvtChildListCreateDevice from executing?
>>
>> Hi, I have a bus driver which calls
>> WdfChildListAddOrUpdateChildDescriptionAsPresent to plugin a child device.
>> In my unplug routine, I will enumerate the child device list with
>> WdfRetrievePresentChildren flag and call
>> WdfChildListUpdateChildDescriptionAsMissing. This works fine if
>> EvtChildListCreateDevice has been called before the unplug takes place.
>> However if the unplug happens before EvtChildListCreateDevice has been
>> called, I will have issue. I know that I can enumerate the child device
>> list with WdfRetrieveAddedChildren flag to get both present and pending
>> devices. I wonder how do I handle the pending child device? Will calling
>> WdfChildListUpdateChildDescriptionAsMissing for the pending device prevent
>> the EvtChildListCreateDevice from executing?
>>
>> —
>> NTDEV is sponsored by OSR
>>
>> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>>
>> OSR is HIRING!! See http://www.osr.com/careers
>>
>> For our schedule of WDF, WDM, debugging and other seminars visit:
>> http://www.osr.com/seminars
>>
>> To unsubscribe, visit the List Server section of OSR Online at
>> http://www.osronline.com/page.cfm?name=ListServer
>>
>> —
>> NTDEV is sponsored by OSR
>>
>> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>>
>> OSR is HIRING!! See http://www.osr.com/careers
>>
>> For our schedule of WDF, WDM, debugging and other seminars visit:
>> http://www.osr.com/seminars
>>
>> To unsubscribe, visit the List Server section of OSR Online at
>> http://www.osronline.com/page.cfm?name=ListServer
>>
>
> — NTDEV is sponsored by OSR Visit the list at:
> http://www.osronline.com/showlists.cfm?list=ntdev OSR is HIRING!! See
> http://www.osr.com/careers For our schedule of WDF, WDM, debugging and
> other seminars visit: http://www.osr.com/seminars To unsubscribe, visit
> the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>