Browse Source

StarlingX open source release updates

Signed-off-by: Dean Troyer <dtroyer@gmail.com>
changes/57/573857/1
Dean Troyer 3 years ago
parent
commit
9b95aa0a35
  1. 12
      CONTRIBUTORS.wrs
  2. 202
      LICENSE
  3. 5
      README.rst
  4. 6
      compute-huge/.gitignore
  5. 13
      compute-huge/PKG-INFO
  6. 8
      compute-huge/bin/topology
  7. 4
      compute-huge/centos/build_srpm.data
  8. 85
      compute-huge/centos/compute-huge.spec
  9. 202
      compute-huge/compute-huge/LICENSE
  10. 62
      compute-huge/compute-huge/affine-interrupts.sh
  11. 170
      compute-huge/compute-huge/affine-platform.sh
  12. 14
      compute-huge/compute-huge/affine-platform.sh.service
  13. 24
      compute-huge/compute-huge/compute-huge-goenabled.sh
  14. 1512
      compute-huge/compute-huge/compute-huge.sh
  15. 14
      compute-huge/compute-huge/compute-huge.sh.service
  16. 0
      compute-huge/compute-huge/compute_hugepages_total.conf
  17. 78
      compute-huge/compute-huge/compute_reserved.conf
  18. 399
      compute-huge/compute-huge/cpumap_functions.sh
  19. 244
      compute-huge/compute-huge/cpumap_functions_unit_test.sh
  20. 49
      compute-huge/compute-huge/log_functions.sh
  21. 27
      compute-huge/compute-huge/ps-sched.sh
  22. 90
      compute-huge/compute-huge/set-cpu-wakeup-latency.sh
  23. 330
      compute-huge/compute-huge/task_affinity_functions.sh
  24. 241
      compute-huge/compute-huge/topology.py
  25. 6
      computeconfig/.gitignore
  26. 13
      computeconfig/PKG-INFO
  27. 2
      computeconfig/centos/build_srpm.data
  28. 99
      computeconfig/centos/computeconfig.spec
  29. 202
      computeconfig/computeconfig/LICENSE
  30. 383
      computeconfig/computeconfig/compute_config
  31. 220
      computeconfig/computeconfig/compute_services
  32. 21
      computeconfig/computeconfig/computeconfig-combined.service
  33. 22
      computeconfig/computeconfig/computeconfig.service
  34. 22
      computeconfig/computeconfig/config_goenabled_check.sh
  35. 13
      config-gate/PKG-INFO
  36. 2
      config-gate/centos/build_srpm.data
  37. 59
      config-gate/centos/config-gate.spec
  38. 202
      config-gate/files/LICENSE
  39. 15
      config-gate/files/compute-config-gate.service
  40. 16
      config-gate/files/config.service
  41. 20
      config-gate/files/wait_for_compute_config_init.sh
  42. 36
      config-gate/files/wait_for_config_init.sh
  43. 6
      configutilities/.gitignore
  44. 13
      configutilities/PKG-INFO
  45. 3
      configutilities/centos/build_srpm.data
  46. 64
      configutilities/centos/configutilities.spec
  47. 202
      configutilities/configutilities/LICENSE
  48. 202
      configutilities/configutilities/configutilities/LICENSE
  49. 76
      configutilities/configutilities/configutilities/README
  50. 20
      configutilities/configutilities/configutilities/__init__.py
  51. 5
      configutilities/configutilities/configutilities/common/__init__.py
  52. 381
      configutilities/configutilities/configutilities/common/configobjects.py
  53. 98
      configutilities/configutilities/configutilities/common/crypt.py
  54. 25
      configutilities/configutilities/configutilities/common/exceptions.py
  55. 295
      configutilities/configutilities/configutilities/common/guicomponents.py
  56. 308
      configutilities/configutilities/configutilities/common/utils.py
  57. 1139
      configutilities/configutilities/configutilities/common/validator.py
  58. 37
      configutilities/configutilities/configutilities/common/wrs_ico.py
  59. 100
      configutilities/configutilities/configutilities/config_validator.py
  60. 1457
      configutilities/configutilities/configutilities/configfiletool.py
  61. 114
      configutilities/configutilities/configutilities/configgui.py
  62. 510
      configutilities/configutilities/configutilities/hostfiletool.py
  63. 29
      configutilities/configutilities/configutilities/setup.py
  64. BIN
      configutilities/configutilities/favicon.ico
  65. 26
      configutilities/configutilities/setup.py
  66. 22
      configutilities/configutilities/tox.ini
  67. 6
      controllerconfig/.gitignore
  68. 13
      controllerconfig/PKG-INFO
  69. 2
      controllerconfig/centos/build_srpm.data
  70. 86
      controllerconfig/centos/controllerconfig.spec
  71. 7
      controllerconfig/controllerconfig/.coveragerc
  72. 5
      controllerconfig/controllerconfig/.gitignore
  73. 8
      controllerconfig/controllerconfig/.testr.conf
  74. 202
      controllerconfig/controllerconfig/LICENSE
  75. 5
      controllerconfig/controllerconfig/controllerconfig/__init__.py
  76. 1895
      controllerconfig/controllerconfig/controllerconfig/backup_restore.py
  77. 717
      controllerconfig/controllerconfig/controllerconfig/clone.py
  78. 5
      controllerconfig/controllerconfig/controllerconfig/common/__init__.py
  79. 93
      controllerconfig/controllerconfig/controllerconfig/common/constants.py
  80. 44
      controllerconfig/controllerconfig/controllerconfig/common/dcmanager.py
  81. 51
      controllerconfig/controllerconfig/controllerconfig/common/exceptions.py
  82. 246
      controllerconfig/controllerconfig/controllerconfig/common/keystone.py
  83. 49
      controllerconfig/controllerconfig/controllerconfig/common/log.py
  84. 336
      controllerconfig/controllerconfig/controllerconfig/common/rest_api_utils.py
  85. 159
      controllerconfig/controllerconfig/controllerconfig/config_management.py
  86. 4643
      controllerconfig/controllerconfig/controllerconfig/configassistant.py
  87. 284
      controllerconfig/controllerconfig/controllerconfig/openstack.py
  88. 31
      controllerconfig/controllerconfig/controllerconfig/progress.py
  89. 732
      controllerconfig/controllerconfig/controllerconfig/regionconfig.py
  90. 575
      controllerconfig/controllerconfig/controllerconfig/sysinv_api.py
  91. 500
      controllerconfig/controllerconfig/controllerconfig/systemconfig.py
  92. 0
      controllerconfig/controllerconfig/controllerconfig/tests/__init__.py
  93. 126
      controllerconfig/controllerconfig/controllerconfig/tests/files/TiS_region_config.share.keystoneonly
  94. 122
      controllerconfig/controllerconfig/controllerconfig/tests/files/TiS_region_config.share.keystoneonly.result
  95. 118
      controllerconfig/controllerconfig/controllerconfig/tests/files/TiS_region_config.shareall
  96. 123
      controllerconfig/controllerconfig/controllerconfig/tests/files/TiS_region_config.shareall.result
  97. 1
      controllerconfig/controllerconfig/controllerconfig/tests/files/certificate.pem
  98. 78
      controllerconfig/controllerconfig/controllerconfig/tests/files/cgcs_config.ceph
  99. 84
      controllerconfig/controllerconfig/controllerconfig/tests/files/cgcs_config.default
  100. 84
      controllerconfig/controllerconfig/controllerconfig/tests/files/cgcs_config.ipv6

