targetted DPCs?

Hi all,

I’m trying to target a DPC onto a specific CPU using KeSetTargetProcessorDpc
and KeInsertQueueDpc. The problem is that the DPC starts on the current CPU,
rather than the targetted one. I’m sure the parameter passed to
KeSetTargetProcessorDpc points to the right CPU. I’m using XP SP2 and
DriverWorks, if that matters. (this is a Hyper Threading system.)

Thanks,

Simon

Simon wrote:

I’m trying to target a DPC onto a specific CPU using KeSetTargetProcessorDpc
and KeInsertQueueDpc. The problem is that the DPC starts on the current CPU,
rather than the targetted one. I’m sure the parameter passed to
KeSetTargetProcessorDpc points to the right CPU. I’m using XP SP2 and
DriverWorks, if that matters. (this is a Hyper Threading system.)

The only way I know of that you could get this behavior is if you’re
running the single processor version of Windows on a multi-processor
system. Since only 1 CPU is being used, your DPC is queued to that one
CPU irrespective of the target processor that you may have set.

Just to ask the obvious questions: You are quite sure you’ve enabled HT
on the system, and that you’re running the MP kernel, right?

Have you walked into KeInsertQueueDpc in the debugger to see what’s
going on?? The beginning of this routine, at least, is very straight
forward. Find the two PRCBs, and see if you can definitively determine
that your DPC is being queued to the PRCB for the processor that you’re
attempting to target.

Peter
OSR

Uhhh KeInsertQueueDpc is correctly queueing the DPC after all… (as SoftICE
shows). It’s KeGetCurrentProcessorNumber that’s always returning 0. This
problem occurs only if I build the project using XP as the
target OS. When setting the target OS to either 2000 or 2003 it works fine.

Here’s how the function is defined in the XP part of the DDK:

FORCEINLINE
ULONG
NTAPI
KeGetCurrentProcessorNumber(VOID)
{
__asm { movzx eax, _PCR KPCR.Number }
}

#if NT_UP
#define _PCR ds:[KIP0PCRADDRESS]
#else
#define _PCR fs:[0]
#endif

“Peter Viscarola (OSR)” wrote in message
news:xxxxx@ntdev…
> Simon wrote:
>>
>> I’m trying to target a DPC onto a specific CPU using
>> KeSetTargetProcessorDpc and KeInsertQueueDpc. The problem is that the DPC
>> starts on the current CPU, rather than the targetted one. I’m sure the
>> parameter passed to KeSetTargetProcessorDpc points to the right CPU. I’m
>> using XP SP2 and DriverWorks, if that matters. (this is a Hyper Threading
>> system.)
>>
>
> The only way I know of that you could get this behavior is if you’re
> running the single processor version of Windows on a multi-processor
> system. Since only 1 CPU is being used, your DPC is queued to that one
> CPU irrespective of the target processor that you may have set.
>
> Just to ask the obvious questions: You are quite sure you’ve enabled HT
> on the system, and that you’re running the MP kernel, right?
>
> Have you walked into KeInsertQueueDpc in the debugger to see what’s going
> on?? The beginning of this routine, at least, is very straight forward.
> Find the two PRCBs, and see if you can definitively determine that your
> DPC is being queued to the PRCB for the processor that you’re attempting
> to target.
>
> Peter
> OSR
>

An obvious question is if NT_UP was defined in your XP driver build.

Loren

----- Original Message -----
From: “Simon” <fallen_angel>
Newsgroups: ntdev
To: “Windows System Software Devs Interest List”
Sent: Saturday, January 22, 2005 3:21 PM
Subject: Re:[ntdev] targetted DPCs?

