Skip to content

Commit

Permalink
Merge pull request #1667 from adrianschroeter/nativeonly_worker
Browse files Browse the repository at this point in the history
[backend] add code to filter workers which don't allow personality ch…
  • Loading branch information
adrianschroeter committed Apr 18, 2016
2 parents 8d4a945 + 03bfd8d commit ef193e4
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/backend/BSCando.pm
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,13 @@ package BSCando;
#FIXME 3.0: obsolete the not exiting arm architectures

our %cando = (
'aarch64' => [ 'aarch64_ilp32', 'aarch64', 'armv8l' ], # armv8l is aarch32 (32-bit mode of aarch64), not a full subset of armv7l
'aarch64_ilp32' => [ 'aarch64_ilp32', 'aarch64', 'armv8l' ],
# aarch64_ilp32: is just a software architecure convention
'aarch64' => [ 'aarch64', 'aarch64_ilp32', 'armv8l:linux32', 'armv7l:linux32', 'armv7hl:linux32', 'armv6l:linux32', 'armv6hl:linux32' ],
'aarch64_ilp32' => [ 'aarch64_ilp32', 'aarch64' ],
'armv4l' => [ 'armv4l' ],
'armv5l' => [ 'armv4l', 'armv5l' , 'armv5el' ],
'armv6l' => [ 'armv4l', 'armv5l', 'armv6l' , 'armv5el', 'armv6el' ],
'armv7l' => [ 'armv4l', 'armv5l', 'armv6l', 'armv7l', 'armv5el', 'armv6el', 'armv6hl', 'armv7el', 'armv7hl', 'armv8el' ], # this armv8el is just for MeeGo, it does not exist for real
'armv7l' => [ 'armv4l', 'armv5l', 'armv6l', 'armv7l', 'armv5el', 'armv6el', 'armv6hl', 'armv7el', 'armv7hl', 'armv8el' ], # armv8el is invented by MeeGo, it does not exist for real
'armv8l' => [ 'armv8l' ],

'sh4' => [ 'sh4' ],
Expand Down
1 change: 1 addition & 0 deletions src/backend/BSXML.pm
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,7 @@ our $worker = [
[ 'flag' ],
],
'processors',
'nativeonly', # don't allow usage via the helper script
'memory', # in MBytes
'swap', # in MBytes
'disk', # in MBytes
Expand Down
6 changes: 6 additions & 0 deletions src/backend/bs_dispatch
Original file line number Diff line number Diff line change
Expand Up @@ -1301,6 +1301,12 @@ while (1) {
if ($BSConfig::dispatch_constraint) {
next if !$BSConfig::dispatch_constraint->($info, $workerinfo{$idle});
}
# a helper is needed for personality change?
my $helper;
/^\Q$arch\E:(.*)$/ && ($helper = $1) for @{$BSCando::cando{$harch}};
if ($helper && $workerinfo{$idle} && $workerinfo{$idle}->{hardware} && $workerinfo{$idle}->{hardware}->{nativeonly}) {
next; # worker is not supporting the needed personality change
}
if ($constraints) {
my $ora = oracle($workerinfo{$idle}, $constraints);
next unless defined($ora) && $ora > 0;
Expand Down
8 changes: 8 additions & 0 deletions src/backend/bs_worker
Original file line number Diff line number Diff line change
Expand Up @@ -653,8 +653,16 @@ if (open(FILE, "<", "/proc/cpuinfo")) {
if (/^processor/s) {
$hw->{'processors'} = $hw->{'processors'} + 1;
} elsif (/^flags\s*:\s(.*)$/) {
# classic ix86 and x86_64
my @cpuflags = split(' ', $1);
$hw->{'cpu'}->{'flag'} = \@cpuflags;
} elsif (/^Features\s*:\s(.*)$/) {
# aarch64
my @cpuflags = split(' ', $1);
$hw->{'cpu'}->{'flag'} = \@cpuflags;
} elsif (/^CPU implementer\s*:\s0x43/) {
# aarch64 special case: does not support armvXl instruction set
$hw->{'cpu'}->{'nativeonly'} = {};
} elsif (/^cpu\s*:\sPOWER8/) {
# PowerPC kernel does not provide any flags, but we need to be able
# to distinguish between power7 and 8 at least
Expand Down
1 change: 1 addition & 0 deletions src/backend/testdata/workerinfo/large
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<cpu>
<flag>mmx</flag>
</cpu>
<nativeonly/>
<processors>32</processors>
<memory>6400</memory>
<swap>51200</swap>
Expand Down

0 comments on commit ef193e4

Please sign in to comment.