12
CONTRIBUTORS.wrs

@ -0,0 +1,12 @@
The following contributors from Wind River have developed the seed code in this
repository. We look forward to community collaboration and contributions for
additional features, enhancements and refactoring.
Contributors:
=============
Bart Wensley <Barton.Wensley@windriver.com>
John Kung <John.Kung@windriver.com>
Don Penney <Don.Penney@windriver.com>
Matt Peters <Matt.Peters@windriver.com>
Tao Liu <Tao.Liu@windriver.com>
David Sullivan <David.Sullivan@windriver.com>

202
LICENSE

@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

5
README.rst

@ -0,0 +1,5 @@
==========
stx-config
==========
StarlingX Configuration Management

6
compute-huge/.gitignore

@ -0,0 +1,6 @@
!.distro
.distro/centos7/rpmbuild/RPMS
.distro/centos7/rpmbuild/SRPMS
.distro/centos7/rpmbuild/BUILD
.distro/centos7/rpmbuild/BUILDROOT
.distro/centos7/rpmbuild/SOURCES/compute-huge*tar.gz

13
compute-huge/PKG-INFO

@ -0,0 +1,13 @@
Metadata-Version: 1.1
Name: compute-huge
Version: 1.0
Summary: Initial compute node hugepages and reserved cpus configuration
Home-page:
Author: Windriver
Author-email: info@windriver.com
License: Apache-2.0
Description: Initial compute node hugepages and reserved cpus configuration
Platform: UNKNOWN

8
compute-huge/bin/topology

@ -0,0 +1,8 @@
#!/bin/bash
#
# Copyright (c) 2013-2014 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
python /usr/bin/topology.pyc

4
compute-huge/centos/build_srpm.data

@ -0,0 +1,4 @@
SRC_DIR="compute-huge"
COPY_LIST_TO_TAR="bin"
COPY_LIST="$SRC_DIR/LICENSE"
TIS_PATCH_VER=10

85
compute-huge/centos/compute-huge.spec

@ -0,0 +1,85 @@
Summary: Initial compute node hugepages and reserved cpus configuration
Name: compute-huge
Version: 1.0
Release: %{tis_patch_ver}%{?_tis_dist}
License: Apache-2.0
Group: base
Packager: Wind River <info@windriver.com>
URL: unknown
Source0: %{name}-%{version}.tar.gz
Source1: LICENSE
BuildRequires: systemd-devel
Requires: systemd
Requires: python
Requires: /bin/systemctl
%description
Initial compute node hugepages and reserved cpus configuration
%define local_bindir /usr/bin/
%define local_etc_initd /etc/init.d/
%define local_etc_nova /etc/nova/
%define local_etc_goenabledd /etc/goenabled.d/
%define debug_package %{nil}
%prep
%setup
%build
%{__python} -m compileall topology.py
%install
# compute init scripts
install -d -m 755 %{buildroot}%{local_etc_initd}
install -p -D -m 755 affine-platform.sh %{buildroot}%{local_etc_initd}/affine-platform.sh
install -p -D -m 755 compute-huge.sh %{buildroot}%{local_etc_initd}/compute-huge.sh
# utility scripts
install -p -D -m 755 cpumap_functions.sh %{buildroot}%{local_etc_initd}/cpumap_functions.sh
install -p -D -m 755 task_affinity_functions.sh %{buildroot}%{local_etc_initd}/task_affinity_functions.sh
install -p -D -m 755 log_functions.sh %{buildroot}%{local_etc_initd}/log_functions.sh
install -d -m 755 %{buildroot}%{local_bindir}
install -p -D -m 755 ps-sched.sh %{buildroot}%{local_bindir}/ps-sched.sh
# TODO: Only ship pyc ?
install -p -D -m 755 topology.py %{buildroot}%{local_bindir}/topology.py
install -p -D -m 755 topology.pyc %{buildroot}%{local_bindir}/topology.pyc
install -p -D -m 755 affine-interrupts.sh %{buildroot}%{local_bindir}/affine-interrupts.sh
install -p -D -m 755 set-cpu-wakeup-latency.sh %{buildroot}%{local_bindir}/set-cpu-wakeup-latency.sh
install -p -D -m 755 bin/topology %{buildroot}%{local_bindir}/topology
# compute config data
install -d -m 755 %{buildroot}%{local_etc_nova}
install -p -D -m 755 compute_reserved.conf %{buildroot}%{local_etc_nova}/compute_reserved.conf
install -p -D -m 755 compute_hugepages_total.conf %{buildroot}%{local_etc_nova}/compute_hugepages_total.conf
# goenabled check
install -d -m 755 %{buildroot}%{local_etc_goenabledd}
install -p -D -m 755 compute-huge-goenabled.sh %{buildroot}%{local_etc_goenabledd}/compute-huge-goenabled.sh
# systemd services
install -d -m 755 %{buildroot}%{_unitdir}
install -p -D -m 664 affine-platform.sh.service %{buildroot}%{_unitdir}/affine-platform.sh.service
install -p -D -m 664 compute-huge.sh.service %{buildroot}%{_unitdir}/compute-huge.sh.service
%post
/bin/systemctl enable affine-platform.sh.service >/dev/null 2>&1
/bin/systemctl enable compute-huge.sh.service >/dev/null 2>&1
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)
%{local_bindir}/*
%{local_etc_initd}/*
%{local_etc_goenabledd}/*
%config(noreplace) %{local_etc_nova}/compute_reserved.conf
%config(noreplace) %{local_etc_nova}/compute_hugepages_total.conf
%{_unitdir}/compute-huge.sh.service
%{_unitdir}/affine-platform.sh.service

202
compute-huge/compute-huge/LICENSE

@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

62
compute-huge/compute-huge/affine-interrupts.sh

@ -0,0 +1,62 @@
#!/bin/bash
################################################################################
# Copyright (c) 2015-2016 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
################################################################################
#
# Purpose:
# Affine the interface IRQ to specified cpulist.
#
# Usage: /usr/bin/affine-interrupts.sh interface cpulist
#
# Define minimal path
PATH=/bin:/usr/bin:/usr/local/bin
# logger setup
WHOAMI=`basename $0`
LOG_FACILITY=user
LOG_PRIORITY=info
TMPLOG=/tmp/${WHOAMI}.log
# LOG() - generates log and puts in temporary file
function LOG()
{
logger -t "${0##*/}[$$]" -p ${LOG_FACILITY}.${LOG_PRIORITY} "$@"
echo "${0##*/}[$$]" "$@" >> ${TMPLOG}
}
function INFO()
{
MSG="INFO"
LOG "${MSG} $@"
}
function ERROR()
{
MSG="ERROR"
LOG "${MSG} $@"
}
if [ "$#" -ne 2 ]; then
ERROR "Interface name and cpulist are required"
exit 1
fi
interface=$1
cpulist=$2
# Find PCI device matching interface, keep last matching device name
dev=$(find /sys/devices -name "${interface}" | \
perl -ne 'print $1 if /([[:xdigit:]]{4}:[[:xdigit:]]{2}:[[:xdigit:]]{2}\.[[:xdigit:]])\/[[:alpha:]]/;')
# Obtain all IRQs for this device
irq=$(cat /sys/bus/pci/devices/${dev}/irq 2>/dev/null)
msi_irqs=$(ls /sys/bus/pci/devices/${dev}/msi_irqs 2>/dev/null | xargs)
INFO $LINENO "affine ${interface} (dev:${dev} irq:${irq} msi_irqs:${msi_irqs}) with cpus (${cpulist})"
for i in $(echo "${irq} ${msi_irqs}"); do echo $i; done | \
xargs --no-run-if-empty -i{} \
/bin/bash -c "[[ -e /proc/irq/{} ]] && echo ${cpulist} > /proc/irq/{}/smp_affinity_list" 2>/dev/null
exit 0

