Author: cgutman Date: Tue Feb 28 04:01:33 2012 New Revision: 55895
URL: http://svn.reactos.org/svn/reactos?rev=55895&view=rev Log: [NEWCC] - 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.
Modified: trunk/reactos/ntoskrnl/cache/copysup.c trunk/reactos/ntoskrnl/cache/mdlsup.c trunk/reactos/ntoskrnl/cache/pinsup.c trunk/reactos/ntoskrnl/cache/section/swapout.c trunk/reactos/ntoskrnl/mm/rmap.c trunk/reactos/ntoskrnl/mm/section.c
Modified: trunk/reactos/ntoskrnl/cache/copysup.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cache/copysup.c?re... ============================================================================== --- trunk/reactos/ntoskrnl/cache/copysup.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/cache/copysup.c [iso-8859-1] Tue Feb 28 04:01:33 2012 @@ -11,7 +11,7 @@ #include <ntoskrnl.h> #include "newcc.h" #include "section/newmm.h" -//#define NDEBUG +#define NDEBUG #include <debug.h>
/* GLOBALS ********************************************************************/
Modified: trunk/reactos/ntoskrnl/cache/mdlsup.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cache/mdlsup.c?rev... ============================================================================== --- trunk/reactos/ntoskrnl/cache/mdlsup.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/cache/mdlsup.c [iso-8859-1] Tue Feb 28 04:01:33 2012 @@ -10,7 +10,7 @@
#include <ntoskrnl.h> #include "newcc.h" -//#define NDEBUG +#define NDEBUG #include <debug.h>
/* GLOBALS ********************************************************************/ @@ -95,7 +95,7 @@ CcMdlReadComplete2(IN PMDL MdlChain, IN PFILE_OBJECT FileObject) { - DPRINT("Not sure\n"); + UNIMPLEMENTED } VOID @@ -128,7 +128,7 @@ IN PLARGE_INTEGER FileOffset, IN PMDL MdlChain) { - DPRINT("Not sure\n"); + UNIMPLEMENTED }
VOID
Modified: trunk/reactos/ntoskrnl/cache/pinsup.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cache/pinsup.c?rev... ============================================================================== --- trunk/reactos/ntoskrnl/cache/pinsup.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/cache/pinsup.c [iso-8859-1] Tue Feb 28 04:01:33 2012 @@ -230,7 +230,7 @@ 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 @@ } else { - DPRINT("Failed to allocate cache segment\n"); + DPRINT1("Failed to allocate cache segment\n"); } return i; }
Modified: trunk/reactos/ntoskrnl/cache/section/swapout.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cache/section/swap... ============================================================================== --- trunk/reactos/ntoskrnl/cache/section/swapout.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/cache/section/swapout.c [iso-8859-1] Tue Feb 28 04:01:33 2012 @@ -328,12 +328,7 @@ 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 @@ 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;
Modified: trunk/reactos/ntoskrnl/mm/rmap.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/rmap.c?rev=5589... ============================================================================== --- trunk/reactos/ntoskrnl/mm/rmap.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/rmap.c [iso-8859-1] Tue Feb 28 04:01:33 2012 @@ -63,7 +63,11 @@ // 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 @@ } 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
Modified: trunk/reactos/ntoskrnl/mm/section.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/section.c?rev=5... ============================================================================== --- trunk/reactos/ntoskrnl/mm/section.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/section.c [iso-8859-1] Tue Feb 28 04:01:33 2012 @@ -1218,7 +1218,7 @@ 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];