- Fix several locking issues to better fit with RosMm
- Page out is critical as we use it now (shutdown) so force address space locking
- Fix an address space lock leak for VM regions
- Quiet some debugging and enable/change some other
- Still some lingering issues in page out exist which seem to be related to zefklop's PDE ref counting stuff and a weird one where we fault on the PFN database
- Besides the aforementioned issues, NewCC is surprisingly solid. I was able to boot to 3rd stage without a problem and run some apps.

svn path=/trunk/; revision=55895
This commit is contained in:
Cameron Gutman 2012-02-28 04:01:33 +00:00
parent 6086842a76
commit 29f3456caf
6 changed files with 18 additions and 14 deletions

View file

@ -11,7 +11,7 @@
#include <ntoskrnl.h>
#include "newcc.h"
#include "section/newmm.h"
//#define NDEBUG
#define NDEBUG
#include <debug.h>
/* GLOBALS ********************************************************************/

View file

@ -10,7 +10,7 @@
#include <ntoskrnl.h>
#include "newcc.h"
//#define NDEBUG
#define NDEBUG
#include <debug.h>
/* GLOBALS ********************************************************************/
@ -95,7 +95,7 @@ NTAPI
CcMdlReadComplete2(IN PMDL MdlChain,
IN PFILE_OBJECT FileObject)
{
DPRINT("Not sure\n");
UNIMPLEMENTED
}
VOID
@ -128,7 +128,7 @@ CcMdlWriteComplete2(IN PFILE_OBJECT FileObject,
IN PLARGE_INTEGER FileOffset,
IN PMDL MdlChain)
{
DPRINT("Not sure\n");
UNIMPLEMENTED
}
VOID

View file

@ -230,7 +230,7 @@ ULONG CcpAllocateCacheSections
if (!RtlTestBit(CcCacheBitmap, i))
{
DPRINT("Somebody stoeled BCB #%x\n", i);
DPRINT1("Somebody stoeled BCB #%x\n", i);
}
ASSERT(RtlTestBit(CcCacheBitmap, i));
@ -239,7 +239,7 @@ ULONG CcpAllocateCacheSections
}
else
{
DPRINT("Failed to allocate cache segment\n");
DPRINT1("Failed to allocate cache segment\n");
}
return i;
}

View file

@ -328,12 +328,7 @@ MmpPageOutPhysicalAddress(PFN_NUMBER Page)
KeBugCheck(MEMORY_MANAGEMENT);
}
if (!MmTryToLockAddressSpace(AddressSpace))
{
DPRINT1("Could not lock address space for process %x\n", MmGetAddressSpaceOwner(AddressSpace));
Status = STATUS_UNSUCCESSFUL;
goto bail;
}
MmLockAddressSpace(AddressSpace);
do
{
@ -495,12 +490,14 @@ MiRosTrimCache(ULONG Target, ULONG Priority, PULONG NrFreed)
PMM_SECTION_SEGMENT Segment;
*NrFreed = 0;
DPRINT1("Need to trim %d cache pages\n", Target);
for (Entry = MiSegmentList.Flink; *NrFreed < Target && Entry != &MiSegmentList; Entry = Entry->Flink) {
Segment = CONTAINING_RECORD(Entry, MM_SECTION_SEGMENT, ListOfSegments);
// Defer to MM to try recovering pages from it
Freed = MiCacheEvictPages(Segment, Target);
*NrFreed += Freed;
}
DPRINT1("Evicted %d cache pages\n", Target);
if (!IsListEmpty(&MiSegmentList)) {
Entry = MiSegmentList.Flink;

View file

@ -63,7 +63,11 @@ MmPageOutPhysicalAddress(PFN_NUMBER Page)
// Special case for NEWCC: we can have a page that's only in a segment
// page table
if (entry && RMAP_IS_SEGMENT(entry->Address) && entry->Next == NULL)
{
/* NEWCC does locking itself */
ExReleaseFastMutex(&RmapListLock);
return MmpPageOutPhysicalAddress(Page);
}
#endif
while (entry && RMAP_IS_SEGMENT(entry->Address))
@ -155,11 +159,14 @@ MmPageOutPhysicalAddress(PFN_NUMBER Page)
}
else if (Type == MEMORY_AREA_CACHE)
{
Status = MmpPageOutPhysicalAddress(Page);
/* NEWCC does locking itself */
MmUnlockAddressSpace(AddressSpace);
Status = MmpPageOutPhysicalAddress(Page);
}
else if (Type == MEMORY_AREA_VIRTUAL_MEMORY)
{
/* Do not page out virtual memory during ARM3 transition */
MmUnlockAddressSpace(AddressSpace);
Status = STATUS_SUCCESS;
}
else

View file

@ -1218,7 +1218,7 @@ MiReadPage(PMEMORY_AREA MemoryArea,
Resources.Consumer = MC_USER;
Resources.Amount = PAGE_SIZE;
DPRINT1("%S, offset %x, len %d, page %x\n", ((PFILE_OBJECT)Resources.Context)->FileName.Buffer, Resources.FileOffset.LowPart, Resources.Amount, Resources.Page[0]);
DPRINT("%S, offset 0x%x, len 0x%x, page 0x%x\n", ((PFILE_OBJECT)Resources.Context)->FileName.Buffer, Resources.FileOffset.LowPart, Resources.Amount, Resources.Page[0]);
Status = MiReadFilePage(MmGetKernelAddressSpace(), MemoryArea, &Resources);
*Page = Resources.Page[0];