[haiku-commits] haiku: hrev46362 - build/jam src/system/kernel/vm

  • From: ingo_weinhold@xxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 13 Nov 2013 01:47:50 +0100 (CET)

hrev46362 adds 3 changesets to branch 'master'
old head: 58114b347649d1a79bffe93baa10814dac078cec
new head: 2b269f2e4788e02c615ab744bf45cc4274dd1f3b
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=2b269f2+%5E58114b3

----------------------------------------------------------------------------

5328a58: AddNewDriversToHaikuImage rule: Support alwaysUpdate flag
  
  * Support alwaysUpdate flag in AddFilesToContainer.
  * Add flags arguments to AddNewDriversTo{Container,HaikuImage} and
    support alwaysUpdate flag.

93fb0ff: vm: lock_memory_etc(): Fix error case
  
  In case something went wrong, call unlock_memory_etc() with the rounded
  base address instead of with the original address. If the original
  address wasn't page aligned, unlock_memory_etc() would otherwise try to
  unlock an additional page.

2b269f2: unlock_memory_etc(): Fix address space reference leak
  
  unlock_memory_etc() is supposed to release the address space reference
  lock_memory_etc() acquired. It didn't do that, though.

                                    [ Ingo Weinhold <ingo_weinhold@xxxxxx> ]

----------------------------------------------------------------------------

2 files changed, 22 insertions(+), 11 deletions(-)
build/jam/ImageRules        | 21 ++++++++++++++-------
src/system/kernel/vm/vm.cpp | 12 ++++++++----

############################################################################

Commit:      5328a58455d656888e5901220dd26526c9189940
URL:         http://cgit.haiku-os.org/haiku/commit/?id=5328a58
Author:      Ingo Weinhold <ingo_weinhold@xxxxxx>
Date:        Wed Nov 13 00:42:04 2013 UTC

AddNewDriversToHaikuImage rule: Support alwaysUpdate flag

* Support alwaysUpdate flag in AddFilesToContainer.
* Add flags arguments to AddNewDriversTo{Container,HaikuImage} and
  support alwaysUpdate flag.

----------------------------------------------------------------------------

diff --git a/build/jam/ImageRules b/build/jam/ImageRules
index a314cb6..a1b5b04 100644
--- a/build/jam/ImageRules
+++ b/build/jam/ImageRules
@@ -197,6 +197,8 @@ rule AddFilesToContainer container : directoryTokens : 
targets : destName
        # Supported flags:
        #       computeName - <destName> is the name of a shell 
command/function that
        #               computes the destination name.
+       #       alwaysUpdate - When only updating the container, always also 
update the
+       #               given targets.
 
        local containerGrist = [ on $(container) return 
$(HAIKU_CONTAINER_GRIST) ] ;
        local systemDirTokens
@@ -207,7 +209,8 @@ rule AddFilesToContainer container : directoryTokens : 
targets : destName
        # If the image shall only be updated, we filter out all targets not 
marked
        # accordingly.
        if [ on $(container) return $(HAIKU_CONTAINER_UPDATE_ONLY) ]