170
compute-huge/compute-huge/affine-platform.sh

@ -0,0 +1,170 @@
#!/bin/bash
################################################################################
# Copyright (c) 2013 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
################################################################################
# Define minimal path
PATH=/bin:/usr/bin:/usr/local/bin
LOG_FUNCTIONS=${LOG_FUNCTIONS:-"/etc/init.d/log_functions.sh"}
CPUMAP_FUNCTIONS=${CPUMAP_FUNCTIONS:-"/etc/init.d/cpumap_functions.sh"}
TASK_AFFINITY_FUNCTIONS=${TASK_AFFINITY_FUNCTIONS:-"/etc/init.d/task_affinity_functions.sh"}
source /etc/init.d/functions
[[ -e ${LOG_FUNCTIONS} ]] && source ${LOG_FUNCTIONS}
[[ -e ${CPUMAP_FUNCTIONS} ]] && source ${CPUMAP_FUNCTIONS}
[[ -e ${TASK_AFFINITY_FUNCTIONS} ]] && source ${TASK_AFFINITY_FUNCTIONS}
linkname=$(readlink -n -f $0)
scriptname=$(basename $linkname)
# Enable debug logs
LOG_DEBUG=1
. /etc/platform/platform.conf
################################################################################
# Affine all running tasks to the CPULIST provided in the first parameter.
################################################################################
function affine_tasks
{
local CPULIST=$1
local PIDLIST
local RET=0
# Affine non-kernel-thread tasks (excluded [kthreadd] and its children) to all available
# cores. They will be reaffined to platform cores later on as part of nova-compute
# launch.
log_debug "Affining all tasks to all available CPUs..."
affine_tasks_to_all_cores
RET=$?
if [ $RET -ne 0 ]; then
log_error "Some tasks failed to be affined to all cores."
fi
# Get number of logical cpus
N_CPUS=$(cat /proc/cpuinfo 2>/dev/null | \
awk '/^[pP]rocessor/ { n +=1 } END { print (n>0) ? n : 1}')
# Calculate platform cores cpumap
PLATFORM_COREMASK=$(cpulist_to_cpumap ${CPULIST} ${N_CPUS})
# Set default IRQ affinity
echo ${PLATFORM_COREMASK} > /proc/irq/default_smp_affinity
# Affine all PCI/MSI interrupts to platform cores; this overrides
# irqaffinity boot arg, since that does not handle IRQs for PCI devices
# on numa nodes that do not intersect with platform cores.
PCIDEVS=/sys/bus/pci/devices
declare -a irqs=()
irqs+=($(cat ${PCIDEVS}/*/irq 2>/dev/null | xargs))
irqs+=($(ls ${PCIDEVS}/*/msi_irqs 2>/dev/null | grep -E '^[0-9]+$' | xargs))
# flatten list of irqs, removing duplicates
irqs=($(echo ${irqs[@]} | tr ' ' '\n' | sort -nu))
log_debug "Affining all PCI/MSI irqs(${irqs[@]}) with cpus (${CPULIST})"
for i in ${irqs[@]}; do
/bin/bash -c "[[ -e /proc/irq/${i} ]] && echo ${CPULIST} > /proc/irq/${i}/smp_affinity_list" 2>/dev/null
done
if [[ "$subfunction" == *"compute,lowlatency" ]]; then
# Affine work queues to platform cores
echo ${PLATFORM_COREMASK} > /sys/devices/virtual/workqueue/cpumask
echo ${PLATFORM_COREMASK} > /sys/bus/workqueue/devices/writeback/cpumask
# On low latency compute reassign the per cpu threads rcuc, ksoftirq,
# ktimersoftd to FIFO along with the specified priority
PIDLIST=$( ps -e -p 2 |grep rcuc | awk '{ print $1; }')
for PID in ${PIDLIST[@]}
do
chrt -p -f 4 ${PID} 2>/dev/null
done
PIDLIST=$( ps -e -p 2 |grep ksoftirq | awk '{ print $1; }')
for PID in ${PIDLIST[@]}
do
chrt -p -f 2 ${PID} 2>/dev/null
done
PIDLIST=$( ps -e -p 2 |grep ktimersoftd | awk '{ print $1; }')
for PID in ${PIDLIST[@]}
do
chrt -p -f 3 ${PID} 2>/dev/null
done
fi
return 0
}
################################################################################
# Start Action
################################################################################
function start
{
local RET=0
echo -n "Starting ${scriptname}: "
## Check whether we are root (need root for taskset)
if [ $UID -ne 0 ]; then
log_error "require root or sudo"
RET=1
return ${RET}
fi
## Define platform cpulist to be thread siblings of core 0
PLATFORM_CPULIST=$(get_platform_cpu_list)
# Affine all tasks to platform cpulist
affine_tasks ${PLATFORM_CPULIST}
RET=$?
if [ ${RET} -ne 0 ]; then
log_error "Failed to affine tasks ${PLATFORM_CPULIST}, rc=${RET}"
return ${RET}
fi
print_status ${RET}
return ${RET}
}
################################################################################
# Stop Action - don't do anything
################################################################################
function stop
{
local RET=0
echo -n "Stopping ${scriptname}: "
print_status ${RET}
return ${RET}
}
################################################################################
# Restart Action
################################################################################
function restart() {
stop
start
}
################################################################################
# Main Entry
#
################################################################################
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
restart
;;
status)
echo -n "OK"
;;
*)
echo $"Usage: $0 {start|stop|restart|reload|status}"
exit 1
esac
exit $?