> Uhhh KeInsertQueueDpc is correctly queueing the DPC after all… (as
SoftICE
> shows). It’s KeGetCurrentProcessorNumber that’s always returning 0. This
> problem occurs only if I build the project using XP as the
> target OS. When setting the target OS to either 2000 or 2003 it works
fine.
>
> Here’s how the function is defined in the XP part of the DDK:
>
> FORCEINLINE
> ULONG
> NTAPI
> KeGetCurrentProcessorNumber(VOID)
> {
> __asm { movzx eax, _PCR KPCR.Number }
> }
>
> #if NT_UP
> #define _PCR ds:[KIP0PCRADDRESS]
> #else
> #define _PCR fs:[0]
> #endif
>
>
>
>
> “Peter Viscarola (OSR)” wrote in message
> news:xxxxx@ntdev…
> > Simon wrote:
> >>
> >> I’m trying to target a DPC onto a specific CPU using
> >> KeSetTargetProcessorDpc and KeInsertQueueDpc. The problem is that the
DPC
> >> starts on the current CPU, rather than the targetted one. I’m sure the
> >> parameter passed to KeSetTargetProcessorDpc points to the right CPU.
I’m
> >> using XP SP2 and DriverWorks, if that matters. (this is a Hyper
Threading
> >> system.)
> >>
> >
> > The only way I know of that you could get this behavior is if you’re
> > running the single processor version of Windows on a multi-processor
> > system. Since only 1 CPU is being used, your DPC is queued to that one
> > CPU irrespective of the target processor that you may have set.
> >
> > Just to ask the obvious questions: You are quite sure you’ve enabled HT
> > on the system, and that you’re running the MP kernel, right?
> >
> > Have you walked into KeInsertQueueDpc in the debugger to see what’s
going
> > on?? The beginning of this routine, at least, is very straight forward.
> > Find the two PRCBs, and see if you can definitively determine that your
> > DPC is being queued to the PRCB for the processor that you’re attempting
> > to target.
> >
> > Peter
> > OSR
> >
>
>
>
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@earthlink.net
> To unsubscribe send a blank email to xxxxx@lists.osr.com</fallen_angel>

Right, it was defined by DriverWorks by default…

“Loren Wilton” wrote in message news:xxxxx@ntdev…
> An obvious question is if NT_UP was defined in your XP driver build.
>
> Loren
>
> ----- Original Message -----
> From: “Simon” <fallen_angel>
> Newsgroups: ntdev
> To: “Windows System Software Devs Interest List”
> Sent: Saturday, January 22, 2005 3:21 PM
> Subject: Re:[ntdev] targetted DPCs?
>
>
>> Uhhh KeInsertQueueDpc is correctly queueing the DPC after all… (as
> SoftICE
>> shows). It’s KeGetCurrentProcessorNumber that’s always returning 0. This
>> problem occurs only if I build the project using XP as the
>> target OS. When setting the target OS to either 2000 or 2003 it works
> fine.
>>
>> Here’s how the function is defined in the XP part of the DDK:
>>
>> FORCEINLINE
>> ULONG
>> NTAPI
>> KeGetCurrentProcessorNumber(VOID)
>> {
>> __asm { movzx eax, _PCR KPCR.Number }
>> }
>>
>> #if NT_UP
>> #define _PCR ds:[KIP0PCRADDRESS]
>> #else
>> #define _PCR fs:[0]
>> #endif
>>
>>
>>
>>
>> “Peter Viscarola (OSR)” wrote in message
>> news:xxxxx@ntdev…
>> > Simon wrote:
>> >>
>> >> I’m trying to target a DPC onto a specific CPU using
>> >> KeSetTargetProcessorDpc and KeInsertQueueDpc. The problem is that the
> DPC
>> >> starts on the current CPU, rather than the targetted one. I’m sure the
>> >> parameter passed to KeSetTargetProcessorDpc points to the right CPU.
> I’m
>> >> using XP SP2 and DriverWorks, if that matters. (this is a Hyper
> Threading
>> >> system.)
>> >>
>> >
>> > The only way I know of that you could get this behavior is if you’re
>> > running the single processor version of Windows on a multi-processor
>> > system. Since only 1 CPU is being used, your DPC is queued to that one
>> > CPU irrespective of the target processor that you may have set.
>> >
>> > Just to ask the obvious questions: You are quite sure you’ve enabled
>> > HT
>> > on the system, and that you’re running the MP kernel, right?
>> >
>> > Have you walked into KeInsertQueueDpc in the debugger to see what’s
> going
>> > on?? The beginning of this routine, at least, is very straight
>> > forward.
>> > Find the two PRCBs, and see if you can definitively determine that your
>> > DPC is being queued to the PRCB for the processor that you’re
>> > attempting
>> > to target.
>> >
>> > Peter
>> > OSR
>> >
>>
>>
>>
>>
>>
>>
>> —
>> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>>
>> You are currently subscribed to ntdev as: xxxxx@earthlink.net
>> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
></fallen_angel>