-               && ! [ IncludeAllTargetsInContainer $(container) ] {
+               && ! [ IncludeAllTargetsInContainer $(container) ]
+               && ! alwaysUpdate in $(flags) {
                local filterVar
                        = [ on $(container) return 
$(HAIKU_INCLUDE_IN_CONTAINER_VAR) ] ;
                if $(filterVar) {
@@ -499,10 +502,14 @@ rule AddDriversToContainer container : 
relativeDirectoryTokens : targets
 }
 
 rule AddNewDriversToContainer container : relativeDirectoryTokens
-       : targets
+       : targets : flags
 {
-       # AddNewDriversToContainer <container> : <directory> : <targets> ;
+       # AddNewDriversToContainer <container> : <directory> : <targets> : 
<flags> ;
        #
+       # Supported flags:
+       #       alwaysUpdate - When only updating the container, always also 
update the
+       #               given targets.
+
        local systemDirTokens
                = [ on $(container) return $(HAIKU_CONTAINER_SYSTEM_DIR_TOKENS) 
] ;
        local directoryTokens = $(systemDirTokens) add-ons kernel drivers
@@ -511,7 +518,7 @@ rule AddNewDriversToContainer container : 
relativeDirectoryTokens
        targets = [ FFilterByBuildFeatures $(targets) ] ;
 
        AddFilesToContainer $(container) : $(directoryTokens)
-               : $(targets) ;
+               : $(targets) : : $(flags) ;
 }
 
 rule AddBootModuleSymlinksToContainer container : targets
@@ -1001,12 +1008,12 @@ rule AddDriversToHaikuImage relativeDirectoryTokens : 
targets
                : $(relativeDirectoryTokens) : $(targets) ;
 }
 
-rule AddNewDriversToHaikuImage relativeDirectoryTokens : targets
+rule AddNewDriversToHaikuImage relativeDirectoryTokens : targets : flags
 {
-       # AddNewDriversToHaikuImage <relative directory> : <targets> ;
+       # AddNewDriversToHaikuImage <relative directory> : <targets> : <flags> ;
 
        AddNewDriversToContainer $(HAIKU_IMAGE_CONTAINER_NAME)
-               : $(relativeDirectoryTokens) : $(targets) ;
+               : $(relativeDirectoryTokens) : $(targets) : $(flags) ;
 }
 
 rule AddBootModuleSymlinksToHaikuImage targets

############################################################################

Commit:      93fb0ff0565694c4cfd752e5550680bf86aeb37e
URL:         http://cgit.haiku-os.org/haiku/commit/?id=93fb0ff
Author:      Ingo Weinhold <ingo_weinhold@xxxxxx>
Date:        Wed Nov 13 00:45:14 2013 UTC

vm: lock_memory_etc(): Fix error case

In case something went wrong, call unlock_memory_etc() with the rounded
base address instead of with the original address. If the original
address wasn't page aligned, unlock_memory_etc() would otherwise try to
unlock an additional page.

----------------------------------------------------------------------------

diff --git a/src/system/kernel/vm/vm.cpp b/src/system/kernel/vm/vm.cpp
index 7afa856..0fec8a2 100644
--- a/src/system/kernel/vm/vm.cpp
+++ b/src/system/kernel/vm/vm.cpp
@@ -5459,8 +5459,8 @@ lock_memory_etc(team_id team, void* address, size_t 
numBytes, uint32 flags)
                // even if not a single page was wired, unlock_memory_etc() is 
called
                // to put the address space reference.
                addressSpaceLocker.Unlock();
-               unlock_memory_etc(team, (void*)address, nextAddress - 
lockBaseAddress,
-                       flags);
+               unlock_memory_etc(team, (void*)lockBaseAddress,
+                       nextAddress - lockBaseAddress, flags);
        }
 
        return error;

############################################################################

Revision:    hrev46362
Commit:      2b269f2e4788e02c615ab744bf45cc4274dd1f3b
URL:         http://cgit.haiku-os.org/haiku/commit/?id=2b269f2
Author:      Ingo Weinhold <ingo_weinhold@xxxxxx>
Date:        Wed Nov 13 00:47:08 2013 UTC

unlock_memory_etc(): Fix address space reference leak

unlock_memory_etc() is supposed to release the address space reference
lock_memory_etc() acquired. It didn't do that, though.

----------------------------------------------------------------------------

diff --git a/src/system/kernel/vm/vm.cpp b/src/system/kernel/vm/vm.cpp
index 0fec8a2..c9ebda4 100644
--- a/src/system/kernel/vm/vm.cpp
+++ b/src/system/kernel/vm/vm.cpp
@@ -5352,6 +5352,8 @@ lock_memory_etc(team_id team, void* address, size_t 
numBytes, uint32 flags)
                return B_ERROR;
 
        AddressSpaceReadLocker addressSpaceLocker(addressSpace, true);
+               // We get a new address space reference here. The one we got 
above will
+               // be freed by unlock_memory_etc().
 
        VMTranslationMap* map = addressSpace->TranslationMap();
        status_t error = B_OK;
@@ -5508,7 +5510,9 @@ unlock_memory_etc(team_id team, void* address, size_t 
numBytes, uint32 flags)
        if (addressSpace == NULL)
                return B_ERROR;
 
-       AddressSpaceReadLocker addressSpaceLocker(addressSpace, true);
+       AddressSpaceReadLocker addressSpaceLocker(addressSpace, false);
+               // Take over the address space reference. We don't unlock until 
we're
+               // done.
 
        VMTranslationMap* map = addressSpace->TranslationMap();
        status_t error = B_OK;
@@ -5594,7 +5598,7 @@ unlock_memory_etc(team_id team, void* address, size_t 
numBytes, uint32 flags)
                        break;
        }
 
-       // get rid of the address space reference
+       // get rid of the address space reference lock_memory_etc() acquired
        addressSpace->Put();
 
        return error;


Other related posts:

  • » [haiku-commits] haiku: hrev46362 - build/jam src/system/kernel/vm - ingo_weinhold