14
compute-huge/compute-huge/affine-platform.sh.service

@ -0,0 +1,14 @@
[Unit]
Description=Titanium Cloud Affine Platform
After=syslog.service network.service dbus.service sw-patch.service
Before=compute-huge.sh.service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/etc/init.d/affine-platform.sh start
ExecStop=/etc/init.d/affine-platform.sh stop
ExecReload=/etc/init.d/affine-platform.sh restart
[Install]
WantedBy=multi-user.target

24
compute-huge/compute-huge/compute-huge-goenabled.sh

@ -0,0 +1,24 @@
#!/bin/bash
#
# Copyright (c) 2014,2016 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
#
# compute-huge.sh "goenabled" check.
#
# If a problem was detected during configuration of huge pages and compute
# resources then the board is not allowed to enable.
#
COMPUTE_HUGE_GOENABLED="/var/run/compute_huge_goenabled"
source "/etc/init.d/log_functions.sh"
source "/usr/bin/tsconfig"
if [ -e ${VOLATILE_COMPUTE_CONFIG_COMPLETE} -a ! -f ${COMPUTE_HUGE_GOENABLED} ]; then
log_error "compute-huge.sh CPU configuration check failed. Failing goenabled check."
exit 1
fi
exit 0

1512
compute-huge/compute-huge/compute-huge.sh
File diff suppressed because it is too large
View File

14
compute-huge/compute-huge/compute-huge.sh.service

@ -0,0 +1,14 @@
[Unit]
Description=Titanium Cloud Compute Huge
After=syslog.service network.service affine-platform.sh.service sw-patch.service
Before=sshd.service sw-patch-agent.service sysinv-agent.service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/etc/init.d/compute-huge.sh start
ExecStop=/etc/init.d/compute-huge.sh stop
ExecReload=/etc/init.d/compute-huge.sh restart
[Install]
WantedBy=multi-user.target

0
compute-huge/compute-huge/compute_hugepages_total.conf

78
compute-huge/compute-huge/compute_reserved.conf

@ -0,0 +1,78 @@
################################################################################
# Copyright (c) 2013-2015 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
################################################################################
# COMPUTE Node configuration parameters for reserved memory and physical cores
# used by Base software and VSWITCH. These are resources that libvirt cannot use.
#
################################################################################
#
# Enable compute-huge.sh console debug logs (uncomment)
#
################################################################################
LOG_DEBUG=1
################################################################################
#
# List of logical CPU instances available in the system. This value is used
# for auditing purposes so that the current configuration can be checked for
# validity against the actual number of logical CPU instances in the system.
#
################################################################################
COMPUTE_CPU_LIST="0-1"
################################################################################
#
# List of Base software resources reserved per numa node. Each array element
# consists of a 3-tuple formatted as: <node>:<memory>:<cores>.
#
# Example: To reserve 1500MB and 1 core on NUMA node0, and 1500MB and 1 core
# on NUMA node1, the variable must be specified as follows.
# COMPUTE_BASE_MEMORY=("node0:1500MB:1" "node1:1500MB:1")
#
################################################################################
COMPUTE_BASE_RESERVED=("node0:8000MB:1" "node1:2000MB:0" "node2:2000MB:0" "node3:2000MB:0")
################################################################################
#
# List of HugeTLB memory descriptors to configure. Each array element
# consists of a 3-tuple descriptor formatted as: <node>:<pgsize>:<pgcount>.
# The NUMA node specified must exist and the HugeTLB pagesize must be a valid
# value such as 2048kB or 1048576kB.
#
# For example, to request 256 x 2MB HugeTLB pages on NUMA node0 and node1 the
# variable must be specified as follows.
# COMPUTE_VSWITCH_MEMORY=("node0:2048kB:256" "node1:2048kB:256")
#
################################################################################
COMPUTE_VSWITCH_MEMORY=("node0:1048576kB:1" "node1:1048576kB:1" "node2:1048576kB:1" "node3:1048576kB:1")
################################################################################
#
# List of VSWITCH physical cores reserved for VSWITCH applications.
#
# Example: To reserve 2 cores on NUMA node0, and 2 cores on NUMA node1, the
# variable must be specified as follows.
# COMPUTE_VSWITCH_CORES=("node0:2" "node1:2")
#
################################################################################
COMPUTE_VSWITCH_CORES=("node0:2" "node1:0" "node2:0" "node3:0")
################################################################################
#
# List of HugeTLB memory descriptors to configure for Libvirt. Each array element
# consists of a 3-tuple descriptor formatted as: <node>:<pgsize>:<pgcount>.
# The NUMA node specified must exist and the HugeTLB pagesize must be a valid
# value such as 2048kB or 1048576kB.
#
# For example, to request 256 x 2MB HugeTLB pages on NUMA node0 and node1 the
# variable must be specified as follows.
# COMPUTE_VM_MEMORY_2M=("node0:2048kB:256" "node1:2048kB:256")
#
################################################################################
COMPUTE_VM_MEMORY_2M=()
COMPUTE_VM_MEMORY_1G=()

399
compute-huge/compute-huge/cpumap_functions.sh

@ -0,0 +1,399 @@
#!/bin/bash
################################################################################
# Copyright (c) 2013-2015 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
################################################################################
source /etc/platform/platform.conf
################################################################################
# Utility function to expand a sequence of numbers (e.g., 0-7,16-23)
################################################################################
function expand_sequence
{
SEQUENCE=(${1//,/ })
DELIMITER=${2:-","}
LIST=
for entry in ${SEQUENCE[@]}
do
range=(${entry/-/ })
a=${range[0]}
b=${range[1]:-${range[0]}}
for i in $(seq $a $b)
do
LIST="${LIST}${DELIMITER}${i}"
done
done
echo ${LIST:1}
}
################################################################################
# Append a string to comma separated list string
################################################################################
function append_list() {
local PUSH=$1
local LIST=$2
if [ -z "${LIST}" ]
then
LIST=${PUSH}
else
LIST="${LIST},${PUSH}"
fi
echo ${LIST}
return 0
}
################################################################################
# Condense a sequence of numbers to a list of ranges (e.g, 7-12,15-16)
################################################################################
function condense_sequence() {
local arr=( $(printf '%s\n' "$@" | sort -n) )
local first
local last
local cpulist=""
for ((i=0; i < ${#arr[@]}; i++))
do
num=${arr[$i]}
if [[ -z $first ]]; then
first=$num
last=$num
continue
fi
if [[ num -ne $((last + 1)) ]]; then
if [[ first -eq last ]]; then
cpulist=$(append_list ${first} ${cpulist})
else
cpulist=$(append_list "${first}-${last}" ${cpulist})
fi
first=$num
last=$num
else
: $((last++))
fi
done
if [[ first -eq last ]]; then
cpulist=$(append_list ${first} ${cpulist})
else
cpulist=$(append_list "${first}-${last}" ${cpulist})
fi
echo "$cpulist"
}
################################################################################
# Converts a CPULIST (e.g., 0-7,16-23) to a CPUMAP (e.g., 0x00FF00FF). The
# CPU map is returned as a string representation of a large hexidecimal
# number but without the leading "0x" characters.
#
################################################################################
function cpulist_to_cpumap
{
local CPULIST=$1
local NR_CPUS=$2
local CPUMAP=0
local CPUID=0
if [ -z "${NR_CPUS}" ] || [ ${NR_CPUS} -eq 0 ]
then
echo 0
return 0
fi
for CPUID in $(expand_sequence $CPULIST " ")
do
if [ "${CPUID}" -lt "${NR_CPUS}" ]; then
CPUMAP=$(echo "${CPUMAP} + (2^${CPUID})" | bc -l)
fi
done
echo "obase=16;ibase=10;${CPUMAP}" | bc -l
return 0
}
################################################################################
# Converts a CPUMAP (e.g., 0x00FF00FF) to a CPULIST (e.g., 0-7,16-23). The
# CPUMAP is expected in hexidecimal (base=10) form without the leading "0x"
# characters.
#
################################################################################
function cpumap_to_cpulist
{
local CPUMAP=$(echo "obase=10;ibase=16;$1" | bc -l)
local NR_CPUS=$2
local list=()
local cpulist=""
for((i=0; i < NR_CPUS; i++))
do
## Since 'bc' does not support any bitwise operators this expression:
## if (CPUMAP & (1 << CPUID))
## has to be rewritten like this:
## if (CPUMAP % (2**(CPUID+1)) > ((2**(CPUID)) - 1))
##
ISSET=$(echo "scale=0; (${CPUMAP} % 2^(${i}+1)) > (2^${i})-1" | bc -l)
if [ "${ISSET}" -ne 0 ]
then
list+=($i)
fi
done
cpulist=$(condense_sequence ${list[@]} )
echo "$cpulist"
return 0
}
################################################################################
# Bitwise NOT of a hexidecimal representation of a CPULIST. The value is
# returned as a hexidecimal value but without the leading "0x" characters
#
################################################################################
function invert_cpumap
{
local CPUMAP=$(echo "obase=10;ibase=16;$1" | bc -l)
local NR_CPUS=$2
local INVERSE_CPUMAP=0
for CPUID in $(seq 0 $((NR_CPUS - 1)));
do
## See comment in previous function
ISSET=$(echo "scale=0; (${CPUMAP} % 2^(${CPUID}+1)) > (2^${CPUID})-1" | bc -l)
if [ "${ISSET}" -eq 1 ]; then
continue
fi
INVERSE_CPUMAP=$(echo "${INVERSE_CPUMAP} + (2^${CPUID})" | bc -l)
done
echo "obase=16;ibase=10;${INVERSE_CPUMAP}" | bc -l
return 0
}
################################################################################
# Builds the complement representation of a CPULIST
#
################################################################################
function invert_cpulist
{
local CPULIST=$1
local NR_CPUS=$2
local CPUMAP=$(cpulist_to_cpumap ${CPULIST} ${NR_CPUS})
cpumap_to_cpulist $(invert_cpumap ${CPUMAP} ${NR_CPUS}) ${NR_CPUS}
return 0
}
################################################################################
# in_list() - check whether item is contained in list
# param: item
# param: list (i.e. 0-3,8-11)
# returns: 0 - item is contained in list;
# 1 - item is not contained in list
#
################################################################################
function in_list() {
local item="$1"
local list="$2"
# expand list format 0-3,8-11 to a full sequence {0..3} {8..11}
local exp_list=$(echo ${list} | \
sed -e 's#,# #g' -e 's#\([0-9]*\)-\([0-9]*\)#{\1\.\.\2}#g')
local e
for e in $(eval echo ${exp_list})
do
[[ "$e" == "$item" ]] && return 0
done
return 1
}
################################################################################
# any_in_list() - check if any item of sublist is contained in list
# param: sublist
# param: list
# returns: 0 - an item of sublist is contained in list;
# 1 - no sublist items contained in list
#
################################################################################
function any_in_list() {
local sublist="$1"
local list="$2"
local e
local exp_list
# expand list format 0-3,8-11 to a full sequence {0..3} {8..11}
exp_list=$(echo ${list} | \
sed -e 's#,# #g' -e 's#\([0-9]*\)-\([0-9]*\)#{\1\.\.\2}#g')
declare -A a_list
for e in $(eval echo ${exp_list})
do
a_list[$e]=1
done
# expand list format 0-3,8-11 to a full sequence {0..3} {8..11}
exp_list=$(echo ${sublist} | \
sed -e 's#,# #g' -e 's#\([0-9]*\)-\([0-9]*\)#{\1\.\.\2}#g')
declare -A a_sublist
for e in $(eval echo ${exp_list})
do
a_sublist[$e]=1
done
# Check if any element of sublist is in list
for e in "${!a_sublist[@]}"
do
if [[ "${a_list[$e]}" == 1 ]]
then
return 0 # matches
fi
done
return 1 # no match
}
################################################################################
# Return list of CPUs reserved for platform
################################################################################
function get_platform_cpu_list() {
## Define platform cpulist based on engineering a number of cores and
## whether this is a combo or not, and include SMT siblings.
if [[ $subfunction = *compute* ]]; then
RESERVE_CONF="/etc/nova/compute_reserved.conf"
[[ -e ${RESERVE_CONF} ]] && source ${RESERVE_CONF}
if [ -n "$PLATFORM_CPU_LIST" ];then
echo "$PLATFORM_CPU_LIST"
return 0
fi
fi
local PLATFORM_SOCKET=0
local PLATFORM_START=0
local PLATFORM_CORES=1
if [ "$nodetype" = "controller" ]; then
((PLATFORM_CORES+=1))
fi
local PLATFORM_CPULIST=$(topology_to_cpulist ${PLATFORM_SOCKET} ${PLATFORM_START} ${PLATFORM_CORES})
echo ${PLATFORM_CPULIST}
}
################################################################################
# Return list of CPUs reserved for vswitch
################################################################################
function get_vswitch_cpu_list() {
## Define default avp cpulist based on engineered number of platform cores,
## engineered avp cores, and include SMT siblings.
if [[ $subfunction = *compute* ]]; then
VSWITCH_CONF="/etc/vswitch/vswitch.conf"
[[ -e ${VSWITCH_CONF} ]] && source ${VSWITCH_CONF}
if [ -n "$VSWITCH_CPU_LIST" ];then
echo "$VSWITCH_CPU_LIST"
return 0
fi
fi
local N_CORES_IN_PKG=$(cat /proc/cpuinfo 2>/dev/null | \
awk '/^cpu cores/ {n = $4} END { print (n>0) ? n : 1 }')
# engineer platform cores
local PLATFORM_CORES=1
if [ "$nodetype" = "controller" ]; then
((PLATFORM_CORES+=1))
fi
# engineer AVP cores
local AVP_SOCKET=0
local AVP_START=${PLATFORM_CORES}
local AVP_CORES=1
if [ ${N_CORES_IN_PKG} -gt 4 ]; then
((AVP_CORES+=1))
fi
local AVP_CPULIST=$(topology_to_cpulist ${AVP_SOCKET} ${AVP_START} ${AVP_CORES})
echo ${AVP_CPULIST}
}
################################################################################
# vswitch_expanded_cpu_list() - compute the vswitch cpu list, including it's siblings
################################################################################
function vswitch_expanded_cpu_list() {
list=$(get_vswitch_cpu_list)
# Expand vswitch cpulist
vswitch_cpulist=$(expand_sequence ${list} " ")
cpulist=""
for e in $vswitch_cpulist
do
# claim hyperthread siblings if SMT enabled
SIBLINGS_CPULIST=$(cat /sys/devices/system/cpu/cpu${e}/topology/thread_siblings_list 2>/dev/null)
siblings_cpulist=$(expand_sequence ${SIBLINGS_CPULIST} " ")
for s in $siblings_cpulist
do
in_list ${s} ${cpulist}
if [ $? -eq 1 ]
then
cpulist=$(append_list ${s} ${cpulist})
fi
done
done
echo "$cpulist"
return 0
}
################################################################################
# platform_expanded_cpu_list() - compute the platform cpu list, including it's siblings
################################################################################
function platform_expanded_cpu_list() {
list=$(get_platform_cpu_list)
# Expand platform cpulist
platform_cpulist=$(expand_sequence ${list} " ")
cpulist=""
for e in $platform_cpulist
do
# claim hyperthread siblings if SMT enabled
SIBLINGS_CPULIST=$(cat /sys/devices/system/cpu/cpu${e}/topology/thread_siblings_list 2>/dev/null)
siblings_cpulist=$(expand_sequence ${SIBLINGS_CPULIST} " ")
for s in $siblings_cpulist
do
in_list ${s} ${cpulist}
if [ $? -eq 1 ]
then
cpulist=$(append_list ${s} ${cpulist})
fi
done
done
echo "$cpulist"
return 0
}
################################################################################
# Return list of CPUs based on cpu topology. Select the socket, starting core
# within the socket, select number of cores, and SMT siblings.
################################################################################
function topology_to_cpulist() {
local SOCKET=$1
local CORE_START=$2
local NUM_CORES=$3
local CPULIST=$(cat /proc/cpuinfo 2>/dev/null | perl -sne \
'BEGIN { %T = {}; %H = {}; $L = $P = $C = $S = 0; }
{
if (/processor\s+:\s+(\d+)/) { $L = $1; }
if (/physical id\s+:\s+(\d+)/) { $P = $1; }
if (/core id\s+:\s+(\d+)/) {
$C = $1;
$T{$P}{$C}++;
$S = $T{$P}{$C};
$H{$P}{$C}{$S} = $L;
}
}
END {
@cores = sort { $a <=> $b } keys $T{$socket};
@sel_cores = splice @cores, $core_start, $num_cores;
@lcpus = ();
for $C (@sel_cores) {
for $S (sort {$a <=> $b } keys %{ $H{$socket}{$C} }) {
push @lcpus, $H{$socket}{$C}{$S};
}
}
printf "%s\n", join(",", @lcpus);
}' -- -socket=${SOCKET} -core_start=${CORE_START} -num_cores=${NUM_CORES})
echo ${CPULIST}
}

244
compute-huge/compute-huge/cpumap_functions_unit_test.sh

@ -0,0 +1,244 @@
#!/bin/bash
#
# Copyright (c) 2015-2016 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
source /etc/init.d/cpumap_functions.sh
export NR_CPUS_LIST=("4" "8" "16" "32" "64" "128")
if [ ! -z ${1} ]; then
NR_CPUS_LIST=(${1//,/ })
fi
function test_cpumap_to_cpulist()
{
local NR_CPUS=$1
declare -A CPULISTS
if [ ${NR_CPUS} -ge 4 ]; then
CPULISTS["0"]=""
CPULISTS["1"]="0"
CPULISTS["2"]="1"
CPULISTS["3"]="0-1"
CPULISTS["5"]="0,2"
CPULISTS["7"]="0-2"
CPULISTS["F"]="0-3"
CPULISTS["9"]="0,3"
fi
if [ ${NR_CPUS} -ge 8 ]; then
CPULISTS["00"]=""
CPULISTS["11"]="0,4"
CPULISTS["FF"]="0-7"
CPULISTS["81"]="0,7"
fi
if [ ${NR_CPUS} -ge 16 ]; then
CPULISTS["0000"]=""
CPULISTS["1111"]="0,4,8,12"
CPULISTS["FFF"]="0-11"
CPULISTS["F0F"]="0-3,8-11"
CPULISTS["F0F0"]="4-7,12-15"
CPULISTS["FFFF"]="0-15"
CPULISTS["FFFE"]="1-15"
CPULISTS["8001"]="0,15"
fi
if [ ${NR_CPUS} -ge 32 ]; then
CPULISTS["00000000"]=""
CPULISTS["11111111"]="0,4,8,12,16,20,24,28"
CPULISTS["0F0F0F0F"]="0-3,8-11,16-19,24-27"
CPULISTS["F0F0F0F0"]="4-7,12-15,20-23,28-31"
CPULISTS["FFFFFFFF"]="0-31"
CPULISTS["FFFFFFFE"]="1-31"
CPULISTS["80000001"]="0,31"
fi
if [ ${NR_CPUS} -ge 64 ]; then
CPULISTS["0000000000000000"]=""
CPULISTS["1111111111111111"]="0,4,8,12,16,20,24,28,32,36,40,44,48,52,56,60"
CPULISTS["0F0F0F0F0F0F0F0F"]="0-3,8-11,16-19,24-27,32-35,40-43,48-51,56-59"
CPULISTS["F0F0F0F0F0F0F0F0"]="4-7,12-15,20-23,28-31,36-39,44-47,52-55,60-63"
CPULISTS["FFFFFFFFFFFFFFFF"]="0-63"
CPULISTS["FFFFFFFFFFFFFFFE"]="1-63"
CPULISTS["8000000000000001"]="0,63"
fi
if [ ${NR_CPUS} -ge 128 ]; then
CPULISTS["00000000000000000000000000000000"]=""
CPULISTS["11111111111111111111111111111111"]="0,4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64,68,72,76,80,84,88,92,96,100,104,108,112,116,120,124"
CPULISTS["0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F"]="0-3,8-11,16-19,24-27,32-35,40-43,48-51,56-59,64-67,72-75,80-83,88-91,96-99,104-107,112-115,120-123"
CPULISTS["F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0"]="4-7,12-15,20-23,28-31,36-39,44-47,52-55,60-63,68-71,76-79,84-87,92-95,100-103,108-111,116-119,124-127"
CPULISTS["FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"]="0-127"
CPULISTS["FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE"]="1-127"
CPULISTS["80000000000000000000000000000001"]="0,127"
fi
for CPUMAP in ${!CPULISTS[@]}; do
EXPECTED=${CPULISTS[${CPUMAP}]}
CPULIST=$(cpumap_to_cpulist ${CPUMAP} ${NR_CPUS})
if [ "${CPULIST}" != "${EXPECTED}" ]; then
printf "\n"
echo "error: (cpumap_to_list ${CPUMAP} ${NR_CPUS}) returned \"${CPULIST}\" instead of \"${EXPECTED}\""
fi
printf "."
done
printf "\n"
}
function test_cpulist_to_cpumap()
{
local NR_CPUS=$1
declare -A CPUMAPS
if [ ${NR_CPUS} -ge 4 ]; then
CPUMAPS[" "]="0"
CPUMAPS["0"]="1"
CPUMAPS["1"]="2"
CPUMAPS["0-1"]="3"
CPUMAPS["0,2"]="5"
CPUMAPS["0-2"]="7"
CPUMAPS["0-3"]="F"
CPUMAPS["0,3"]="9"
fi
if [ ${NR_CPUS} -ge 8 ]; then
CPUMAPS["0,4"]="11"
CPUMAPS["0-7"]="FF"
CPUMAPS["0,7"]="81"
fi
if [ ${NR_CPUS} -ge 16 ]; then
CPUMAPS["0,4,8,12"]="1111"
CPUMAPS["0-11"]="FFF"
CPUMAPS["0-3,8-11"]="F0F"
CPUMAPS["4-7,12-15"]="F0F0"
CPUMAPS["0-15"]="FFFF"
CPUMAPS["1-15"]="FFFE"
CPUMAPS["0,15"]="8001"
fi
if [ ${NR_CPUS} -ge 32 ]; then
CPUMAPS["0,4,8,12,16,20,24,28"]="11111111"
CPUMAPS["0-3,8-11,16-19,24-27"]="F0F0F0F"
CPUMAPS["4-7,12-15,20-23,28-31"]="F0F0F0F0"
CPUMAPS["0-31"]="FFFFFFFF"
CPUMAPS["1-31"]="FFFFFFFE"
CPUMAPS["0,31"]="80000001"
fi
if [ ${NR_CPUS} -ge 64 ]; then
CPUMAPS["0,4,8,12,16,20,24,28,32,36,40,44,48,52,56,60"]="1111111111111111"
CPUMAPS["0-3,8-11,16-19,24-27,32-35,40-43,48-51,56-59"]="F0F0F0F0F0F0F0F"
CPUMAPS["4-7,12-15,20-23,28-31,36-39,44-47,52-55,60-63"]="F0F0F0F0F0F0F0F0"
CPUMAPS["0-63"]="FFFFFFFFFFFFFFFF"
CPUMAPS["1-63"]="FFFFFFFFFFFFFFFE"
CPUMAPS["0,63"]="8000000000000001"
fi
if [ ${NR_CPUS} -ge 128 ]; then
CPUMAPS["0,4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64,68,72,76,80,84,88,92,96,100,104,108,112,116,120,124"]="11111111111111111111111111111111"
CPUMAPS["0-3,8-11,16-19,24-27,32-35,40-43,48-51,56-59,64-67,72-75,80-83,88-91,96-99,104-107,112-115,120-123"]="F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F"
CPUMAPS["4-7,12-15,20-23,28-31,36-39,44-47,52-55,60-63,68-71,76-79,84-87,92-95,100-103,108-111,116-119,124-127"]="F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0"
CPUMAPS["0-127"]="FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
CPUMAPS["1-127"]="FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE"
CPUMAPS["0,127"]="80000000000000000000000000000001"
fi
for CPULIST in ${!CPUMAPS[@]}; do
EXPECTED=${CPUMAPS[${CPULIST}]}
CPUMAP=$(cpulist_to_cpumap ${CPULIST} ${NR_CPUS})
if [ "${CPUMAP}" != "${EXPECTED}" ]; then
printf "\n"
echo "error: (cpulist_to_cpumap ${CPULIST} ${NR_CPUS}) returned \"${CPUMAP}\" instead of \"${EXPECTED}\""
fi
printf "."
done
printf "\n"
}
function test_invert_cpumap()
{
local NR_CPUS=$1
declare -A INVERSES
if [ $((${NR_CPUS} % 4)) -ne 0 ]; then
echo "test_invert_cpumap skipping NR_CPUS=${NR_CPUS}; not a multiple of 4"
return 0
fi
if [ ${NR_CPUS} -ge 4 ]; then
INVERSES["0"]="FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
INVERSES["1"]="FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE"
INVERSES["2"]="FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD"
INVERSES["3"]="FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC"
INVERSES["5"]="FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA"
INVERSES["7"]="FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8"
INVERSES["F"]="FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0"
INVERSES["9"]="FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF6"
fi
if [ ${NR_CPUS} -ge 8 ]; then
INVERSES["11"]="FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEE"
INVERSES["FF"]="FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00"
INVERSES["F0"]="FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0F"
INVERSES["81"]="FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7E"
fi
if [ ${NR_CPUS} -ge 16 ]; then
INVERSES["1111"]="FFFFFFFFFFFFFFFFFFFFFFFFFFFFEEEE"
INVERSES["FFF"]="FFFFFFFFFFFFFFFFFFFFFFFFFFFFF000"
INVERSES["F0F"]="FFFFFFFFFFFFFFFFFFFFFFFFFFFFF0F0"
INVERSES["F0F0"]="FFFFFFFFFFFFFFFFFFFFFFFFFFFF0F0F"
INVERSES["0F0F"]="FFFFFFFFFFFFFFFFFFFFFFFFFFFFF0F0"
INVERSES["FFFF"]="FFFFFFFFFFFFFFFFFFFFFFFFFFFF0000"
INVERSES["FFFE"]="FFFFFFFFFFFFFFFFFFFFFFFFFFFF0001"
INVERSES["8001"]="FFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFE"
fi
if [ ${NR_CPUS} -ge 32 ]; then
INVERSES["11111111"]="FFFFFFFFFFFFFFFFFFFFFFFFEEEEEEEE"
INVERSES["0F0F0F0F"]="FFFFFFFFFFFFFFFFFFFFFFFFF0F0F0F0"
INVERSES["F0F0F0F0"]="FFFFFFFFFFFFFFFFFFFFFFFF0F0F0F0F"
INVERSES["FFFFFFFF"]="FFFFFFFFFFFFFFFFFFFFFFFF00000000"
INVERSES["FFFFFFFE"]="FFFFFFFFFFFFFFFFFFFFFFFF00000001"
INVERSES["80000001"]="FFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFE"
fi
if [ ${NR_CPUS} -ge 64 ]; then
INVERSES["1111111111111111"]="FFFFFFFFFFFFFFFFEEEEEEEEEEEEEEEE"
INVERSES["0F0F0F0F0F0F0F0F"]="FFFFFFFFFFFFFFFFF0F0F0F0F0F0F0F0"
INVERSES["F0F0F0F0F0F0F0F0"]="FFFFFFFFFFFFFFFF0F0F0F0F0F0F0F0F"
INVERSES["FFFFFFFFFFFFFFFF"]="FFFFFFFFFFFFFFFF0000000000000000"
INVERSES["FFFFFFFFFFFFFFFE"]="FFFFFFFFFFFFFFFF0000000000000001"
INVERSES["8000000000000001"]="FFFFFFFFFFFFFFFF7FFFFFFFFFFFFFFE"
fi
if [ ${NR_CPUS} -ge 128 ]; then
INVERSES["11111111111111111111111111111111"]="EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE"
INVERSES["0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F"]="F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0"
INVERSES["F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0"]="0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F"
INVERSES["FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"]="00000000000000000000000000000000"
INVERSES["FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE"]="00000000000000000000000000000001"
INVERSES["80000000000000000000000000000001"]="7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE"
fi
for CPUMAP in ${!INVERSES[@]}; do
EXPECTED=${INVERSES[${CPUMAP}]}
if [ ${NR_CPUS} -lt 128 ]; then
EXPECTED=$(echo ${EXPECTED} | cut --complement -c1-$((32-((${NR_CPUS}+3)/4))))
fi
EXPECTED=$(echo ${EXPECTED} | sed -e "s/^0*//")
if [ -z ${EXPECTED} ]; then
EXPECTED="0"
fi
INVERSE=$(invert_cpumap ${CPUMAP} ${NR_CPUS})
if [ "${INVERSE}" != "${EXPECTED}" ]; then
printf "\n"
echo "error: (invert_cpumap ${CPUMAP} ${NR_CPUS}) returned \"${INVERSE}\" instead of \"${EXPECTED}\""
fi
printf "."
done
printf "\n"
}
for NR_CPUS in ${NR_CPUS_LIST[@]}; do
echo "NR_CPUS=${NR_CPUS}"
test_cpumap_to_cpulist ${NR_CPUS}
test_cpulist_to_cpumap ${NR_CPUS}
test_invert_cpumap ${NR_CPUS}
echo ""
done
exit 0

49
compute-huge/compute-huge/log_functions.sh

@ -0,0 +1,49 @@
#!/bin/bash
################################################################################
# Copyright (c) 2013-2015 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
################################################################################
################################################################################
# Log if debug is enabled via LOG_DEBUG
#
################################################################################
function log_debug
{
if [ ! -z "${LOG_DEBUG}" ]; then
logger -p debug -t "$0[${PPID}]" -s "$@" 2>&1
fi
}
################################################################################
# Log unconditionally to STDERR
#
################################################################################
function log_error
{
logger -p error -t "$0[${PPID}]" -s "$@"
}
################################################################################
# Log unconditionally to STDOUT
#
################################################################################
function log
{
logger -p info -t "$0[${PPID}]" -s "$@" 2>&1
}
################################################################################
# Utility function to print the status of a command result
#
################################################################################
function print_status()
{
if [ "$1" -eq "0" ]; then
echo "[ OK ]"
else
echo "[FAILED]"
fi
}

27
compute-huge/compute-huge/ps-sched.sh

@ -0,0 +1,27 @@
#!/bin/bash
################################################################################
# Copyright (c) 2013 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
################################################################################
#
# ps-sched.sh -- gives detailed task listing with scheduling attributes
# -- this is cpu and scheduling intensive version (shell/taskset based)
# (note: does not print fields 'group' or 'timeslice')
printf "%6s %6s %6s %1c %2s %4s %6s %4s %-24s %2s %-16s %s\n" "PID" "TID" "PPID" "S" "PO" "NICE" "RTPRIO" "PR" "AFFINITY" "P" "COMM" "COMMAND"
ps -eL -o pid=,lwp=,ppid=,state=,class=,nice=,rtprio=,priority=,psr=,comm=,command= | \
while read pid tid ppid state policy nice rtprio priority psr comm command
do
bitmask=$(taskset -p $tid 2>/dev/null)
aff=${bitmask##*: }
if [ -z "${aff}" ]; then
aff="0x0"
else
aff="0x${aff}"
fi
printf "%6d %6d %6d %1c %2s %4s %6s %4d %-24s %2d %-16s %s\n" $pid $tid $ppid $state $policy $nice $rtprio $priority $aff $psr $comm "$command"
done
exit 0

90
compute-huge/compute-huge/set-cpu-wakeup-latency.sh

@ -0,0 +1,90 @@
#!/bin/bash
#
# Copyright (c) 2017 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
# Purpose: set PM QoS resume latency constraints for CPUs.
# Usage: /usr/bin/set-cpu-wakeup-latency.sh policy cpulist
# policy may be either "low" or "high" to set appropriate latency.
# "low" means HALT (C1) is the deepest C-state we allow the CPU to enter.
# "high" means we allow the CPU to sleep as deeply as possible.
# cpulist is for specifying a numerical list of processors.
# It may contain multiple items, separated by comma, and ranges.
# For example, 0,5,7,9-11.
# Define minimal path
PATH=/bin:/usr/bin:/usr/local/bin
LOG_FUNCTIONS=${LOG_FUNCTIONS:-"/etc/init.d/log_functions.sh"}
CPUMAP_FUNCTIONS=${CPUMAP_FUNCTIONS:-"/etc/init.d/cpumap_functions.sh"}
[[ -e ${LOG_FUNCTIONS} ]] && source ${LOG_FUNCTIONS}
[[ -e ${CPUMAP_FUNCTIONS} ]] && source ${CPUMAP_FUNCTIONS}