mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 18:15:11 +00:00
- Disable old and unused IPI code, add new NT compatible stubs
- KiIpiSendRequest should be a fastcall named KiIpiSend, fix this and fix callers - Implement most of SMP KeIpiGenericCall. Also use KiReverseStallIpiLock instead of an uninitialized "KiIpiLock" - Fix KiIpiServiceRoutine -- 2nd argument should be PKEXCEPTION_FRAME svn path=/trunk/; revision=37126
This commit is contained in:
parent
b949b9b7c3
commit
39d59e06dd
8 changed files with 135 additions and 20 deletions
|
@ -205,7 +205,7 @@ BOOLEAN
|
||||||
NTAPI
|
NTAPI
|
||||||
KiIpiServiceRoutine(
|
KiIpiServiceRoutine(
|
||||||
IN PKTRAP_FRAME TrapFrame,
|
IN PKTRAP_FRAME TrapFrame,
|
||||||
IN PVOID ExceptionFrame
|
IN PKEXCEPTION_FRAME ExceptionFrame
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -190,7 +190,7 @@ ShutdownThreadMain(PVOID Context)
|
||||||
KeInitializeDpc(Dpc, KiHaltProcessorDpcRoutine, (PVOID)Dpc);
|
KeInitializeDpc(Dpc, KiHaltProcessorDpcRoutine, (PVOID)Dpc);
|
||||||
KeSetTargetProcessorDpc(Dpc, i);
|
KeSetTargetProcessorDpc(Dpc, i);
|
||||||
KeInsertQueueDpc(Dpc, NULL, NULL);
|
KeInsertQueueDpc(Dpc, NULL, NULL);
|
||||||
KiIpiSendRequest(1 << i, IPI_DPC);
|
KiIpiSend(1 << i, IPI_DPC);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
KeLowerIrql(OldIrql);
|
KeLowerIrql(OldIrql);
|
||||||
|
|
|
@ -327,12 +327,35 @@ KeWaitForGate(
|
||||||
/* ipi.c ********************************************************************/
|
/* ipi.c ********************************************************************/
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
FASTCALL
|
||||||
KiIpiSendRequest(
|
KiIpiSend(
|
||||||
KAFFINITY TargetSet,
|
KAFFINITY TargetSet,
|
||||||
ULONG IpiRequest
|
ULONG IpiRequest
|
||||||
);
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
NTAPI
|
||||||
|
KiIpiSendPacket(
|
||||||
|
IN KAFFINITY TargetProcessors,
|
||||||
|
IN PKIPI_WORKER WorkerFunction,
|
||||||
|
IN PKIPI_BROADCAST_WORKER BroadcastFunction,
|
||||||
|
IN ULONG_PTR Context,
|
||||||
|
IN PULONG Count
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
FASTCALL
|
||||||
|
KiIpiSignalPacketDone(
|
||||||
|
IN PKIPI_CONTEXT PacketContext
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
FASTCALL
|
||||||
|
KiIpiSignalPacketDoneAndStall(
|
||||||
|
IN PKIPI_CONTEXT PacketContext,
|
||||||
|
IN volatile PULONG ReverseStall
|
||||||
|
);
|
||||||
|
|
||||||
/* next file ***************************************************************/
|
/* next file ***************************************************************/
|
||||||
|
|
||||||
UCHAR
|
UCHAR
|
||||||
|
|
|
@ -594,7 +594,7 @@ KiRescheduleThread(IN BOOLEAN NewThread,
|
||||||
if ((NewThread) && !(KeGetPcr()->Number == Cpu))
|
if ((NewThread) && !(KeGetPcr()->Number == Cpu))
|
||||||
{
|
{
|
||||||
/* Send an IPI to request delivery */
|
/* Send an IPI to request delivery */
|
||||||
KiIpiSendRequest(AFFINITY_MASK(Cpu), IPI_DPC);
|
KiIpiSend(AFFINITY_MASK(Cpu), IPI_DPC);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -751,7 +751,7 @@ KiRequestApcInterrupt(IN BOOLEAN NeedApc,
|
||||||
if (KeGetPcr()->Number != Processor)
|
if (KeGetPcr()->Number != Processor)
|
||||||
{
|
{
|
||||||
/* Send an IPI to request delivery */
|
/* Send an IPI to request delivery */
|
||||||
KiIpiSendRequest(AFFINITY_MASK(Processor), IPI_APC);
|
KiIpiSend(AFFINITY_MASK(Processor), IPI_APC);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -1130,7 +1130,7 @@ KeBugCheckWithTf(IN ULONG BugCheckCode,
|
||||||
if (i != (LONG)KeGetCurrentProcessorNumber())
|
if (i != (LONG)KeGetCurrentProcessorNumber())
|
||||||
{
|
{
|
||||||
/* Send the IPI and give them one second to catch up */
|
/* Send the IPI and give them one second to catch up */
|
||||||
KiIpiSendRequest(1 << i, IPI_FREEZE);
|
KiIpiSend(1 << i, IPI_FREEZE);
|
||||||
KeStallExecutionProcessor(1000000);
|
KeStallExecutionProcessor(1000000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -683,7 +683,7 @@ KeInsertQueueDpc(IN PKDPC Dpc,
|
||||||
if (Prcb != CurrentPrcb)
|
if (Prcb != CurrentPrcb)
|
||||||
{
|
{
|
||||||
/* It was, request and IPI */
|
/* It was, request and IPI */
|
||||||
KiIpiSendRequest(AFFINITY_MASK(Cpu), IPI_DPC);
|
KiIpiSend(AFFINITY_MASK(Cpu), IPI_DPC);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,10 +14,60 @@
|
||||||
|
|
||||||
/* GLOBALS *******************************************************************/
|
/* GLOBALS *******************************************************************/
|
||||||
|
|
||||||
KSPIN_LOCK KiIpiLock;
|
extern KSPIN_LOCK KiReverseStallIpiLock;
|
||||||
|
|
||||||
/* PRIVATE FUNCTIONS *********************************************************/
|
/* PRIVATE FUNCTIONS *********************************************************/
|
||||||
|
|
||||||
|
VOID
|
||||||
|
NTAPI
|
||||||
|
KiIpiGenericCallTarget(IN PKIPI_CONTEXT PacketContext,
|
||||||
|
IN PVOID BroadcastFunction,
|
||||||
|
IN PVOID Argument,
|
||||||
|
IN PVOID Count)
|
||||||
|
{
|
||||||
|
/* FIXME: TODO */
|
||||||
|
ASSERTMSG("Not yet implemented\n", FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
FASTCALL
|
||||||
|
KiIpiSend(IN KAFFINITY TargetProcessors,
|
||||||
|
IN ULONG IpiRequest)
|
||||||
|
{
|
||||||
|
/* FIXME: TODO */
|
||||||
|
ASSERTMSG("Not yet implemented\n", FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
NTAPI
|
||||||
|
KiIpiSendPacket(IN KAFFINITY TargetProcessors,
|
||||||
|
IN PKIPI_WORKER WorkerFunction,
|
||||||
|
IN PKIPI_BROADCAST_WORKER BroadcastFunction,
|
||||||
|
IN ULONG_PTR Context,
|
||||||
|
IN PULONG Count)
|
||||||
|
{
|
||||||
|
/* FIXME: TODO */
|
||||||
|
ASSERTMSG("Not yet implemented\n", FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
FASTCALL
|
||||||
|
KiIpiSignalPacketDone(IN PKIPI_CONTEXT PacketContext)
|
||||||
|
{
|
||||||
|
/* FIXME: TODO */
|
||||||
|
ASSERTMSG("Not yet implemented\n", FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
FASTCALL
|
||||||
|
KiIpiSignalPacketDoneAndStall(IN PKIPI_CONTEXT PacketContext,
|
||||||
|
IN volatile PULONG ReverseStall)
|
||||||
|
{
|
||||||
|
/* FIXME: TODO */
|
||||||
|
ASSERTMSG("Not yet implemented\n", FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
KiIpiSendRequest(IN KAFFINITY TargetSet,
|
KiIpiSendRequest(IN KAFFINITY TargetSet,
|
||||||
|
@ -86,6 +136,7 @@ KiIpiSendPacket(IN KAFFINITY TargetSet,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* PUBLIC FUNCTIONS **********************************************************/
|
/* PUBLIC FUNCTIONS **********************************************************/
|
||||||
|
|
||||||
|
@ -95,7 +146,7 @@ KiIpiSendPacket(IN KAFFINITY TargetSet,
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
NTAPI
|
NTAPI
|
||||||
KiIpiServiceRoutine(IN PKTRAP_FRAME TrapFrame,
|
KiIpiServiceRoutine(IN PKTRAP_FRAME TrapFrame,
|
||||||
IN PVOID ExceptionFrame)
|
IN PKEXCEPTION_FRAME ExceptionFrame)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_SMP
|
||||||
PKPRCB Prcb;
|
PKPRCB Prcb;
|
||||||
|
@ -141,32 +192,73 @@ NTAPI
|
||||||
KeIpiGenericCall(IN PKIPI_BROADCAST_WORKER Function,
|
KeIpiGenericCall(IN PKIPI_BROADCAST_WORKER Function,
|
||||||
IN ULONG_PTR Argument)
|
IN ULONG_PTR Argument)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_SMP
|
|
||||||
#error Not yet implemented!
|
|
||||||
#else
|
|
||||||
ULONG_PTR Status;
|
ULONG_PTR Status;
|
||||||
KIRQL OldIrql, OldIrql2;
|
KIRQL OldIrql, OldIrql2;
|
||||||
|
#ifdef CONFIG_SMP
|
||||||
|
KAFFINITY Affinity;
|
||||||
|
ULONG Count;
|
||||||
|
PKPRCB Prcb = KeGetCurrentPrcb();
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Raise to DPC level if required */
|
/* Raise to DPC level if required */
|
||||||
OldIrql = KeGetCurrentIrql();
|
OldIrql = KeGetCurrentIrql();
|
||||||
if (OldIrql < DISPATCH_LEVEL) KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
|
if (OldIrql < DISPATCH_LEVEL) KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
|
||||||
|
|
||||||
|
#ifdef CONFIG_SMP
|
||||||
|
/* Get current processor count and affinity */
|
||||||
|
Count = KeNumberProcessors;
|
||||||
|
Affinity = KeActiveProcessors;
|
||||||
|
|
||||||
|
/* Exclude ourselves */
|
||||||
|
Affinity &= ~KeGetCurrentPrcb()->SetMember;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Acquire the IPI lock */
|
/* Acquire the IPI lock */
|
||||||
KefAcquireSpinLockAtDpcLevel(&KiIpiLock);
|
KeAcquireSpinLockAtDpcLevel(&KiReverseStallIpiLock);
|
||||||
|
|
||||||
|
#ifdef CONFIG_SMP
|
||||||
|
/* Make sure this is MP */
|
||||||
|
if (Affinity)
|
||||||
|
{
|
||||||
|
/* Send an IPI */
|
||||||
|
KiIpiSendPacket(Affinity,
|
||||||
|
KiIpiGenericCallTarget,
|
||||||
|
Function,
|
||||||
|
Argument,
|
||||||
|
&Count);
|
||||||
|
|
||||||
|
/* Spin until the other processors are ready */
|
||||||
|
while ((volatile ULONG)Count != 1) YieldProcessor();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Raise to IPI level */
|
/* Raise to IPI level */
|
||||||
KeRaiseIrql(IPI_LEVEL, &OldIrql2);
|
KeRaiseIrql(IPI_LEVEL, &OldIrql2);
|
||||||
|
|
||||||
|
#ifdef CONFIG_SMP
|
||||||
|
/* Let the other processors know it is time */
|
||||||
|
Count = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Call the function */
|
/* Call the function */
|
||||||
Status = Function(Argument);
|
Status = Function(Argument);
|
||||||
|
|
||||||
|
#ifdef CONFIG_SMP
|
||||||
|
/* If this is MP, wait for the other processors to finish */
|
||||||
|
if (Affinity)
|
||||||
|
{
|
||||||
|
/* Sanity check */
|
||||||
|
ASSERT(Prcb == (volatile PKPRCB)KeGetCurrentPrcb());
|
||||||
|
|
||||||
|
/* FIXME: TODO */
|
||||||
|
ASSERTMSG("Not yet implemented\n", FALSE);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Release the lock */
|
/* Release the lock */
|
||||||
KefReleaseSpinLockFromDpcLevel(&KiIpiLock);
|
KeReleaseSpinLockFromDpcLevel(&KiReverseStallIpiLock);
|
||||||
|
|
||||||
/* Lower IRQL back */
|
/* Lower IRQL back */
|
||||||
KeLowerIrql(OldIrql);
|
KeLowerIrql(OldIrql);
|
||||||
return Status;
|
return Status;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* EOF */
|
|
||||||
|
|
|
@ -253,7 +253,7 @@ KiDeferredReadyThread(IN PKTHREAD Thread)
|
||||||
if (KeGetCurrentProcessorNumber() != Thread->NextProcessor)
|
if (KeGetCurrentProcessorNumber() != Thread->NextProcessor)
|
||||||
{
|
{
|
||||||
/* We are, send an IPI */
|
/* We are, send an IPI */
|
||||||
KiIpiSendRequest(AFFINITY_MASK(Thread->NextProcessor), IPI_DPC);
|
KiIpiSend(AFFINITY_MASK(Thread->NextProcessor), IPI_DPC);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -612,7 +612,7 @@ KiSetPriorityThread(IN PKTHREAD Thread,
|
||||||
if (KeGetCurrentProcessorNumber() != Processor)
|
if (KeGetCurrentProcessorNumber() != Processor)
|
||||||
{
|
{
|
||||||
/* We are, send an IPI */
|
/* We are, send an IPI */
|
||||||
KiIpiSendRequest(AFFINITY_MASK(Processor), IPI_DPC);
|
KiIpiSend(AFFINITY_MASK(Processor), IPI_DPC);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue