<matrixBuild _class='hudson.matrix.MatrixBuild'><action _class='hudson.model.CauseAction'><cause _class='org.jenkinsci.plugins.workflow.support.steps.build.BuildUpstreamCause'><shortDescription>Started by upstream project "gerrit-osmo-bts" build number 1,129</shortDescription><upstreamBuild>1129</upstreamBuild><upstreamProject>gerrit-osmo-bts</upstreamProject><upstreamUrl>job/gerrit-osmo-bts/</upstreamUrl></cause></action><action></action><action _class='hudson.model.ParametersAction'><parameter _class='hudson.model.StringParameterValue'><name>COMMENT_TYPE</name><value></value></parameter><parameter _class='hudson.model.StringParameterValue'><name>DISTRO</name><value></value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_BRANCH</name><value>master</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_CHANGE_NUMBER</name><value>42524</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_HOST</name><value>gerrit.osmocom.org</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PATCHSET_NUMBER</name><value>1</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PATCHSET_REVISION</name><value>4c6324213ac87f9979df7e6d0f596f175ddb27f6</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PATCHSET_UPLOADER_NAME</name><value>fixeria</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PORT</name><value>29418</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PROJECT</name><value>osmo-bts</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_REFSPEC</name><value>refs/changes/24/42524/1</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_REPO_URL</name><value>ssh://jenkins@gerrit.osmocom.org:29418/osmo-bts</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>PIPELINE_BUILD_URL</name><value>https://jenkins.osmocom.org/jenkins/job/gerrit-osmo-bts/1129/</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>PROJECT_NAME</name><value>osmo-bts</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>BRANCH_CI</name><value>master</value></parameter></action><action _class='jenkins.metrics.impl.TimeInQueueAction'><blockedDurationMillis>297269</blockedDurationMillis><blockedTimeMillis>297269</blockedTimeMillis><buildableDurationMillis>0</buildableDurationMillis><buildableTimeMillis>0</buildableTimeMillis><buildingDurationMillis>231605</buildingDurationMillis><executingTimeMillis>231605</executingTimeMillis><executorUtilization>1.0</executorUtilization><queuingDurationMillis>303368</queuingDurationMillis><queuingTimeMillis>303368</queuingTimeMillis><subTaskCount>0</subTaskCount><totalDurationMillis>534973</totalDurationMillis><waitingDurationMillis>6095</waitingDurationMillis><waitingTimeMillis>6095</waitingTimeMillis></action><action></action><action _class='hudson.plugins.git.util.BuildData'><buildsByBranchName><_2023q1 _class='hudson.plugins.git.util.Build'><buildNumber>374</buildNumber><marked><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><branch><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><name>2023q1</name></branch></marked><revision><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><branch><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><name>2023q1</name></branch></revision></_2023q1><osmith1.7.1 _class='hudson.plugins.git.util.Build'><buildNumber>794</buildNumber><marked><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><branch><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><name>osmith/1.7.1</name></branch></marked><revision><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><branch><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><name>osmith/1.7.1</name></branch></revision></osmith1.7.1><osmith1.7.2 _class='hudson.plugins.git.util.Build'><buildNumber>874</buildNumber><marked><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><branch><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><name>osmith/1.7.2</name></branch></marked><revision><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><branch><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><name>osmith/1.7.2</name></branch></revision></osmith1.7.2><master _class='hudson.plugins.git.util.Build'><buildNumber>1127</buildNumber><marked><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><branch><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><name>master</name></branch></marked><revision><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><branch><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><name>master</name></branch></revision></master></buildsByBranchName><lastBuiltRevision><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><branch><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><name>master</name></branch></lastBuiltRevision><remoteUrl>ssh://jenkins@gerrit.osmocom.org:29418/osmo-bts</remoteUrl><scmName></scmName></action><action></action><action></action><action _class='org.jenkinsci.plugins.displayurlapi.actions.RunDisplayAction'><artifactsUrl>https://jenkins.osmocom.org/jenkins/view/all/job/gerrit-osmo-bts-build/1127/artifact</artifactsUrl><changesUrl>https://jenkins.osmocom.org/jenkins/view/all/job/gerrit-osmo-bts-build/changes</changesUrl><displayUrl>https://jenkins.osmocom.org/jenkins/view/all/job/gerrit-osmo-bts-build/1127/</displayUrl><testsUrl>https://jenkins.osmocom.org/jenkins/view/all/job/gerrit-osmo-bts-build/1127/testReport</testsUrl></action><building>false</building><displayName>#1127</displayName><duration>231605</duration><estimatedDuration>224846</estimatedDuration><fullDisplayName>gerrit-osmo-bts-build #1127</fullDisplayName><id>1127</id><inProgress>false</inProgress><keepLog>false</keepLog><number>1127</number><queueId>74530</queueId><result>SUCCESS</result><timestamp>1774792375960</timestamp><url>https://jenkins.osmocom.org/jenkins/view/all/job/gerrit-osmo-bts-build/1127/</url><builtOn></builtOn><changeSet _class='hudson.plugins.git.GitChangeSetList'><item _class='hudson.plugins.git.GitChangeSet'><affectedPath>src/common/tx_power.c</affectedPath><affectedPath>include/osmo-bts/tx_power.h</affectedPath><affectedPath>src/common/bts_shutdown_fsm.c</affectedPath><commitId>4c6324213ac87f9979df7e6d0f596f175ddb27f6</commitId><timestamp>1774610689000</timestamp><author><absoluteUrl>https://jenkins.osmocom.org/jenkins/user/fixeria</absoluteUrl><fullName>Vadim Yanitskiy</fullName></author><authorEmail>vyanitskiy@sysmocom.de</authorEmail><comment>bts_shutdown_fsm: fix spurious RAMP_COMPL events in WAIT_TRX_CLOSED

With multiple TRXes ramping down in lockstep, both their final
ramp-timer callbacks fire back-to-back in the same event loop pass,
setting p_total_cur_mdBm to the target value for both before any async
hardware acknowledgement arrives.  When the first SETPOWER ack returns
and fires ramp_down_compl_cb() for TRX0, the remaining-TRX check in
st_wait_ramp_down_compl() inspects p_total_cur_mdBm for TRX1 and finds
it already at the target - concluding that all TRXes are done.  The FSM
then transitions to WAIT_TRX_CLOSED, and the second ack (for TRX1)
fires ramp_down_compl_cb() into the wrong state, producing:

  BTS_SHUTDOWN(...){WAIT_TRX_CLOSED}: Event BTS_SHUTDOWN_EV_TRX_RAMP_COMPL not permitted

The root cause is that p_total_cur_mdBm is a *requested* value set in
the timer callback, not a confirmed one.  The hardware confirmation
arrives asynchronously via power_trx_change_compl() -&gt;
power_ramp_do_step(), which is also where compl_cb() is invoked.

Fix by adding a 'complete' flag to trx_power_params.ramp that is:

* cleared when _power_ramp_start() begins a new ramp, and
* set just before compl_cb() is called in power_ramp_do_step()

The shutdown FSM remaining-TRX count then checks !ramp.complete instead of
comparing p_total_cur_mdBm against the target, correctly reflecting which
TRXes have actually received hardware confirmation of ramp completion.

Change-Id: Ia71393e871187d6b44b7f520eb421bab354aafd1
</comment><date>2026-03-27 18:24:49 +0700</date><id>4c6324213ac87f9979df7e6d0f596f175ddb27f6</id><msg>bts_shutdown_fsm: fix spurious RAMP_COMPL events in WAIT_TRX_CLOSED</msg><path><editType>edit</editType><file>src/common/bts_shutdown_fsm.c</file></path><path><editType>edit</editType><file>src/common/tx_power.c</file></path><path><editType>edit</editType><file>include/osmo-bts/tx_power.h</file></path></item><kind>git</kind></changeSet><culprit><absoluteUrl>https://jenkins.osmocom.org/jenkins/user/fixeria</absoluteUrl><description></description><fullName>Vadim Yanitskiy</fullName><id>fixeria</id></culprit><run><action _class='hudson.matrix.MatrixChildParametersAction'><parameter _class='hudson.model.StringParameterValue'><name>COMMENT_TYPE</name><value></value></parameter><parameter _class='hudson.model.StringParameterValue'><name>DISTRO</name><value></value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_BRANCH</name><value>master</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_CHANGE_NUMBER</name><value>42524</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_HOST</name><value>gerrit.osmocom.org</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PATCHSET_NUMBER</name><value>1</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PATCHSET_REVISION</name><value>4c6324213ac87f9979df7e6d0f596f175ddb27f6</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PATCHSET_UPLOADER_NAME</name><value>fixeria</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PORT</name><value>29418</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PROJECT</name><value>osmo-bts</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_REFSPEC</name><value>refs/changes/24/42524/1</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_REPO_URL</name><value>ssh://jenkins@gerrit.osmocom.org:29418/osmo-bts</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>PIPELINE_BUILD_URL</name><value>https://jenkins.osmocom.org/jenkins/job/gerrit-osmo-bts/1129/</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>PROJECT_NAME</name><value>osmo-bts</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>BRANCH_CI</name><value>master</value></parameter></action><action></action><action _class='hudson.model.CauseAction'><cause _class='hudson.model.Cause$UpstreamCause'><shortDescription>Started by upstream project "gerrit-osmo-bts-build" build number 1,127</shortDescription><upstreamBuild>1127</upstreamBuild><upstreamProject>gerrit-osmo-bts-build</upstreamProject><upstreamUrl>job/gerrit-osmo-bts-build/</upstreamUrl></cause></action><action _class='jenkins.metrics.impl.TimeInQueueAction'><blockedDurationMillis>0</blockedDurationMillis><blockedTimeMillis>0</blockedTimeMillis><buildableDurationMillis>0</buildableDurationMillis><buildableTimeMillis>0</buildableTimeMillis><buildingDurationMillis>74055</buildingDurationMillis><executingTimeMillis>74055</executingTimeMillis><executorUtilization>1.0</executorUtilization><subTaskCount>0</subTaskCount><waitingDurationMillis>0</waitingDurationMillis><waitingTimeMillis>0</waitingTimeMillis></action><action></action><action _class='hudson.plugins.git.util.BuildData'><buildsByBranchName><_2023q1 _class='hudson.plugins.git.util.Build'><buildNumber>374</buildNumber><marked><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><branch><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><name>2023q1</name></branch></marked><revision><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><branch><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><name>2023q1</name></branch></revision></_2023q1><osmith1.7.1 _class='hudson.plugins.git.util.Build'><buildNumber>794</buildNumber><marked><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><branch><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><name>osmith/1.7.1</name></branch></marked><revision><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><branch><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><name>osmith/1.7.1</name></branch></revision></osmith1.7.1><osmith1.7.2 _class='hudson.plugins.git.util.Build'><buildNumber>874</buildNumber><marked><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><branch><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><name>osmith/1.7.2</name></branch></marked><revision><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><branch><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><name>osmith/1.7.2</name></branch></revision></osmith1.7.2><master _class='hudson.plugins.git.util.Build'><buildNumber>1127</buildNumber><marked><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><branch><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><name>master</name></branch></marked><revision><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><branch><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><name>master</name></branch></revision></master></buildsByBranchName><lastBuiltRevision><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><branch><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><name>master</name></branch></lastBuiltRevision><remoteUrl>ssh://jenkins@gerrit.osmocom.org:29418/osmo-bts</remoteUrl><scmName></scmName></action><action></action><action _class='org.jenkinsci.plugins.displayurlapi.actions.RunDisplayAction'></action><building>false</building><displayName>#1127</displayName><duration>74055</duration><estimatedDuration>76078</estimatedDuration><fullDisplayName>gerrit-osmo-bts-build » BTS_MODEL=lc15,FIRMWARE_VERSION=litecell15,0,default,osmocom-gerrit #1127</fullDisplayName><id>1127</id><inProgress>false</inProgress><keepLog>false</keepLog><number>1127</number><queueId>74560</queueId><result>SUCCESS</result><timestamp>1774792375960</timestamp><url>https://jenkins.osmocom.org/jenkins/view/all/job/gerrit-osmo-bts-build/BTS_MODEL=lc15,FIRMWARE_VERSION=litecell15,WITH_MANUALS=0,a4=default,label=osmocom-gerrit/1127/</url><builtOn>build5-deb12build-ansible</builtOn><changeSet _class='hudson.plugins.git.GitChangeSetList'><item _class='hudson.plugins.git.GitChangeSet'><affectedPath>src/common/tx_power.c</affectedPath><affectedPath>include/osmo-bts/tx_power.h</affectedPath><affectedPath>src/common/bts_shutdown_fsm.c</affectedPath><commitId>4c6324213ac87f9979df7e6d0f596f175ddb27f6</commitId><timestamp>1774610689000</timestamp><author><absoluteUrl>https://jenkins.osmocom.org/jenkins/user/fixeria</absoluteUrl><fullName>Vadim Yanitskiy</fullName></author><authorEmail>vyanitskiy@sysmocom.de</authorEmail><comment>bts_shutdown_fsm: fix spurious RAMP_COMPL events in WAIT_TRX_CLOSED

With multiple TRXes ramping down in lockstep, both their final
ramp-timer callbacks fire back-to-back in the same event loop pass,
setting p_total_cur_mdBm to the target value for both before any async
hardware acknowledgement arrives.  When the first SETPOWER ack returns
and fires ramp_down_compl_cb() for TRX0, the remaining-TRX check in
st_wait_ramp_down_compl() inspects p_total_cur_mdBm for TRX1 and finds
it already at the target - concluding that all TRXes are done.  The FSM
then transitions to WAIT_TRX_CLOSED, and the second ack (for TRX1)
fires ramp_down_compl_cb() into the wrong state, producing:

  BTS_SHUTDOWN(...){WAIT_TRX_CLOSED}: Event BTS_SHUTDOWN_EV_TRX_RAMP_COMPL not permitted

The root cause is that p_total_cur_mdBm is a *requested* value set in
the timer callback, not a confirmed one.  The hardware confirmation
arrives asynchronously via power_trx_change_compl() -&gt;
power_ramp_do_step(), which is also where compl_cb() is invoked.

Fix by adding a 'complete' flag to trx_power_params.ramp that is:

* cleared when _power_ramp_start() begins a new ramp, and
* set just before compl_cb() is called in power_ramp_do_step()

The shutdown FSM remaining-TRX count then checks !ramp.complete instead of
comparing p_total_cur_mdBm against the target, correctly reflecting which
TRXes have actually received hardware confirmation of ramp completion.

Change-Id: Ia71393e871187d6b44b7f520eb421bab354aafd1
</comment><date>2026-03-27 18:24:49 +0700</date><id>4c6324213ac87f9979df7e6d0f596f175ddb27f6</id><msg>bts_shutdown_fsm: fix spurious RAMP_COMPL events in WAIT_TRX_CLOSED</msg><path><editType>edit</editType><file>include/osmo-bts/tx_power.h</file></path><path><editType>edit</editType><file>src/common/tx_power.c</file></path><path><editType>edit</editType><file>src/common/bts_shutdown_fsm.c</file></path></item><kind>git</kind></changeSet><culprit><absoluteUrl>https://jenkins.osmocom.org/jenkins/user/fixeria</absoluteUrl><fullName>Vadim Yanitskiy</fullName></culprit></run><run><action _class='hudson.matrix.MatrixChildParametersAction'><parameter _class='hudson.model.StringParameterValue'><name>COMMENT_TYPE</name><value></value></parameter><parameter _class='hudson.model.StringParameterValue'><name>DISTRO</name><value></value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_BRANCH</name><value>master</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_CHANGE_NUMBER</name><value>42524</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_HOST</name><value>gerrit.osmocom.org</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PATCHSET_NUMBER</name><value>1</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PATCHSET_REVISION</name><value>4c6324213ac87f9979df7e6d0f596f175ddb27f6</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PATCHSET_UPLOADER_NAME</name><value>fixeria</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PORT</name><value>29418</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PROJECT</name><value>osmo-bts</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_REFSPEC</name><value>refs/changes/24/42524/1</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_REPO_URL</name><value>ssh://jenkins@gerrit.osmocom.org:29418/osmo-bts</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>PIPELINE_BUILD_URL</name><value>https://jenkins.osmocom.org/jenkins/job/gerrit-osmo-bts/1129/</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>PROJECT_NAME</name><value>osmo-bts</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>BRANCH_CI</name><value>master</value></parameter></action><action></action><action _class='hudson.model.CauseAction'><cause _class='hudson.model.Cause$UpstreamCause'><shortDescription>Started by upstream project "gerrit-osmo-bts-build" build number 1,127</shortDescription><upstreamBuild>1127</upstreamBuild><upstreamProject>gerrit-osmo-bts-build</upstreamProject><upstreamUrl>job/gerrit-osmo-bts-build/</upstreamUrl></cause></action><action _class='jenkins.metrics.impl.TimeInQueueAction'><blockedDurationMillis>0</blockedDurationMillis><blockedTimeMillis>0</blockedTimeMillis><buildableDurationMillis>73545</buildableDurationMillis><buildableTimeMillis>73545</buildableTimeMillis><buildingDurationMillis>61422</buildingDurationMillis><executingTimeMillis>61422</executingTimeMillis><executorUtilization>1.0</executorUtilization><subTaskCount>0</subTaskCount><waitingDurationMillis>0</waitingDurationMillis><waitingTimeMillis>0</waitingTimeMillis></action><action></action><action _class='hudson.plugins.git.util.BuildData'><buildsByBranchName><_2023q1 _class='hudson.plugins.git.util.Build'><buildNumber>374</buildNumber><marked><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><branch><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><name>2023q1</name></branch></marked><revision><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><branch><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><name>2023q1</name></branch></revision></_2023q1><osmith1.7.1 _class='hudson.plugins.git.util.Build'><buildNumber>794</buildNumber><marked><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><branch><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><name>osmith/1.7.1</name></branch></marked><revision><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><branch><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><name>osmith/1.7.1</name></branch></revision></osmith1.7.1><osmith1.7.2 _class='hudson.plugins.git.util.Build'><buildNumber>874</buildNumber><marked><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><branch><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><name>osmith/1.7.2</name></branch></marked><revision><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><branch><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><name>osmith/1.7.2</name></branch></revision></osmith1.7.2><master _class='hudson.plugins.git.util.Build'><buildNumber>1127</buildNumber><marked><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><branch><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><name>master</name></branch></marked><revision><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><branch><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><name>master</name></branch></revision></master></buildsByBranchName><lastBuiltRevision><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><branch><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><name>master</name></branch></lastBuiltRevision><remoteUrl>ssh://jenkins@gerrit.osmocom.org:29418/osmo-bts</remoteUrl><scmName></scmName></action><action></action><action _class='org.jenkinsci.plugins.displayurlapi.actions.RunDisplayAction'></action><building>false</building><displayName>#1127</displayName><duration>61422</duration><estimatedDuration>74960</estimatedDuration><fullDisplayName>gerrit-osmo-bts-build » BTS_MODEL=lc15,FIRMWARE_VERSION=master,0,default,osmocom-gerrit #1127</fullDisplayName><id>1127</id><inProgress>false</inProgress><keepLog>false</keepLog><number>1127</number><queueId>74565</queueId><result>SUCCESS</result><timestamp>1774792375960</timestamp><url>https://jenkins.osmocom.org/jenkins/view/all/job/gerrit-osmo-bts-build/BTS_MODEL=lc15,FIRMWARE_VERSION=master,WITH_MANUALS=0,a4=default,label=osmocom-gerrit/1127/</url><builtOn>build5-deb12build-ansible</builtOn><changeSet _class='hudson.plugins.git.GitChangeSetList'><item _class='hudson.plugins.git.GitChangeSet'><affectedPath>src/common/tx_power.c</affectedPath><affectedPath>include/osmo-bts/tx_power.h</affectedPath><affectedPath>src/common/bts_shutdown_fsm.c</affectedPath><commitId>4c6324213ac87f9979df7e6d0f596f175ddb27f6</commitId><timestamp>1774610689000</timestamp><author><absoluteUrl>https://jenkins.osmocom.org/jenkins/user/fixeria</absoluteUrl><fullName>Vadim Yanitskiy</fullName></author><authorEmail>vyanitskiy@sysmocom.de</authorEmail><comment>bts_shutdown_fsm: fix spurious RAMP_COMPL events in WAIT_TRX_CLOSED

With multiple TRXes ramping down in lockstep, both their final
ramp-timer callbacks fire back-to-back in the same event loop pass,
setting p_total_cur_mdBm to the target value for both before any async
hardware acknowledgement arrives.  When the first SETPOWER ack returns
and fires ramp_down_compl_cb() for TRX0, the remaining-TRX check in
st_wait_ramp_down_compl() inspects p_total_cur_mdBm for TRX1 and finds
it already at the target - concluding that all TRXes are done.  The FSM
then transitions to WAIT_TRX_CLOSED, and the second ack (for TRX1)
fires ramp_down_compl_cb() into the wrong state, producing:

  BTS_SHUTDOWN(...){WAIT_TRX_CLOSED}: Event BTS_SHUTDOWN_EV_TRX_RAMP_COMPL not permitted

The root cause is that p_total_cur_mdBm is a *requested* value set in
the timer callback, not a confirmed one.  The hardware confirmation
arrives asynchronously via power_trx_change_compl() -&gt;
power_ramp_do_step(), which is also where compl_cb() is invoked.

Fix by adding a 'complete' flag to trx_power_params.ramp that is:

* cleared when _power_ramp_start() begins a new ramp, and
* set just before compl_cb() is called in power_ramp_do_step()

The shutdown FSM remaining-TRX count then checks !ramp.complete instead of
comparing p_total_cur_mdBm against the target, correctly reflecting which
TRXes have actually received hardware confirmation of ramp completion.

Change-Id: Ia71393e871187d6b44b7f520eb421bab354aafd1
</comment><date>2026-03-27 18:24:49 +0700</date><id>4c6324213ac87f9979df7e6d0f596f175ddb27f6</id><msg>bts_shutdown_fsm: fix spurious RAMP_COMPL events in WAIT_TRX_CLOSED</msg><path><editType>edit</editType><file>include/osmo-bts/tx_power.h</file></path><path><editType>edit</editType><file>src/common/bts_shutdown_fsm.c</file></path><path><editType>edit</editType><file>src/common/tx_power.c</file></path></item><kind>git</kind></changeSet><culprit><absoluteUrl>https://jenkins.osmocom.org/jenkins/user/fixeria</absoluteUrl><fullName>Vadim Yanitskiy</fullName></culprit></run><run><action _class='hudson.matrix.MatrixChildParametersAction'><parameter _class='hudson.model.StringParameterValue'><name>COMMENT_TYPE</name><value></value></parameter><parameter _class='hudson.model.StringParameterValue'><name>DISTRO</name><value></value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_BRANCH</name><value>master</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_CHANGE_NUMBER</name><value>42524</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_HOST</name><value>gerrit.osmocom.org</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PATCHSET_NUMBER</name><value>1</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PATCHSET_REVISION</name><value>4c6324213ac87f9979df7e6d0f596f175ddb27f6</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PATCHSET_UPLOADER_NAME</name><value>fixeria</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PORT</name><value>29418</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PROJECT</name><value>osmo-bts</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_REFSPEC</name><value>refs/changes/24/42524/1</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_REPO_URL</name><value>ssh://jenkins@gerrit.osmocom.org:29418/osmo-bts</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>PIPELINE_BUILD_URL</name><value>https://jenkins.osmocom.org/jenkins/job/gerrit-osmo-bts/1129/</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>PROJECT_NAME</name><value>osmo-bts</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>BRANCH_CI</name><value>master</value></parameter></action><action></action><action _class='hudson.model.CauseAction'><cause _class='hudson.model.Cause$UpstreamCause'><shortDescription>Started by upstream project "gerrit-osmo-bts-build" build number 1,127</shortDescription><upstreamBuild>1127</upstreamBuild><upstreamProject>gerrit-osmo-bts-build</upstreamProject><upstreamUrl>job/gerrit-osmo-bts-build/</upstreamUrl></cause></action><action _class='jenkins.metrics.impl.TimeInQueueAction'><blockedDurationMillis>0</blockedDurationMillis><blockedTimeMillis>0</blockedTimeMillis><buildableDurationMillis>68963</buildableDurationMillis><buildableTimeMillis>68963</buildableTimeMillis><buildingDurationMillis>66048</buildingDurationMillis><executingTimeMillis>66048</executingTimeMillis><executorUtilization>1.0</executorUtilization><subTaskCount>0</subTaskCount><waitingDurationMillis>0</waitingDurationMillis><waitingTimeMillis>0</waitingTimeMillis></action><action></action><action _class='hudson.plugins.git.util.BuildData'><buildsByBranchName><_2023q1 _class='hudson.plugins.git.util.Build'><buildNumber>374</buildNumber><marked><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><branch><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><name>2023q1</name></branch></marked><revision><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><branch><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><name>2023q1</name></branch></revision></_2023q1><osmith1.7.1 _class='hudson.plugins.git.util.Build'><buildNumber>794</buildNumber><marked><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><branch><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><name>osmith/1.7.1</name></branch></marked><revision><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><branch><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><name>osmith/1.7.1</name></branch></revision></osmith1.7.1><osmith1.7.2 _class='hudson.plugins.git.util.Build'><buildNumber>874</buildNumber><marked><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><branch><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><name>osmith/1.7.2</name></branch></marked><revision><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><branch><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><name>osmith/1.7.2</name></branch></revision></osmith1.7.2><master _class='hudson.plugins.git.util.Build'><buildNumber>1127</buildNumber><marked><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><branch><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><name>master</name></branch></marked><revision><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><branch><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><name>master</name></branch></revision></master></buildsByBranchName><lastBuiltRevision><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><branch><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><name>master</name></branch></lastBuiltRevision><remoteUrl>ssh://jenkins@gerrit.osmocom.org:29418/osmo-bts</remoteUrl><scmName></scmName></action><action></action><action _class='org.jenkinsci.plugins.displayurlapi.actions.RunDisplayAction'></action><building>false</building><displayName>#1127</displayName><duration>66048</duration><estimatedDuration>77186</estimatedDuration><fullDisplayName>gerrit-osmo-bts-build » BTS_MODEL=lc15,FIRMWARE_VERSION=v2017.01,0,default,osmocom-gerrit #1127</fullDisplayName><id>1127</id><inProgress>false</inProgress><keepLog>false</keepLog><number>1127</number><queueId>74562</queueId><result>SUCCESS</result><timestamp>1774792375960</timestamp><url>https://jenkins.osmocom.org/jenkins/view/all/job/gerrit-osmo-bts-build/BTS_MODEL=lc15,FIRMWARE_VERSION=v2017.01,WITH_MANUALS=0,a4=default,label=osmocom-gerrit/1127/</url><builtOn>build4-deb12build-ansible</builtOn><changeSet _class='hudson.plugins.git.GitChangeSetList'><item _class='hudson.plugins.git.GitChangeSet'><affectedPath>src/common/tx_power.c</affectedPath><affectedPath>include/osmo-bts/tx_power.h</affectedPath><affectedPath>src/common/bts_shutdown_fsm.c</affectedPath><commitId>4c6324213ac87f9979df7e6d0f596f175ddb27f6</commitId><timestamp>1774610689000</timestamp><author><absoluteUrl>https://jenkins.osmocom.org/jenkins/user/fixeria</absoluteUrl><fullName>Vadim Yanitskiy</fullName></author><authorEmail>vyanitskiy@sysmocom.de</authorEmail><comment>bts_shutdown_fsm: fix spurious RAMP_COMPL events in WAIT_TRX_CLOSED

With multiple TRXes ramping down in lockstep, both their final
ramp-timer callbacks fire back-to-back in the same event loop pass,
setting p_total_cur_mdBm to the target value for both before any async
hardware acknowledgement arrives.  When the first SETPOWER ack returns
and fires ramp_down_compl_cb() for TRX0, the remaining-TRX check in
st_wait_ramp_down_compl() inspects p_total_cur_mdBm for TRX1 and finds
it already at the target - concluding that all TRXes are done.  The FSM
then transitions to WAIT_TRX_CLOSED, and the second ack (for TRX1)
fires ramp_down_compl_cb() into the wrong state, producing:

  BTS_SHUTDOWN(...){WAIT_TRX_CLOSED}: Event BTS_SHUTDOWN_EV_TRX_RAMP_COMPL not permitted

The root cause is that p_total_cur_mdBm is a *requested* value set in
the timer callback, not a confirmed one.  The hardware confirmation
arrives asynchronously via power_trx_change_compl() -&gt;
power_ramp_do_step(), which is also where compl_cb() is invoked.

Fix by adding a 'complete' flag to trx_power_params.ramp that is:

* cleared when _power_ramp_start() begins a new ramp, and
* set just before compl_cb() is called in power_ramp_do_step()

The shutdown FSM remaining-TRX count then checks !ramp.complete instead of
comparing p_total_cur_mdBm against the target, correctly reflecting which
TRXes have actually received hardware confirmation of ramp completion.

Change-Id: Ia71393e871187d6b44b7f520eb421bab354aafd1
</comment><date>2026-03-27 18:24:49 +0700</date><id>4c6324213ac87f9979df7e6d0f596f175ddb27f6</id><msg>bts_shutdown_fsm: fix spurious RAMP_COMPL events in WAIT_TRX_CLOSED</msg><path><editType>edit</editType><file>src/common/bts_shutdown_fsm.c</file></path><path><editType>edit</editType><file>include/osmo-bts/tx_power.h</file></path><path><editType>edit</editType><file>src/common/tx_power.c</file></path></item><kind>git</kind></changeSet><culprit><absoluteUrl>https://jenkins.osmocom.org/jenkins/user/fixeria</absoluteUrl><fullName>Vadim Yanitskiy</fullName></culprit></run><run><action _class='hudson.matrix.MatrixChildParametersAction'><parameter _class='hudson.model.StringParameterValue'><name>COMMENT_TYPE</name><value></value></parameter><parameter _class='hudson.model.StringParameterValue'><name>DISTRO</name><value></value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_BRANCH</name><value>master</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_CHANGE_NUMBER</name><value>42524</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_HOST</name><value>gerrit.osmocom.org</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PATCHSET_NUMBER</name><value>1</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PATCHSET_REVISION</name><value>4c6324213ac87f9979df7e6d0f596f175ddb27f6</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PATCHSET_UPLOADER_NAME</name><value>fixeria</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PORT</name><value>29418</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PROJECT</name><value>osmo-bts</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_REFSPEC</name><value>refs/changes/24/42524/1</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_REPO_URL</name><value>ssh://jenkins@gerrit.osmocom.org:29418/osmo-bts</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>PIPELINE_BUILD_URL</name><value>https://jenkins.osmocom.org/jenkins/job/gerrit-osmo-bts/1129/</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>PROJECT_NAME</name><value>osmo-bts</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>BRANCH_CI</name><value>master</value></parameter></action><action></action><action _class='hudson.model.CauseAction'><cause _class='hudson.model.Cause$UpstreamCause'><shortDescription>Started by upstream project "gerrit-osmo-bts-build" build number 1,127</shortDescription><upstreamBuild>1127</upstreamBuild><upstreamProject>gerrit-osmo-bts-build</upstreamProject><upstreamUrl>job/gerrit-osmo-bts-build/</upstreamUrl></cause></action><action _class='jenkins.metrics.impl.TimeInQueueAction'><blockedDurationMillis>0</blockedDurationMillis><blockedTimeMillis>0</blockedTimeMillis><buildableDurationMillis>68946</buildableDurationMillis><buildableTimeMillis>68946</buildableTimeMillis><buildingDurationMillis>66064</buildingDurationMillis><executingTimeMillis>66064</executingTimeMillis><executorUtilization>1.0</executorUtilization><subTaskCount>0</subTaskCount><waitingDurationMillis>0</waitingDurationMillis><waitingTimeMillis>0</waitingTimeMillis></action><action></action><action _class='hudson.plugins.git.util.BuildData'><buildsByBranchName><_2023q1 _class='hudson.plugins.git.util.Build'><buildNumber>374</buildNumber><marked><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><branch><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><name>2023q1</name></branch></marked><revision><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><branch><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><name>2023q1</name></branch></revision></_2023q1><osmith1.7.1 _class='hudson.plugins.git.util.Build'><buildNumber>794</buildNumber><marked><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><branch><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><name>osmith/1.7.1</name></branch></marked><revision><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><branch><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><name>osmith/1.7.1</name></branch></revision></osmith1.7.1><osmith1.7.2 _class='hudson.plugins.git.util.Build'><buildNumber>874</buildNumber><marked><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><branch><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><name>osmith/1.7.2</name></branch></marked><revision><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><branch><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><name>osmith/1.7.2</name></branch></revision></osmith1.7.2><master _class='hudson.plugins.git.util.Build'><buildNumber>1127</buildNumber><marked><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><branch><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><name>master</name></branch></marked><revision><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><branch><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><name>master</name></branch></revision></master></buildsByBranchName><lastBuiltRevision><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><branch><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><name>master</name></branch></lastBuiltRevision><remoteUrl>ssh://jenkins@gerrit.osmocom.org:29418/osmo-bts</remoteUrl><scmName></scmName></action><action></action><action _class='org.jenkinsci.plugins.displayurlapi.actions.RunDisplayAction'></action><building>false</building><displayName>#1127</displayName><duration>66064</duration><estimatedDuration>77639</estimatedDuration><fullDisplayName>gerrit-osmo-bts-build » BTS_MODEL=oc2g,FIRMWARE_VERSION=master,0,default,osmocom-gerrit #1127</fullDisplayName><id>1127</id><inProgress>false</inProgress><keepLog>false</keepLog><number>1127</number><queueId>74561</queueId><result>SUCCESS</result><timestamp>1774792375960</timestamp><url>https://jenkins.osmocom.org/jenkins/view/all/job/gerrit-osmo-bts-build/BTS_MODEL=oc2g,FIRMWARE_VERSION=master,WITH_MANUALS=0,a4=default,label=osmocom-gerrit/1127/</url><builtOn>build4-deb12build-ansible</builtOn><changeSet _class='hudson.plugins.git.GitChangeSetList'><item _class='hudson.plugins.git.GitChangeSet'><affectedPath>src/common/tx_power.c</affectedPath><affectedPath>include/osmo-bts/tx_power.h</affectedPath><affectedPath>src/common/bts_shutdown_fsm.c</affectedPath><commitId>4c6324213ac87f9979df7e6d0f596f175ddb27f6</commitId><timestamp>1774610689000</timestamp><author><absoluteUrl>https://jenkins.osmocom.org/jenkins/user/fixeria</absoluteUrl><fullName>Vadim Yanitskiy</fullName></author><authorEmail>vyanitskiy@sysmocom.de</authorEmail><comment>bts_shutdown_fsm: fix spurious RAMP_COMPL events in WAIT_TRX_CLOSED

With multiple TRXes ramping down in lockstep, both their final
ramp-timer callbacks fire back-to-back in the same event loop pass,
setting p_total_cur_mdBm to the target value for both before any async
hardware acknowledgement arrives.  When the first SETPOWER ack returns
and fires ramp_down_compl_cb() for TRX0, the remaining-TRX check in
st_wait_ramp_down_compl() inspects p_total_cur_mdBm for TRX1 and finds
it already at the target - concluding that all TRXes are done.  The FSM
then transitions to WAIT_TRX_CLOSED, and the second ack (for TRX1)
fires ramp_down_compl_cb() into the wrong state, producing:

  BTS_SHUTDOWN(...){WAIT_TRX_CLOSED}: Event BTS_SHUTDOWN_EV_TRX_RAMP_COMPL not permitted

The root cause is that p_total_cur_mdBm is a *requested* value set in
the timer callback, not a confirmed one.  The hardware confirmation
arrives asynchronously via power_trx_change_compl() -&gt;
power_ramp_do_step(), which is also where compl_cb() is invoked.

Fix by adding a 'complete' flag to trx_power_params.ramp that is:

* cleared when _power_ramp_start() begins a new ramp, and
* set just before compl_cb() is called in power_ramp_do_step()

The shutdown FSM remaining-TRX count then checks !ramp.complete instead of
comparing p_total_cur_mdBm against the target, correctly reflecting which
TRXes have actually received hardware confirmation of ramp completion.

Change-Id: Ia71393e871187d6b44b7f520eb421bab354aafd1
</comment><date>2026-03-27 18:24:49 +0700</date><id>4c6324213ac87f9979df7e6d0f596f175ddb27f6</id><msg>bts_shutdown_fsm: fix spurious RAMP_COMPL events in WAIT_TRX_CLOSED</msg><path><editType>edit</editType><file>src/common/bts_shutdown_fsm.c</file></path><path><editType>edit</editType><file>src/common/tx_power.c</file></path><path><editType>edit</editType><file>include/osmo-bts/tx_power.h</file></path></item><kind>git</kind></changeSet><culprit><absoluteUrl>https://jenkins.osmocom.org/jenkins/user/fixeria</absoluteUrl><fullName>Vadim Yanitskiy</fullName></culprit></run><run><action _class='hudson.matrix.MatrixChildParametersAction'><parameter _class='hudson.model.StringParameterValue'><name>COMMENT_TYPE</name><value></value></parameter><parameter _class='hudson.model.StringParameterValue'><name>DISTRO</name><value></value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_BRANCH</name><value>master</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_CHANGE_NUMBER</name><value>42524</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_HOST</name><value>gerrit.osmocom.org</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PATCHSET_NUMBER</name><value>1</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PATCHSET_REVISION</name><value>4c6324213ac87f9979df7e6d0f596f175ddb27f6</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PATCHSET_UPLOADER_NAME</name><value>fixeria</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PORT</name><value>29418</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PROJECT</name><value>osmo-bts</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_REFSPEC</name><value>refs/changes/24/42524/1</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_REPO_URL</name><value>ssh://jenkins@gerrit.osmocom.org:29418/osmo-bts</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>PIPELINE_BUILD_URL</name><value>https://jenkins.osmocom.org/jenkins/job/gerrit-osmo-bts/1129/</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>PROJECT_NAME</name><value>osmo-bts</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>BRANCH_CI</name><value>master</value></parameter></action><action></action><action _class='hudson.model.CauseAction'><cause _class='hudson.model.Cause$UpstreamCause'><shortDescription>Started by upstream project "gerrit-osmo-bts-build" build number 1,127</shortDescription><upstreamBuild>1127</upstreamBuild><upstreamProject>gerrit-osmo-bts-build</upstreamProject><upstreamUrl>job/gerrit-osmo-bts-build/</upstreamUrl></cause></action><action _class='jenkins.metrics.impl.TimeInQueueAction'><blockedDurationMillis>0</blockedDurationMillis><blockedTimeMillis>0</blockedTimeMillis><buildableDurationMillis>73560</buildableDurationMillis><buildableTimeMillis>73560</buildableTimeMillis><buildingDurationMillis>60889</buildingDurationMillis><executingTimeMillis>60889</executingTimeMillis><executorUtilization>1.0</executorUtilization><subTaskCount>0</subTaskCount><waitingDurationMillis>0</waitingDurationMillis><waitingTimeMillis>0</waitingTimeMillis></action><action></action><action _class='hudson.plugins.git.util.BuildData'><buildsByBranchName><_2023q1 _class='hudson.plugins.git.util.Build'><buildNumber>374</buildNumber><marked><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><branch><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><name>2023q1</name></branch></marked><revision><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><branch><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><name>2023q1</name></branch></revision></_2023q1><osmith1.7.1 _class='hudson.plugins.git.util.Build'><buildNumber>794</buildNumber><marked><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><branch><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><name>osmith/1.7.1</name></branch></marked><revision><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><branch><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><name>osmith/1.7.1</name></branch></revision></osmith1.7.1><osmith1.7.2 _class='hudson.plugins.git.util.Build'><buildNumber>874</buildNumber><marked><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><branch><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><name>osmith/1.7.2</name></branch></marked><revision><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><branch><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><name>osmith/1.7.2</name></branch></revision></osmith1.7.2><master _class='hudson.plugins.git.util.Build'><buildNumber>1127</buildNumber><marked><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><branch><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><name>master</name></branch></marked><revision><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><branch><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><name>master</name></branch></revision></master></buildsByBranchName><lastBuiltRevision><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><branch><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><name>master</name></branch></lastBuiltRevision><remoteUrl>ssh://jenkins@gerrit.osmocom.org:29418/osmo-bts</remoteUrl><scmName></scmName></action><action></action><action _class='org.jenkinsci.plugins.displayurlapi.actions.RunDisplayAction'></action><building>false</building><displayName>#1127</displayName><duration>60889</duration><estimatedDuration>78510</estimatedDuration><fullDisplayName>gerrit-osmo-bts-build » BTS_MODEL=oc2g,FIRMWARE_VERSION=oc2g,0,default,osmocom-gerrit #1127</fullDisplayName><id>1127</id><inProgress>false</inProgress><keepLog>false</keepLog><number>1127</number><queueId>74566</queueId><result>SUCCESS</result><timestamp>1774792375960</timestamp><url>https://jenkins.osmocom.org/jenkins/view/all/job/gerrit-osmo-bts-build/BTS_MODEL=oc2g,FIRMWARE_VERSION=oc2g,WITH_MANUALS=0,a4=default,label=osmocom-gerrit/1127/</url><builtOn>build5-deb12build-ansible</builtOn><changeSet _class='hudson.plugins.git.GitChangeSetList'><item _class='hudson.plugins.git.GitChangeSet'><affectedPath>src/common/tx_power.c</affectedPath><affectedPath>include/osmo-bts/tx_power.h</affectedPath><affectedPath>src/common/bts_shutdown_fsm.c</affectedPath><commitId>4c6324213ac87f9979df7e6d0f596f175ddb27f6</commitId><timestamp>1774610689000</timestamp><author><absoluteUrl>https://jenkins.osmocom.org/jenkins/user/fixeria</absoluteUrl><fullName>Vadim Yanitskiy</fullName></author><authorEmail>vyanitskiy@sysmocom.de</authorEmail><comment>bts_shutdown_fsm: fix spurious RAMP_COMPL events in WAIT_TRX_CLOSED

With multiple TRXes ramping down in lockstep, both their final
ramp-timer callbacks fire back-to-back in the same event loop pass,
setting p_total_cur_mdBm to the target value for both before any async
hardware acknowledgement arrives.  When the first SETPOWER ack returns
and fires ramp_down_compl_cb() for TRX0, the remaining-TRX check in
st_wait_ramp_down_compl() inspects p_total_cur_mdBm for TRX1 and finds
it already at the target - concluding that all TRXes are done.  The FSM
then transitions to WAIT_TRX_CLOSED, and the second ack (for TRX1)
fires ramp_down_compl_cb() into the wrong state, producing:

  BTS_SHUTDOWN(...){WAIT_TRX_CLOSED}: Event BTS_SHUTDOWN_EV_TRX_RAMP_COMPL not permitted

The root cause is that p_total_cur_mdBm is a *requested* value set in
the timer callback, not a confirmed one.  The hardware confirmation
arrives asynchronously via power_trx_change_compl() -&gt;
power_ramp_do_step(), which is also where compl_cb() is invoked.

Fix by adding a 'complete' flag to trx_power_params.ramp that is:

* cleared when _power_ramp_start() begins a new ramp, and
* set just before compl_cb() is called in power_ramp_do_step()

The shutdown FSM remaining-TRX count then checks !ramp.complete instead of
comparing p_total_cur_mdBm against the target, correctly reflecting which
TRXes have actually received hardware confirmation of ramp completion.

Change-Id: Ia71393e871187d6b44b7f520eb421bab354aafd1
</comment><date>2026-03-27 18:24:49 +0700</date><id>4c6324213ac87f9979df7e6d0f596f175ddb27f6</id><msg>bts_shutdown_fsm: fix spurious RAMP_COMPL events in WAIT_TRX_CLOSED</msg><path><editType>edit</editType><file>include/osmo-bts/tx_power.h</file></path><path><editType>edit</editType><file>src/common/tx_power.c</file></path><path><editType>edit</editType><file>src/common/bts_shutdown_fsm.c</file></path></item><kind>git</kind></changeSet><culprit><absoluteUrl>https://jenkins.osmocom.org/jenkins/user/fixeria</absoluteUrl><fullName>Vadim Yanitskiy</fullName></culprit></run><run><action _class='hudson.matrix.MatrixChildParametersAction'><parameter _class='hudson.model.StringParameterValue'><name>COMMENT_TYPE</name><value></value></parameter><parameter _class='hudson.model.StringParameterValue'><name>DISTRO</name><value></value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_BRANCH</name><value>master</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_CHANGE_NUMBER</name><value>42524</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_HOST</name><value>gerrit.osmocom.org</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PATCHSET_NUMBER</name><value>1</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PATCHSET_REVISION</name><value>4c6324213ac87f9979df7e6d0f596f175ddb27f6</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PATCHSET_UPLOADER_NAME</name><value>fixeria</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PORT</name><value>29418</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PROJECT</name><value>osmo-bts</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_REFSPEC</name><value>refs/changes/24/42524/1</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_REPO_URL</name><value>ssh://jenkins@gerrit.osmocom.org:29418/osmo-bts</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>PIPELINE_BUILD_URL</name><value>https://jenkins.osmocom.org/jenkins/job/gerrit-osmo-bts/1129/</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>PROJECT_NAME</name><value>osmo-bts</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>BRANCH_CI</name><value>master</value></parameter></action><action></action><action _class='hudson.model.CauseAction'><cause _class='hudson.model.Cause$UpstreamCause'><shortDescription>Started by upstream project "gerrit-osmo-bts-build" build number 1,127</shortDescription><upstreamBuild>1127</upstreamBuild><upstreamProject>gerrit-osmo-bts-build</upstreamProject><upstreamUrl>job/gerrit-osmo-bts-build/</upstreamUrl></cause></action><action _class='jenkins.metrics.impl.TimeInQueueAction'><blockedDurationMillis>0</blockedDurationMillis><blockedTimeMillis>0</blockedTimeMillis><buildableDurationMillis>1</buildableDurationMillis><buildableTimeMillis>1</buildableTimeMillis><buildingDurationMillis>74061</buildingDurationMillis><executingTimeMillis>74061</executingTimeMillis><executorUtilization>1.0</executorUtilization><subTaskCount>0</subTaskCount><waitingDurationMillis>0</waitingDurationMillis><waitingTimeMillis>0</waitingTimeMillis></action><action></action><action _class='hudson.plugins.git.util.BuildData'><buildsByBranchName><_2023q1 _class='hudson.plugins.git.util.Build'><buildNumber>374</buildNumber><marked><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><branch><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><name>2023q1</name></branch></marked><revision><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><branch><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><name>2023q1</name></branch></revision></_2023q1><osmith1.7.1 _class='hudson.plugins.git.util.Build'><buildNumber>794</buildNumber><marked><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><branch><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><name>osmith/1.7.1</name></branch></marked><revision><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><branch><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><name>osmith/1.7.1</name></branch></revision></osmith1.7.1><osmith1.7.2 _class='hudson.plugins.git.util.Build'><buildNumber>874</buildNumber><marked><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><branch><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><name>osmith/1.7.2</name></branch></marked><revision><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><branch><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><name>osmith/1.7.2</name></branch></revision></osmith1.7.2><master _class='hudson.plugins.git.util.Build'><buildNumber>1127</buildNumber><marked><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><branch><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><name>master</name></branch></marked><revision><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><branch><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><name>master</name></branch></revision></master></buildsByBranchName><lastBuiltRevision><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><branch><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><name>master</name></branch></lastBuiltRevision><remoteUrl>ssh://jenkins@gerrit.osmocom.org:29418/osmo-bts</remoteUrl><scmName></scmName></action><action></action><action _class='org.jenkinsci.plugins.displayurlapi.actions.RunDisplayAction'></action><building>false</building><displayName>#1127</displayName><duration>74061</duration><estimatedDuration>72135</estimatedDuration><fullDisplayName>gerrit-osmo-bts-build » BTS_MODEL=oc2g,FIRMWARE_VERSION=oc2g-next,0,default,osmocom-gerrit #1127</fullDisplayName><id>1127</id><inProgress>false</inProgress><keepLog>false</keepLog><number>1127</number><queueId>74553</queueId><result>SUCCESS</result><timestamp>1774792375960</timestamp><url>https://jenkins.osmocom.org/jenkins/view/all/job/gerrit-osmo-bts-build/BTS_MODEL=oc2g,FIRMWARE_VERSION=oc2g-next,WITH_MANUALS=0,a4=default,label=osmocom-gerrit/1127/</url><builtOn>build5-deb12build-ansible</builtOn><changeSet _class='hudson.plugins.git.GitChangeSetList'><item _class='hudson.plugins.git.GitChangeSet'><affectedPath>src/common/tx_power.c</affectedPath><affectedPath>include/osmo-bts/tx_power.h</affectedPath><affectedPath>src/common/bts_shutdown_fsm.c</affectedPath><commitId>4c6324213ac87f9979df7e6d0f596f175ddb27f6</commitId><timestamp>1774610689000</timestamp><author><absoluteUrl>https://jenkins.osmocom.org/jenkins/user/fixeria</absoluteUrl><fullName>Vadim Yanitskiy</fullName></author><authorEmail>vyanitskiy@sysmocom.de</authorEmail><comment>bts_shutdown_fsm: fix spurious RAMP_COMPL events in WAIT_TRX_CLOSED

With multiple TRXes ramping down in lockstep, both their final
ramp-timer callbacks fire back-to-back in the same event loop pass,
setting p_total_cur_mdBm to the target value for both before any async
hardware acknowledgement arrives.  When the first SETPOWER ack returns
and fires ramp_down_compl_cb() for TRX0, the remaining-TRX check in
st_wait_ramp_down_compl() inspects p_total_cur_mdBm for TRX1 and finds
it already at the target - concluding that all TRXes are done.  The FSM
then transitions to WAIT_TRX_CLOSED, and the second ack (for TRX1)
fires ramp_down_compl_cb() into the wrong state, producing:

  BTS_SHUTDOWN(...){WAIT_TRX_CLOSED}: Event BTS_SHUTDOWN_EV_TRX_RAMP_COMPL not permitted

The root cause is that p_total_cur_mdBm is a *requested* value set in
the timer callback, not a confirmed one.  The hardware confirmation
arrives asynchronously via power_trx_change_compl() -&gt;
power_ramp_do_step(), which is also where compl_cb() is invoked.

Fix by adding a 'complete' flag to trx_power_params.ramp that is:

* cleared when _power_ramp_start() begins a new ramp, and
* set just before compl_cb() is called in power_ramp_do_step()

The shutdown FSM remaining-TRX count then checks !ramp.complete instead of
comparing p_total_cur_mdBm against the target, correctly reflecting which
TRXes have actually received hardware confirmation of ramp completion.

Change-Id: Ia71393e871187d6b44b7f520eb421bab354aafd1
</comment><date>2026-03-27 18:24:49 +0700</date><id>4c6324213ac87f9979df7e6d0f596f175ddb27f6</id><msg>bts_shutdown_fsm: fix spurious RAMP_COMPL events in WAIT_TRX_CLOSED</msg><path><editType>edit</editType><file>src/common/tx_power.c</file></path><path><editType>edit</editType><file>include/osmo-bts/tx_power.h</file></path><path><editType>edit</editType><file>src/common/bts_shutdown_fsm.c</file></path></item><kind>git</kind></changeSet><culprit><absoluteUrl>https://jenkins.osmocom.org/jenkins/user/fixeria</absoluteUrl><fullName>Vadim Yanitskiy</fullName></culprit></run><run><action _class='hudson.matrix.MatrixChildParametersAction'><parameter _class='hudson.model.StringParameterValue'><name>COMMENT_TYPE</name><value></value></parameter><parameter _class='hudson.model.StringParameterValue'><name>DISTRO</name><value></value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_BRANCH</name><value>master</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_CHANGE_NUMBER</name><value>42524</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_HOST</name><value>gerrit.osmocom.org</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PATCHSET_NUMBER</name><value>1</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PATCHSET_REVISION</name><value>4c6324213ac87f9979df7e6d0f596f175ddb27f6</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PATCHSET_UPLOADER_NAME</name><value>fixeria</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PORT</name><value>29418</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PROJECT</name><value>osmo-bts</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_REFSPEC</name><value>refs/changes/24/42524/1</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_REPO_URL</name><value>ssh://jenkins@gerrit.osmocom.org:29418/osmo-bts</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>PIPELINE_BUILD_URL</name><value>https://jenkins.osmocom.org/jenkins/job/gerrit-osmo-bts/1129/</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>PROJECT_NAME</name><value>osmo-bts</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>BRANCH_CI</name><value>master</value></parameter></action><action></action><action _class='hudson.model.CauseAction'><cause _class='hudson.model.Cause$UpstreamCause'><shortDescription>Started by upstream project "gerrit-osmo-bts-build" build number 1,127</shortDescription><upstreamBuild>1127</upstreamBuild><upstreamProject>gerrit-osmo-bts-build</upstreamProject><upstreamUrl>job/gerrit-osmo-bts-build/</upstreamUrl></cause></action><action _class='jenkins.metrics.impl.TimeInQueueAction'><blockedDurationMillis>0</blockedDurationMillis><blockedTimeMillis>0</blockedTimeMillis><buildableDurationMillis>0</buildableDurationMillis><buildableTimeMillis>0</buildableTimeMillis><buildingDurationMillis>73113</buildingDurationMillis><executingTimeMillis>73113</executingTimeMillis><executorUtilization>1.0</executorUtilization><subTaskCount>0</subTaskCount><waitingDurationMillis>33</waitingDurationMillis><waitingTimeMillis>33</waitingTimeMillis></action><action></action><action _class='hudson.plugins.git.util.BuildData'><buildsByBranchName><_2023q1 _class='hudson.plugins.git.util.Build'><buildNumber>374</buildNumber><marked><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><branch><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><name>2023q1</name></branch></marked><revision><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><branch><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><name>2023q1</name></branch></revision></_2023q1><osmith1.7.1 _class='hudson.plugins.git.util.Build'><buildNumber>794</buildNumber><marked><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><branch><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><name>osmith/1.7.1</name></branch></marked><revision><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><branch><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><name>osmith/1.7.1</name></branch></revision></osmith1.7.1><osmith1.7.2 _class='hudson.plugins.git.util.Build'><buildNumber>874</buildNumber><marked><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><branch><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><name>osmith/1.7.2</name></branch></marked><revision><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><branch><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><name>osmith/1.7.2</name></branch></revision></osmith1.7.2><master _class='hudson.plugins.git.util.Build'><buildNumber>1127</buildNumber><marked><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><branch><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><name>master</name></branch></marked><revision><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><branch><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><name>master</name></branch></revision></master></buildsByBranchName><lastBuiltRevision><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><branch><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><name>master</name></branch></lastBuiltRevision><remoteUrl>ssh://jenkins@gerrit.osmocom.org:29418/osmo-bts</remoteUrl><scmName></scmName></action><action></action><action _class='org.jenkinsci.plugins.displayurlapi.actions.RunDisplayAction'></action><building>false</building><displayName>#1127</displayName><duration>73113</duration><estimatedDuration>66548</estimatedDuration><fullDisplayName>gerrit-osmo-bts-build » BTS_MODEL=oct,FIRMWARE_VERSION=master,0,default,osmocom-gerrit #1127</fullDisplayName><id>1127</id><inProgress>false</inProgress><keepLog>false</keepLog><number>1127</number><queueId>74556</queueId><result>SUCCESS</result><timestamp>1774792375960</timestamp><url>https://jenkins.osmocom.org/jenkins/view/all/job/gerrit-osmo-bts-build/BTS_MODEL=oct,FIRMWARE_VERSION=master,WITH_MANUALS=0,a4=default,label=osmocom-gerrit/1127/</url><builtOn>build5-deb12build-ansible</builtOn><changeSet _class='hudson.plugins.git.GitChangeSetList'><item _class='hudson.plugins.git.GitChangeSet'><affectedPath>src/common/tx_power.c</affectedPath><affectedPath>include/osmo-bts/tx_power.h</affectedPath><affectedPath>src/common/bts_shutdown_fsm.c</affectedPath><commitId>4c6324213ac87f9979df7e6d0f596f175ddb27f6</commitId><timestamp>1774610689000</timestamp><author><absoluteUrl>https://jenkins.osmocom.org/jenkins/user/fixeria</absoluteUrl><fullName>Vadim Yanitskiy</fullName></author><authorEmail>vyanitskiy@sysmocom.de</authorEmail><comment>bts_shutdown_fsm: fix spurious RAMP_COMPL events in WAIT_TRX_CLOSED

With multiple TRXes ramping down in lockstep, both their final
ramp-timer callbacks fire back-to-back in the same event loop pass,
setting p_total_cur_mdBm to the target value for both before any async
hardware acknowledgement arrives.  When the first SETPOWER ack returns
and fires ramp_down_compl_cb() for TRX0, the remaining-TRX check in
st_wait_ramp_down_compl() inspects p_total_cur_mdBm for TRX1 and finds
it already at the target - concluding that all TRXes are done.  The FSM
then transitions to WAIT_TRX_CLOSED, and the second ack (for TRX1)
fires ramp_down_compl_cb() into the wrong state, producing:

  BTS_SHUTDOWN(...){WAIT_TRX_CLOSED}: Event BTS_SHUTDOWN_EV_TRX_RAMP_COMPL not permitted

The root cause is that p_total_cur_mdBm is a *requested* value set in
the timer callback, not a confirmed one.  The hardware confirmation
arrives asynchronously via power_trx_change_compl() -&gt;
power_ramp_do_step(), which is also where compl_cb() is invoked.

Fix by adding a 'complete' flag to trx_power_params.ramp that is:

* cleared when _power_ramp_start() begins a new ramp, and
* set just before compl_cb() is called in power_ramp_do_step()

The shutdown FSM remaining-TRX count then checks !ramp.complete instead of
comparing p_total_cur_mdBm against the target, correctly reflecting which
TRXes have actually received hardware confirmation of ramp completion.

Change-Id: Ia71393e871187d6b44b7f520eb421bab354aafd1
</comment><date>2026-03-27 18:24:49 +0700</date><id>4c6324213ac87f9979df7e6d0f596f175ddb27f6</id><msg>bts_shutdown_fsm: fix spurious RAMP_COMPL events in WAIT_TRX_CLOSED</msg><path><editType>edit</editType><file>src/common/bts_shutdown_fsm.c</file></path><path><editType>edit</editType><file>include/osmo-bts/tx_power.h</file></path><path><editType>edit</editType><file>src/common/tx_power.c</file></path></item><kind>git</kind></changeSet><culprit><absoluteUrl>https://jenkins.osmocom.org/jenkins/user/fixeria</absoluteUrl><fullName>Vadim Yanitskiy</fullName></culprit></run><run><action _class='hudson.matrix.MatrixChildParametersAction'><parameter _class='hudson.model.StringParameterValue'><name>COMMENT_TYPE</name><value></value></parameter><parameter _class='hudson.model.StringParameterValue'><name>DISTRO</name><value></value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_BRANCH</name><value>master</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_CHANGE_NUMBER</name><value>42524</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_HOST</name><value>gerrit.osmocom.org</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PATCHSET_NUMBER</name><value>1</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PATCHSET_REVISION</name><value>4c6324213ac87f9979df7e6d0f596f175ddb27f6</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PATCHSET_UPLOADER_NAME</name><value>fixeria</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PORT</name><value>29418</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PROJECT</name><value>osmo-bts</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_REFSPEC</name><value>refs/changes/24/42524/1</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_REPO_URL</name><value>ssh://jenkins@gerrit.osmocom.org:29418/osmo-bts</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>PIPELINE_BUILD_URL</name><value>https://jenkins.osmocom.org/jenkins/job/gerrit-osmo-bts/1129/</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>PROJECT_NAME</name><value>osmo-bts</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>BRANCH_CI</name><value>master</value></parameter></action><action></action><action _class='hudson.model.CauseAction'><cause _class='hudson.model.Cause$UpstreamCause'><shortDescription>Started by upstream project "gerrit-osmo-bts-build" build number 1,127</shortDescription><upstreamBuild>1127</upstreamBuild><upstreamProject>gerrit-osmo-bts-build</upstreamProject><upstreamUrl>job/gerrit-osmo-bts-build/</upstreamUrl></cause></action><action _class='jenkins.metrics.impl.TimeInQueueAction'><blockedDurationMillis>0</blockedDurationMillis><blockedTimeMillis>0</blockedTimeMillis><buildableDurationMillis>1</buildableDurationMillis><buildableTimeMillis>1</buildableTimeMillis><buildingDurationMillis>75779</buildingDurationMillis><executingTimeMillis>75779</executingTimeMillis><executorUtilization>1.0</executorUtilization><subTaskCount>0</subTaskCount><waitingDurationMillis>0</waitingDurationMillis><waitingTimeMillis>0</waitingTimeMillis></action><action></action><action _class='hudson.plugins.git.util.BuildData'><buildsByBranchName><_2023q1 _class='hudson.plugins.git.util.Build'><buildNumber>374</buildNumber><marked><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><branch><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><name>2023q1</name></branch></marked><revision><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><branch><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><name>2023q1</name></branch></revision></_2023q1><osmith1.7.1 _class='hudson.plugins.git.util.Build'><buildNumber>794</buildNumber><marked><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><branch><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><name>osmith/1.7.1</name></branch></marked><revision><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><branch><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><name>osmith/1.7.1</name></branch></revision></osmith1.7.1><osmith1.7.2 _class='hudson.plugins.git.util.Build'><buildNumber>874</buildNumber><marked><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><branch><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><name>osmith/1.7.2</name></branch></marked><revision><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><branch><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><name>osmith/1.7.2</name></branch></revision></osmith1.7.2><master _class='hudson.plugins.git.util.Build'><buildNumber>1127</buildNumber><marked><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><branch><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><name>master</name></branch></marked><revision><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><branch><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><name>master</name></branch></revision></master></buildsByBranchName><lastBuiltRevision><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><branch><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><name>master</name></branch></lastBuiltRevision><remoteUrl>ssh://jenkins@gerrit.osmocom.org:29418/osmo-bts</remoteUrl><scmName></scmName></action><action></action><action _class='org.jenkinsci.plugins.displayurlapi.actions.RunDisplayAction'></action><building>false</building><displayName>#1127</displayName><duration>75779</duration><estimatedDuration>68530</estimatedDuration><fullDisplayName>gerrit-osmo-bts-build » BTS_MODEL=oct+trx,FIRMWARE_VERSION=master,0,default,osmocom-gerrit #1127</fullDisplayName><id>1127</id><inProgress>false</inProgress><keepLog>false</keepLog><number>1127</number><queueId>74554</queueId><result>SUCCESS</result><timestamp>1774792375960</timestamp><url>https://jenkins.osmocom.org/jenkins/view/all/job/gerrit-osmo-bts-build/BTS_MODEL=oct+trx,FIRMWARE_VERSION=master,WITH_MANUALS=0,a4=default,label=osmocom-gerrit/1127/</url><builtOn>build4-deb12build-ansible</builtOn><changeSet _class='hudson.plugins.git.GitChangeSetList'><item _class='hudson.plugins.git.GitChangeSet'><affectedPath>src/common/tx_power.c</affectedPath><affectedPath>include/osmo-bts/tx_power.h</affectedPath><affectedPath>src/common/bts_shutdown_fsm.c</affectedPath><commitId>4c6324213ac87f9979df7e6d0f596f175ddb27f6</commitId><timestamp>1774610689000</timestamp><author><absoluteUrl>https://jenkins.osmocom.org/jenkins/user/fixeria</absoluteUrl><fullName>Vadim Yanitskiy</fullName></author><authorEmail>vyanitskiy@sysmocom.de</authorEmail><comment>bts_shutdown_fsm: fix spurious RAMP_COMPL events in WAIT_TRX_CLOSED

With multiple TRXes ramping down in lockstep, both their final
ramp-timer callbacks fire back-to-back in the same event loop pass,
setting p_total_cur_mdBm to the target value for both before any async
hardware acknowledgement arrives.  When the first SETPOWER ack returns
and fires ramp_down_compl_cb() for TRX0, the remaining-TRX check in
st_wait_ramp_down_compl() inspects p_total_cur_mdBm for TRX1 and finds
it already at the target - concluding that all TRXes are done.  The FSM
then transitions to WAIT_TRX_CLOSED, and the second ack (for TRX1)
fires ramp_down_compl_cb() into the wrong state, producing:

  BTS_SHUTDOWN(...){WAIT_TRX_CLOSED}: Event BTS_SHUTDOWN_EV_TRX_RAMP_COMPL not permitted

The root cause is that p_total_cur_mdBm is a *requested* value set in
the timer callback, not a confirmed one.  The hardware confirmation
arrives asynchronously via power_trx_change_compl() -&gt;
power_ramp_do_step(), which is also where compl_cb() is invoked.

Fix by adding a 'complete' flag to trx_power_params.ramp that is:

* cleared when _power_ramp_start() begins a new ramp, and
* set just before compl_cb() is called in power_ramp_do_step()

The shutdown FSM remaining-TRX count then checks !ramp.complete instead of
comparing p_total_cur_mdBm against the target, correctly reflecting which
TRXes have actually received hardware confirmation of ramp completion.

Change-Id: Ia71393e871187d6b44b7f520eb421bab354aafd1
</comment><date>2026-03-27 18:24:49 +0700</date><id>4c6324213ac87f9979df7e6d0f596f175ddb27f6</id><msg>bts_shutdown_fsm: fix spurious RAMP_COMPL events in WAIT_TRX_CLOSED</msg><path><editType>edit</editType><file>include/osmo-bts/tx_power.h</file></path><path><editType>edit</editType><file>src/common/tx_power.c</file></path><path><editType>edit</editType><file>src/common/bts_shutdown_fsm.c</file></path></item><kind>git</kind></changeSet><culprit><absoluteUrl>https://jenkins.osmocom.org/jenkins/user/fixeria</absoluteUrl><fullName>Vadim Yanitskiy</fullName></culprit></run><run><action _class='hudson.matrix.MatrixChildParametersAction'><parameter _class='hudson.model.StringParameterValue'><name>COMMENT_TYPE</name><value></value></parameter><parameter _class='hudson.model.StringParameterValue'><name>DISTRO</name><value></value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_BRANCH</name><value>master</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_CHANGE_NUMBER</name><value>42524</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_HOST</name><value>gerrit.osmocom.org</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PATCHSET_NUMBER</name><value>1</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PATCHSET_REVISION</name><value>4c6324213ac87f9979df7e6d0f596f175ddb27f6</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PATCHSET_UPLOADER_NAME</name><value>fixeria</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PORT</name><value>29418</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PROJECT</name><value>osmo-bts</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_REFSPEC</name><value>refs/changes/24/42524/1</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_REPO_URL</name><value>ssh://jenkins@gerrit.osmocom.org:29418/osmo-bts</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>PIPELINE_BUILD_URL</name><value>https://jenkins.osmocom.org/jenkins/job/gerrit-osmo-bts/1129/</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>PROJECT_NAME</name><value>osmo-bts</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>BRANCH_CI</name><value>master</value></parameter></action><action></action><action _class='hudson.model.CauseAction'><cause _class='hudson.model.Cause$UpstreamCause'><shortDescription>Started by upstream project "gerrit-osmo-bts-build" build number 1,127</shortDescription><upstreamBuild>1127</upstreamBuild><upstreamProject>gerrit-osmo-bts-build</upstreamProject><upstreamUrl>job/gerrit-osmo-bts-build/</upstreamUrl></cause></action><action _class='jenkins.metrics.impl.TimeInQueueAction'><blockedDurationMillis>0</blockedDurationMillis><blockedTimeMillis>0</blockedTimeMillis><buildableDurationMillis>1</buildableDurationMillis><buildableTimeMillis>1</buildableTimeMillis><buildingDurationMillis>93782</buildingDurationMillis><executingTimeMillis>93782</executingTimeMillis><executorUtilization>1.0</executorUtilization><subTaskCount>0</subTaskCount><waitingDurationMillis>0</waitingDurationMillis><waitingTimeMillis>0</waitingTimeMillis></action><action></action><action _class='hudson.plugins.git.util.BuildData'><buildsByBranchName><_2023q1 _class='hudson.plugins.git.util.Build'><buildNumber>374</buildNumber><marked><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><branch><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><name>2023q1</name></branch></marked><revision><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><branch><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><name>2023q1</name></branch></revision></_2023q1><osmith1.7.1 _class='hudson.plugins.git.util.Build'><buildNumber>794</buildNumber><marked><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><branch><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><name>osmith/1.7.1</name></branch></marked><revision><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><branch><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><name>osmith/1.7.1</name></branch></revision></osmith1.7.1><osmith1.7.2 _class='hudson.plugins.git.util.Build'><buildNumber>874</buildNumber><marked><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><branch><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><name>osmith/1.7.2</name></branch></marked><revision><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><branch><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><name>osmith/1.7.2</name></branch></revision></osmith1.7.2><master _class='hudson.plugins.git.util.Build'><buildNumber>1127</buildNumber><marked><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><branch><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><name>master</name></branch></marked><revision><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><branch><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><name>master</name></branch></revision></master></buildsByBranchName><lastBuiltRevision><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><branch><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><name>master</name></branch></lastBuiltRevision><remoteUrl>ssh://jenkins@gerrit.osmocom.org:29418/osmo-bts</remoteUrl><scmName></scmName></action><action></action><action _class='org.jenkinsci.plugins.displayurlapi.actions.RunDisplayAction'></action><building>false</building><displayName>#1127</displayName><duration>93782</duration><estimatedDuration>91022</estimatedDuration><fullDisplayName>gerrit-osmo-bts-build » BTS_MODEL=sysmo,FIRMWARE_VERSION=femtobts_v2.7,1,default,osmocom-gerrit #1127</fullDisplayName><id>1127</id><inProgress>false</inProgress><keepLog>false</keepLog><number>1127</number><queueId>74558</queueId><result>SUCCESS</result><timestamp>1774792375960</timestamp><url>https://jenkins.osmocom.org/jenkins/view/all/job/gerrit-osmo-bts-build/BTS_MODEL=sysmo,FIRMWARE_VERSION=femtobts_v2.7,WITH_MANUALS=1,a4=default,label=osmocom-gerrit/1127/</url><builtOn>build4-deb12build-ansible</builtOn><changeSet _class='hudson.plugins.git.GitChangeSetList'><item _class='hudson.plugins.git.GitChangeSet'><affectedPath>src/common/tx_power.c</affectedPath><affectedPath>include/osmo-bts/tx_power.h</affectedPath><affectedPath>src/common/bts_shutdown_fsm.c</affectedPath><commitId>4c6324213ac87f9979df7e6d0f596f175ddb27f6</commitId><timestamp>1774610689000</timestamp><author><absoluteUrl>https://jenkins.osmocom.org/jenkins/user/fixeria</absoluteUrl><fullName>Vadim Yanitskiy</fullName></author><authorEmail>vyanitskiy@sysmocom.de</authorEmail><comment>bts_shutdown_fsm: fix spurious RAMP_COMPL events in WAIT_TRX_CLOSED

With multiple TRXes ramping down in lockstep, both their final
ramp-timer callbacks fire back-to-back in the same event loop pass,
setting p_total_cur_mdBm to the target value for both before any async
hardware acknowledgement arrives.  When the first SETPOWER ack returns
and fires ramp_down_compl_cb() for TRX0, the remaining-TRX check in
st_wait_ramp_down_compl() inspects p_total_cur_mdBm for TRX1 and finds
it already at the target - concluding that all TRXes are done.  The FSM
then transitions to WAIT_TRX_CLOSED, and the second ack (for TRX1)
fires ramp_down_compl_cb() into the wrong state, producing:

  BTS_SHUTDOWN(...){WAIT_TRX_CLOSED}: Event BTS_SHUTDOWN_EV_TRX_RAMP_COMPL not permitted

The root cause is that p_total_cur_mdBm is a *requested* value set in
the timer callback, not a confirmed one.  The hardware confirmation
arrives asynchronously via power_trx_change_compl() -&gt;
power_ramp_do_step(), which is also where compl_cb() is invoked.

Fix by adding a 'complete' flag to trx_power_params.ramp that is:

* cleared when _power_ramp_start() begins a new ramp, and
* set just before compl_cb() is called in power_ramp_do_step()

The shutdown FSM remaining-TRX count then checks !ramp.complete instead of
comparing p_total_cur_mdBm against the target, correctly reflecting which
TRXes have actually received hardware confirmation of ramp completion.

Change-Id: Ia71393e871187d6b44b7f520eb421bab354aafd1
</comment><date>2026-03-27 18:24:49 +0700</date><id>4c6324213ac87f9979df7e6d0f596f175ddb27f6</id><msg>bts_shutdown_fsm: fix spurious RAMP_COMPL events in WAIT_TRX_CLOSED</msg><path><editType>edit</editType><file>include/osmo-bts/tx_power.h</file></path><path><editType>edit</editType><file>src/common/bts_shutdown_fsm.c</file></path><path><editType>edit</editType><file>src/common/tx_power.c</file></path></item><kind>git</kind></changeSet><culprit><absoluteUrl>https://jenkins.osmocom.org/jenkins/user/fixeria</absoluteUrl><fullName>Vadim Yanitskiy</fullName></culprit></run><run><action _class='hudson.matrix.MatrixChildParametersAction'><parameter _class='hudson.model.StringParameterValue'><name>COMMENT_TYPE</name><value></value></parameter><parameter _class='hudson.model.StringParameterValue'><name>DISTRO</name><value></value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_BRANCH</name><value>master</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_CHANGE_NUMBER</name><value>42524</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_HOST</name><value>gerrit.osmocom.org</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PATCHSET_NUMBER</name><value>1</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PATCHSET_REVISION</name><value>4c6324213ac87f9979df7e6d0f596f175ddb27f6</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PATCHSET_UPLOADER_NAME</name><value>fixeria</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PORT</name><value>29418</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PROJECT</name><value>osmo-bts</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_REFSPEC</name><value>refs/changes/24/42524/1</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_REPO_URL</name><value>ssh://jenkins@gerrit.osmocom.org:29418/osmo-bts</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>PIPELINE_BUILD_URL</name><value>https://jenkins.osmocom.org/jenkins/job/gerrit-osmo-bts/1129/</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>PROJECT_NAME</name><value>osmo-bts</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>BRANCH_CI</name><value>master</value></parameter></action><action></action><action _class='hudson.model.CauseAction'><cause _class='hudson.model.Cause$UpstreamCause'><shortDescription>Started by upstream project "gerrit-osmo-bts-build" build number 1,127</shortDescription><upstreamBuild>1127</upstreamBuild><upstreamProject>gerrit-osmo-bts-build</upstreamProject><upstreamUrl>job/gerrit-osmo-bts-build/</upstreamUrl></cause></action><action _class='jenkins.metrics.impl.TimeInQueueAction'><blockedDurationMillis>0</blockedDurationMillis><blockedTimeMillis>0</blockedTimeMillis><buildableDurationMillis>0</buildableDurationMillis><buildableTimeMillis>0</buildableTimeMillis><buildingDurationMillis>68631</buildingDurationMillis><executingTimeMillis>68631</executingTimeMillis><executorUtilization>1.0</executorUtilization><subTaskCount>0</subTaskCount><waitingDurationMillis>0</waitingDurationMillis><waitingTimeMillis>0</waitingTimeMillis></action><action></action><action _class='hudson.plugins.git.util.BuildData'><buildsByBranchName><_2023q1 _class='hudson.plugins.git.util.Build'><buildNumber>374</buildNumber><marked><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><branch><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><name>2023q1</name></branch></marked><revision><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><branch><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><name>2023q1</name></branch></revision></_2023q1><osmith1.7.1 _class='hudson.plugins.git.util.Build'><buildNumber>794</buildNumber><marked><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><branch><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><name>osmith/1.7.1</name></branch></marked><revision><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><branch><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><name>osmith/1.7.1</name></branch></revision></osmith1.7.1><osmith1.7.2 _class='hudson.plugins.git.util.Build'><buildNumber>874</buildNumber><marked><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><branch><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><name>osmith/1.7.2</name></branch></marked><revision><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><branch><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><name>osmith/1.7.2</name></branch></revision></osmith1.7.2><master _class='hudson.plugins.git.util.Build'><buildNumber>1127</buildNumber><marked><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><branch><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><name>master</name></branch></marked><revision><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><branch><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><name>master</name></branch></revision></master></buildsByBranchName><lastBuiltRevision><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><branch><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><name>master</name></branch></lastBuiltRevision><remoteUrl>ssh://jenkins@gerrit.osmocom.org:29418/osmo-bts</remoteUrl><scmName></scmName></action><action></action><action _class='org.jenkinsci.plugins.displayurlapi.actions.RunDisplayAction'></action><building>false</building><displayName>#1127</displayName><duration>68631</duration><estimatedDuration>66861</estimatedDuration><fullDisplayName>gerrit-osmo-bts-build » BTS_MODEL=sysmo,FIRMWARE_VERSION=master,0,default,osmocom-gerrit #1127</fullDisplayName><id>1127</id><inProgress>false</inProgress><keepLog>false</keepLog><number>1127</number><queueId>74551</queueId><result>SUCCESS</result><timestamp>1774792375960</timestamp><url>https://jenkins.osmocom.org/jenkins/view/all/job/gerrit-osmo-bts-build/BTS_MODEL=sysmo,FIRMWARE_VERSION=master,WITH_MANUALS=0,a4=default,label=osmocom-gerrit/1127/</url><builtOn>build4-deb12build-ansible</builtOn><changeSet _class='hudson.plugins.git.GitChangeSetList'><item _class='hudson.plugins.git.GitChangeSet'><affectedPath>src/common/tx_power.c</affectedPath><affectedPath>include/osmo-bts/tx_power.h</affectedPath><affectedPath>src/common/bts_shutdown_fsm.c</affectedPath><commitId>4c6324213ac87f9979df7e6d0f596f175ddb27f6</commitId><timestamp>1774610689000</timestamp><author><absoluteUrl>https://jenkins.osmocom.org/jenkins/user/fixeria</absoluteUrl><fullName>Vadim Yanitskiy</fullName></author><authorEmail>vyanitskiy@sysmocom.de</authorEmail><comment>bts_shutdown_fsm: fix spurious RAMP_COMPL events in WAIT_TRX_CLOSED

With multiple TRXes ramping down in lockstep, both their final
ramp-timer callbacks fire back-to-back in the same event loop pass,
setting p_total_cur_mdBm to the target value for both before any async
hardware acknowledgement arrives.  When the first SETPOWER ack returns
and fires ramp_down_compl_cb() for TRX0, the remaining-TRX check in
st_wait_ramp_down_compl() inspects p_total_cur_mdBm for TRX1 and finds
it already at the target - concluding that all TRXes are done.  The FSM
then transitions to WAIT_TRX_CLOSED, and the second ack (for TRX1)
fires ramp_down_compl_cb() into the wrong state, producing:

  BTS_SHUTDOWN(...){WAIT_TRX_CLOSED}: Event BTS_SHUTDOWN_EV_TRX_RAMP_COMPL not permitted

The root cause is that p_total_cur_mdBm is a *requested* value set in
the timer callback, not a confirmed one.  The hardware confirmation
arrives asynchronously via power_trx_change_compl() -&gt;
power_ramp_do_step(), which is also where compl_cb() is invoked.

Fix by adding a 'complete' flag to trx_power_params.ramp that is:

* cleared when _power_ramp_start() begins a new ramp, and
* set just before compl_cb() is called in power_ramp_do_step()

The shutdown FSM remaining-TRX count then checks !ramp.complete instead of
comparing p_total_cur_mdBm against the target, correctly reflecting which
TRXes have actually received hardware confirmation of ramp completion.

Change-Id: Ia71393e871187d6b44b7f520eb421bab354aafd1
</comment><date>2026-03-27 18:24:49 +0700</date><id>4c6324213ac87f9979df7e6d0f596f175ddb27f6</id><msg>bts_shutdown_fsm: fix spurious RAMP_COMPL events in WAIT_TRX_CLOSED</msg><path><editType>edit</editType><file>src/common/tx_power.c</file></path><path><editType>edit</editType><file>include/osmo-bts/tx_power.h</file></path><path><editType>edit</editType><file>src/common/bts_shutdown_fsm.c</file></path></item><kind>git</kind></changeSet><culprit><absoluteUrl>https://jenkins.osmocom.org/jenkins/user/fixeria</absoluteUrl><fullName>Vadim Yanitskiy</fullName></culprit></run><run><action _class='hudson.matrix.MatrixChildParametersAction'><parameter _class='hudson.model.StringParameterValue'><name>COMMENT_TYPE</name><value></value></parameter><parameter _class='hudson.model.StringParameterValue'><name>DISTRO</name><value></value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_BRANCH</name><value>master</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_CHANGE_NUMBER</name><value>42524</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_HOST</name><value>gerrit.osmocom.org</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PATCHSET_NUMBER</name><value>1</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PATCHSET_REVISION</name><value>4c6324213ac87f9979df7e6d0f596f175ddb27f6</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PATCHSET_UPLOADER_NAME</name><value>fixeria</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PORT</name><value>29418</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PROJECT</name><value>osmo-bts</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_REFSPEC</name><value>refs/changes/24/42524/1</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_REPO_URL</name><value>ssh://jenkins@gerrit.osmocom.org:29418/osmo-bts</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>PIPELINE_BUILD_URL</name><value>https://jenkins.osmocom.org/jenkins/job/gerrit-osmo-bts/1129/</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>PROJECT_NAME</name><value>osmo-bts</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>BRANCH_CI</name><value>master</value></parameter></action><action></action><action _class='hudson.model.CauseAction'><cause _class='hudson.model.Cause$UpstreamCause'><shortDescription>Started by upstream project "gerrit-osmo-bts-build" build number 1,127</shortDescription><upstreamBuild>1127</upstreamBuild><upstreamProject>gerrit-osmo-bts-build</upstreamProject><upstreamUrl>job/gerrit-osmo-bts-build/</upstreamUrl></cause></action><action _class='jenkins.metrics.impl.TimeInQueueAction'><blockedDurationMillis>0</blockedDurationMillis><blockedTimeMillis>0</blockedTimeMillis><buildableDurationMillis>0</buildableDurationMillis><buildableTimeMillis>0</buildableTimeMillis><buildingDurationMillis>73123</buildingDurationMillis><executingTimeMillis>73123</executingTimeMillis><executorUtilization>1.0</executorUtilization><subTaskCount>0</subTaskCount><waitingDurationMillis>0</waitingDurationMillis><waitingTimeMillis>0</waitingTimeMillis></action><action></action><action _class='hudson.plugins.git.util.BuildData'><buildsByBranchName><_2023q1 _class='hudson.plugins.git.util.Build'><buildNumber>374</buildNumber><marked><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><branch><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><name>2023q1</name></branch></marked><revision><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><branch><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><name>2023q1</name></branch></revision></_2023q1><osmith1.7.1 _class='hudson.plugins.git.util.Build'><buildNumber>794</buildNumber><marked><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><branch><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><name>osmith/1.7.1</name></branch></marked><revision><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><branch><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><name>osmith/1.7.1</name></branch></revision></osmith1.7.1><osmith1.7.2 _class='hudson.plugins.git.util.Build'><buildNumber>874</buildNumber><marked><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><branch><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><name>osmith/1.7.2</name></branch></marked><revision><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><branch><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><name>osmith/1.7.2</name></branch></revision></osmith1.7.2><master _class='hudson.plugins.git.util.Build'><buildNumber>1127</buildNumber><marked><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><branch><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><name>master</name></branch></marked><revision><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><branch><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><name>master</name></branch></revision></master></buildsByBranchName><lastBuiltRevision><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><branch><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><name>master</name></branch></lastBuiltRevision><remoteUrl>ssh://jenkins@gerrit.osmocom.org:29418/osmo-bts</remoteUrl><scmName></scmName></action><action></action><action _class='org.jenkinsci.plugins.displayurlapi.actions.RunDisplayAction'></action><building>false</building><displayName>#1127</displayName><duration>73123</duration><estimatedDuration>66870</estimatedDuration><fullDisplayName>gerrit-osmo-bts-build » BTS_MODEL=sysmo,FIRMWARE_VERSION=superfemto_v2.4,0,default,osmocom-gerrit #1127</fullDisplayName><id>1127</id><inProgress>false</inProgress><keepLog>false</keepLog><number>1127</number><queueId>74559</queueId><result>SUCCESS</result><timestamp>1774792375960</timestamp><url>https://jenkins.osmocom.org/jenkins/view/all/job/gerrit-osmo-bts-build/BTS_MODEL=sysmo,FIRMWARE_VERSION=superfemto_v2.4,WITH_MANUALS=0,a4=default,label=osmocom-gerrit/1127/</url><builtOn>build5-deb12build-ansible</builtOn><changeSet _class='hudson.plugins.git.GitChangeSetList'><item _class='hudson.plugins.git.GitChangeSet'><affectedPath>src/common/tx_power.c</affectedPath><affectedPath>include/osmo-bts/tx_power.h</affectedPath><affectedPath>src/common/bts_shutdown_fsm.c</affectedPath><commitId>4c6324213ac87f9979df7e6d0f596f175ddb27f6</commitId><timestamp>1774610689000</timestamp><author><absoluteUrl>https://jenkins.osmocom.org/jenkins/user/fixeria</absoluteUrl><fullName>Vadim Yanitskiy</fullName></author><authorEmail>vyanitskiy@sysmocom.de</authorEmail><comment>bts_shutdown_fsm: fix spurious RAMP_COMPL events in WAIT_TRX_CLOSED

With multiple TRXes ramping down in lockstep, both their final
ramp-timer callbacks fire back-to-back in the same event loop pass,
setting p_total_cur_mdBm to the target value for both before any async
hardware acknowledgement arrives.  When the first SETPOWER ack returns
and fires ramp_down_compl_cb() for TRX0, the remaining-TRX check in
st_wait_ramp_down_compl() inspects p_total_cur_mdBm for TRX1 and finds
it already at the target - concluding that all TRXes are done.  The FSM
then transitions to WAIT_TRX_CLOSED, and the second ack (for TRX1)
fires ramp_down_compl_cb() into the wrong state, producing:

  BTS_SHUTDOWN(...){WAIT_TRX_CLOSED}: Event BTS_SHUTDOWN_EV_TRX_RAMP_COMPL not permitted

The root cause is that p_total_cur_mdBm is a *requested* value set in
the timer callback, not a confirmed one.  The hardware confirmation
arrives asynchronously via power_trx_change_compl() -&gt;
power_ramp_do_step(), which is also where compl_cb() is invoked.

Fix by adding a 'complete' flag to trx_power_params.ramp that is:

* cleared when _power_ramp_start() begins a new ramp, and
* set just before compl_cb() is called in power_ramp_do_step()

The shutdown FSM remaining-TRX count then checks !ramp.complete instead of
comparing p_total_cur_mdBm against the target, correctly reflecting which
TRXes have actually received hardware confirmation of ramp completion.

Change-Id: Ia71393e871187d6b44b7f520eb421bab354aafd1
</comment><date>2026-03-27 18:24:49 +0700</date><id>4c6324213ac87f9979df7e6d0f596f175ddb27f6</id><msg>bts_shutdown_fsm: fix spurious RAMP_COMPL events in WAIT_TRX_CLOSED</msg><path><editType>edit</editType><file>src/common/bts_shutdown_fsm.c</file></path><path><editType>edit</editType><file>include/osmo-bts/tx_power.h</file></path><path><editType>edit</editType><file>src/common/tx_power.c</file></path></item><kind>git</kind></changeSet><culprit><absoluteUrl>https://jenkins.osmocom.org/jenkins/user/fixeria</absoluteUrl><fullName>Vadim Yanitskiy</fullName></culprit></run><run><action _class='hudson.matrix.MatrixChildParametersAction'><parameter _class='hudson.model.StringParameterValue'><name>COMMENT_TYPE</name><value></value></parameter><parameter _class='hudson.model.StringParameterValue'><name>DISTRO</name><value></value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_BRANCH</name><value>master</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_CHANGE_NUMBER</name><value>42524</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_HOST</name><value>gerrit.osmocom.org</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PATCHSET_NUMBER</name><value>1</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PATCHSET_REVISION</name><value>4c6324213ac87f9979df7e6d0f596f175ddb27f6</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PATCHSET_UPLOADER_NAME</name><value>fixeria</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PORT</name><value>29418</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PROJECT</name><value>osmo-bts</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_REFSPEC</name><value>refs/changes/24/42524/1</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_REPO_URL</name><value>ssh://jenkins@gerrit.osmocom.org:29418/osmo-bts</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>PIPELINE_BUILD_URL</name><value>https://jenkins.osmocom.org/jenkins/job/gerrit-osmo-bts/1129/</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>PROJECT_NAME</name><value>osmo-bts</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>BRANCH_CI</name><value>master</value></parameter></action><action></action><action _class='hudson.model.CauseAction'><cause _class='hudson.model.Cause$UpstreamCause'><shortDescription>Started by upstream project "gerrit-osmo-bts-build" build number 1,127</shortDescription><upstreamBuild>1127</upstreamBuild><upstreamProject>gerrit-osmo-bts-build</upstreamProject><upstreamUrl>job/gerrit-osmo-bts-build/</upstreamUrl></cause></action><action _class='jenkins.metrics.impl.TimeInQueueAction'><blockedDurationMillis>0</blockedDurationMillis><blockedTimeMillis>0</blockedTimeMillis><buildableDurationMillis>1</buildableDurationMillis><buildableTimeMillis>1</buildableTimeMillis><buildingDurationMillis>74184</buildingDurationMillis><executingTimeMillis>74184</executingTimeMillis><executorUtilization>1.0</executorUtilization><subTaskCount>0</subTaskCount><waitingDurationMillis>0</waitingDurationMillis><waitingTimeMillis>0</waitingTimeMillis></action><action></action><action _class='hudson.plugins.git.util.BuildData'><buildsByBranchName><_2023q1 _class='hudson.plugins.git.util.Build'><buildNumber>374</buildNumber><marked><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><branch><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><name>2023q1</name></branch></marked><revision><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><branch><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><name>2023q1</name></branch></revision></_2023q1><osmith1.7.1 _class='hudson.plugins.git.util.Build'><buildNumber>794</buildNumber><marked><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><branch><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><name>osmith/1.7.1</name></branch></marked><revision><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><branch><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><name>osmith/1.7.1</name></branch></revision></osmith1.7.1><osmith1.7.2 _class='hudson.plugins.git.util.Build'><buildNumber>874</buildNumber><marked><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><branch><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><name>osmith/1.7.2</name></branch></marked><revision><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><branch><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><name>osmith/1.7.2</name></branch></revision></osmith1.7.2><master _class='hudson.plugins.git.util.Build'><buildNumber>1127</buildNumber><marked><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><branch><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><name>master</name></branch></marked><revision><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><branch><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><name>master</name></branch></revision></master></buildsByBranchName><lastBuiltRevision><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><branch><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><name>master</name></branch></lastBuiltRevision><remoteUrl>ssh://jenkins@gerrit.osmocom.org:29418/osmo-bts</remoteUrl><scmName></scmName></action><action></action><action _class='org.jenkinsci.plugins.displayurlapi.actions.RunDisplayAction'></action><building>false</building><displayName>#1127</displayName><duration>74184</duration><estimatedDuration>67593</estimatedDuration><fullDisplayName>gerrit-osmo-bts-build » BTS_MODEL=sysmo,FIRMWARE_VERSION=superfemto_v3.0.1pre,0,default,osmocom-gerrit #1127</fullDisplayName><id>1127</id><inProgress>false</inProgress><keepLog>false</keepLog><number>1127</number><queueId>74552</queueId><result>SUCCESS</result><timestamp>1774792375960</timestamp><url>https://jenkins.osmocom.org/jenkins/view/all/job/gerrit-osmo-bts-build/BTS_MODEL=sysmo,FIRMWARE_VERSION=superfemto_v3.0.1pre,WITH_MANUALS=0,a4=default,label=osmocom-gerrit/1127/</url><builtOn>build5-deb12build-ansible</builtOn><changeSet _class='hudson.plugins.git.GitChangeSetList'><item _class='hudson.plugins.git.GitChangeSet'><affectedPath>src/common/tx_power.c</affectedPath><affectedPath>include/osmo-bts/tx_power.h</affectedPath><affectedPath>src/common/bts_shutdown_fsm.c</affectedPath><commitId>4c6324213ac87f9979df7e6d0f596f175ddb27f6</commitId><timestamp>1774610689000</timestamp><author><absoluteUrl>https://jenkins.osmocom.org/jenkins/user/fixeria</absoluteUrl><fullName>Vadim Yanitskiy</fullName></author><authorEmail>vyanitskiy@sysmocom.de</authorEmail><comment>bts_shutdown_fsm: fix spurious RAMP_COMPL events in WAIT_TRX_CLOSED

With multiple TRXes ramping down in lockstep, both their final
ramp-timer callbacks fire back-to-back in the same event loop pass,
setting p_total_cur_mdBm to the target value for both before any async
hardware acknowledgement arrives.  When the first SETPOWER ack returns
and fires ramp_down_compl_cb() for TRX0, the remaining-TRX check in
st_wait_ramp_down_compl() inspects p_total_cur_mdBm for TRX1 and finds
it already at the target - concluding that all TRXes are done.  The FSM
then transitions to WAIT_TRX_CLOSED, and the second ack (for TRX1)
fires ramp_down_compl_cb() into the wrong state, producing:

  BTS_SHUTDOWN(...){WAIT_TRX_CLOSED}: Event BTS_SHUTDOWN_EV_TRX_RAMP_COMPL not permitted

The root cause is that p_total_cur_mdBm is a *requested* value set in
the timer callback, not a confirmed one.  The hardware confirmation
arrives asynchronously via power_trx_change_compl() -&gt;
power_ramp_do_step(), which is also where compl_cb() is invoked.

Fix by adding a 'complete' flag to trx_power_params.ramp that is:

* cleared when _power_ramp_start() begins a new ramp, and
* set just before compl_cb() is called in power_ramp_do_step()

The shutdown FSM remaining-TRX count then checks !ramp.complete instead of
comparing p_total_cur_mdBm against the target, correctly reflecting which
TRXes have actually received hardware confirmation of ramp completion.

Change-Id: Ia71393e871187d6b44b7f520eb421bab354aafd1
</comment><date>2026-03-27 18:24:49 +0700</date><id>4c6324213ac87f9979df7e6d0f596f175ddb27f6</id><msg>bts_shutdown_fsm: fix spurious RAMP_COMPL events in WAIT_TRX_CLOSED</msg><path><editType>edit</editType><file>src/common/tx_power.c</file></path><path><editType>edit</editType><file>include/osmo-bts/tx_power.h</file></path><path><editType>edit</editType><file>src/common/bts_shutdown_fsm.c</file></path></item><kind>git</kind></changeSet><culprit><absoluteUrl>https://jenkins.osmocom.org/jenkins/user/fixeria</absoluteUrl><fullName>Vadim Yanitskiy</fullName></culprit></run><run><action _class='hudson.matrix.MatrixChildParametersAction'><parameter _class='hudson.model.StringParameterValue'><name>COMMENT_TYPE</name><value></value></parameter><parameter _class='hudson.model.StringParameterValue'><name>DISTRO</name><value></value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_BRANCH</name><value>master</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_CHANGE_NUMBER</name><value>42524</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_HOST</name><value>gerrit.osmocom.org</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PATCHSET_NUMBER</name><value>1</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PATCHSET_REVISION</name><value>4c6324213ac87f9979df7e6d0f596f175ddb27f6</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PATCHSET_UPLOADER_NAME</name><value>fixeria</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PORT</name><value>29418</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PROJECT</name><value>osmo-bts</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_REFSPEC</name><value>refs/changes/24/42524/1</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_REPO_URL</name><value>ssh://jenkins@gerrit.osmocom.org:29418/osmo-bts</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>PIPELINE_BUILD_URL</name><value>https://jenkins.osmocom.org/jenkins/job/gerrit-osmo-bts/1129/</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>PROJECT_NAME</name><value>osmo-bts</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>BRANCH_CI</name><value>master</value></parameter></action><action></action><action _class='hudson.model.CauseAction'><cause _class='hudson.model.Cause$UpstreamCause'><shortDescription>Started by upstream project "gerrit-osmo-bts-build" build number 1,127</shortDescription><upstreamBuild>1127</upstreamBuild><upstreamProject>gerrit-osmo-bts-build</upstreamProject><upstreamUrl>job/gerrit-osmo-bts-build/</upstreamUrl></cause></action><action _class='jenkins.metrics.impl.TimeInQueueAction'><blockedDurationMillis>0</blockedDurationMillis><blockedTimeMillis>0</blockedTimeMillis><buildableDurationMillis>0</buildableDurationMillis><buildableTimeMillis>0</buildableTimeMillis><buildingDurationMillis>69328</buildingDurationMillis><executingTimeMillis>69328</executingTimeMillis><executorUtilization>1.0</executorUtilization><subTaskCount>0</subTaskCount><waitingDurationMillis>0</waitingDurationMillis><waitingTimeMillis>0</waitingTimeMillis></action><action></action><action _class='hudson.plugins.git.util.BuildData'><buildsByBranchName><_2023q1 _class='hudson.plugins.git.util.Build'><buildNumber>374</buildNumber><marked><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><branch><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><name>2023q1</name></branch></marked><revision><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><branch><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><name>2023q1</name></branch></revision></_2023q1><osmith1.7.1 _class='hudson.plugins.git.util.Build'><buildNumber>794</buildNumber><marked><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><branch><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><name>osmith/1.7.1</name></branch></marked><revision><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><branch><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><name>osmith/1.7.1</name></branch></revision></osmith1.7.1><osmith1.7.2 _class='hudson.plugins.git.util.Build'><buildNumber>874</buildNumber><marked><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><branch><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><name>osmith/1.7.2</name></branch></marked><revision><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><branch><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><name>osmith/1.7.2</name></branch></revision></osmith1.7.2><master _class='hudson.plugins.git.util.Build'><buildNumber>1127</buildNumber><marked><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><branch><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><name>master</name></branch></marked><revision><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><branch><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><name>master</name></branch></revision></master></buildsByBranchName><lastBuiltRevision><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><branch><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><name>master</name></branch></lastBuiltRevision><remoteUrl>ssh://jenkins@gerrit.osmocom.org:29418/osmo-bts</remoteUrl><scmName></scmName></action><action></action><action _class='org.jenkinsci.plugins.displayurlapi.actions.RunDisplayAction'></action><building>false</building><displayName>#1127</displayName><duration>69328</duration><estimatedDuration>65669</estimatedDuration><fullDisplayName>gerrit-osmo-bts-build » BTS_MODEL=sysmo,FIRMWARE_VERSION=superfemto_v3.1,0,default,osmocom-gerrit #1127</fullDisplayName><id>1127</id><inProgress>false</inProgress><keepLog>false</keepLog><number>1127</number><queueId>74555</queueId><result>SUCCESS</result><timestamp>1774792375960</timestamp><url>https://jenkins.osmocom.org/jenkins/view/all/job/gerrit-osmo-bts-build/BTS_MODEL=sysmo,FIRMWARE_VERSION=superfemto_v3.1,WITH_MANUALS=0,a4=default,label=osmocom-gerrit/1127/</url><builtOn>build4-deb12build-ansible</builtOn><changeSet _class='hudson.plugins.git.GitChangeSetList'><item _class='hudson.plugins.git.GitChangeSet'><affectedPath>src/common/tx_power.c</affectedPath><affectedPath>include/osmo-bts/tx_power.h</affectedPath><affectedPath>src/common/bts_shutdown_fsm.c</affectedPath><commitId>4c6324213ac87f9979df7e6d0f596f175ddb27f6</commitId><timestamp>1774610689000</timestamp><author><absoluteUrl>https://jenkins.osmocom.org/jenkins/user/fixeria</absoluteUrl><fullName>Vadim Yanitskiy</fullName></author><authorEmail>vyanitskiy@sysmocom.de</authorEmail><comment>bts_shutdown_fsm: fix spurious RAMP_COMPL events in WAIT_TRX_CLOSED

With multiple TRXes ramping down in lockstep, both their final
ramp-timer callbacks fire back-to-back in the same event loop pass,
setting p_total_cur_mdBm to the target value for both before any async
hardware acknowledgement arrives.  When the first SETPOWER ack returns
and fires ramp_down_compl_cb() for TRX0, the remaining-TRX check in
st_wait_ramp_down_compl() inspects p_total_cur_mdBm for TRX1 and finds
it already at the target - concluding that all TRXes are done.  The FSM
then transitions to WAIT_TRX_CLOSED, and the second ack (for TRX1)
fires ramp_down_compl_cb() into the wrong state, producing:

  BTS_SHUTDOWN(...){WAIT_TRX_CLOSED}: Event BTS_SHUTDOWN_EV_TRX_RAMP_COMPL not permitted

The root cause is that p_total_cur_mdBm is a *requested* value set in
the timer callback, not a confirmed one.  The hardware confirmation
arrives asynchronously via power_trx_change_compl() -&gt;
power_ramp_do_step(), which is also where compl_cb() is invoked.

Fix by adding a 'complete' flag to trx_power_params.ramp that is:

* cleared when _power_ramp_start() begins a new ramp, and
* set just before compl_cb() is called in power_ramp_do_step()

The shutdown FSM remaining-TRX count then checks !ramp.complete instead of
comparing p_total_cur_mdBm against the target, correctly reflecting which
TRXes have actually received hardware confirmation of ramp completion.

Change-Id: Ia71393e871187d6b44b7f520eb421bab354aafd1
</comment><date>2026-03-27 18:24:49 +0700</date><id>4c6324213ac87f9979df7e6d0f596f175ddb27f6</id><msg>bts_shutdown_fsm: fix spurious RAMP_COMPL events in WAIT_TRX_CLOSED</msg><path><editType>edit</editType><file>src/common/bts_shutdown_fsm.c</file></path><path><editType>edit</editType><file>include/osmo-bts/tx_power.h</file></path><path><editType>edit</editType><file>src/common/tx_power.c</file></path></item><kind>git</kind></changeSet><culprit><absoluteUrl>https://jenkins.osmocom.org/jenkins/user/fixeria</absoluteUrl><fullName>Vadim Yanitskiy</fullName></culprit></run><run><action _class='hudson.matrix.MatrixChildParametersAction'><parameter _class='hudson.model.StringParameterValue'><name>COMMENT_TYPE</name><value></value></parameter><parameter _class='hudson.model.StringParameterValue'><name>DISTRO</name><value></value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_BRANCH</name><value>master</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_CHANGE_NUMBER</name><value>42524</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_HOST</name><value>gerrit.osmocom.org</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PATCHSET_NUMBER</name><value>1</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PATCHSET_REVISION</name><value>4c6324213ac87f9979df7e6d0f596f175ddb27f6</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PATCHSET_UPLOADER_NAME</name><value>fixeria</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PORT</name><value>29418</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PROJECT</name><value>osmo-bts</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_REFSPEC</name><value>refs/changes/24/42524/1</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_REPO_URL</name><value>ssh://jenkins@gerrit.osmocom.org:29418/osmo-bts</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>PIPELINE_BUILD_URL</name><value>https://jenkins.osmocom.org/jenkins/job/gerrit-osmo-bts/1129/</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>PROJECT_NAME</name><value>osmo-bts</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>BRANCH_CI</name><value>master</value></parameter></action><action></action><action _class='hudson.model.CauseAction'><cause _class='hudson.model.Cause$UpstreamCause'><shortDescription>Started by upstream project "gerrit-osmo-bts-build" build number 1,127</shortDescription><upstreamBuild>1127</upstreamBuild><upstreamProject>gerrit-osmo-bts-build</upstreamProject><upstreamUrl>job/gerrit-osmo-bts-build/</upstreamUrl></cause></action><action _class='jenkins.metrics.impl.TimeInQueueAction'><blockedDurationMillis>0</blockedDurationMillis><blockedTimeMillis>0</blockedTimeMillis><buildableDurationMillis>69607</buildableDurationMillis><buildableTimeMillis>69607</buildableTimeMillis><buildingDurationMillis>57506</buildingDurationMillis><executingTimeMillis>57506</executingTimeMillis><executorUtilization>1.0</executorUtilization><subTaskCount>0</subTaskCount><waitingDurationMillis>0</waitingDurationMillis><waitingTimeMillis>0</waitingTimeMillis></action><action></action><action _class='hudson.plugins.git.util.BuildData'><buildsByBranchName><_2023q1 _class='hudson.plugins.git.util.Build'><buildNumber>374</buildNumber><marked><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><branch><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><name>2023q1</name></branch></marked><revision><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><branch><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><name>2023q1</name></branch></revision></_2023q1><osmith1.7.1 _class='hudson.plugins.git.util.Build'><buildNumber>794</buildNumber><marked><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><branch><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><name>osmith/1.7.1</name></branch></marked><revision><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><branch><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><name>osmith/1.7.1</name></branch></revision></osmith1.7.1><osmith1.7.2 _class='hudson.plugins.git.util.Build'><buildNumber>874</buildNumber><marked><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><branch><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><name>osmith/1.7.2</name></branch></marked><revision><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><branch><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><name>osmith/1.7.2</name></branch></revision></osmith1.7.2><master _class='hudson.plugins.git.util.Build'><buildNumber>1127</buildNumber><marked><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><branch><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><name>master</name></branch></marked><revision><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><branch><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><name>master</name></branch></revision></master></buildsByBranchName><lastBuiltRevision><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><branch><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><name>master</name></branch></lastBuiltRevision><remoteUrl>ssh://jenkins@gerrit.osmocom.org:29418/osmo-bts</remoteUrl><scmName></scmName></action><action></action><action _class='org.jenkinsci.plugins.displayurlapi.actions.RunDisplayAction'></action><building>false</building><displayName>#1127</displayName><duration>57506</duration><estimatedDuration>68156</estimatedDuration><fullDisplayName>gerrit-osmo-bts-build » BTS_MODEL=sysmo,FIRMWARE_VERSION=superfemto_v5.1,0,default,osmocom-gerrit #1127</fullDisplayName><id>1127</id><inProgress>false</inProgress><keepLog>false</keepLog><number>1127</number><queueId>74564</queueId><result>SUCCESS</result><timestamp>1774792375960</timestamp><url>https://jenkins.osmocom.org/jenkins/view/all/job/gerrit-osmo-bts-build/BTS_MODEL=sysmo,FIRMWARE_VERSION=superfemto_v5.1,WITH_MANUALS=0,a4=default,label=osmocom-gerrit/1127/</url><builtOn>build4-deb12build-ansible</builtOn><changeSet _class='hudson.plugins.git.GitChangeSetList'><item _class='hudson.plugins.git.GitChangeSet'><affectedPath>src/common/tx_power.c</affectedPath><affectedPath>include/osmo-bts/tx_power.h</affectedPath><affectedPath>src/common/bts_shutdown_fsm.c</affectedPath><commitId>4c6324213ac87f9979df7e6d0f596f175ddb27f6</commitId><timestamp>1774610689000</timestamp><author><absoluteUrl>https://jenkins.osmocom.org/jenkins/user/fixeria</absoluteUrl><fullName>Vadim Yanitskiy</fullName></author><authorEmail>vyanitskiy@sysmocom.de</authorEmail><comment>bts_shutdown_fsm: fix spurious RAMP_COMPL events in WAIT_TRX_CLOSED

With multiple TRXes ramping down in lockstep, both their final
ramp-timer callbacks fire back-to-back in the same event loop pass,
setting p_total_cur_mdBm to the target value for both before any async
hardware acknowledgement arrives.  When the first SETPOWER ack returns
and fires ramp_down_compl_cb() for TRX0, the remaining-TRX check in
st_wait_ramp_down_compl() inspects p_total_cur_mdBm for TRX1 and finds
it already at the target - concluding that all TRXes are done.  The FSM
then transitions to WAIT_TRX_CLOSED, and the second ack (for TRX1)
fires ramp_down_compl_cb() into the wrong state, producing:

  BTS_SHUTDOWN(...){WAIT_TRX_CLOSED}: Event BTS_SHUTDOWN_EV_TRX_RAMP_COMPL not permitted

The root cause is that p_total_cur_mdBm is a *requested* value set in
the timer callback, not a confirmed one.  The hardware confirmation
arrives asynchronously via power_trx_change_compl() -&gt;
power_ramp_do_step(), which is also where compl_cb() is invoked.

Fix by adding a 'complete' flag to trx_power_params.ramp that is:

* cleared when _power_ramp_start() begins a new ramp, and
* set just before compl_cb() is called in power_ramp_do_step()

The shutdown FSM remaining-TRX count then checks !ramp.complete instead of
comparing p_total_cur_mdBm against the target, correctly reflecting which
TRXes have actually received hardware confirmation of ramp completion.

Change-Id: Ia71393e871187d6b44b7f520eb421bab354aafd1
</comment><date>2026-03-27 18:24:49 +0700</date><id>4c6324213ac87f9979df7e6d0f596f175ddb27f6</id><msg>bts_shutdown_fsm: fix spurious RAMP_COMPL events in WAIT_TRX_CLOSED</msg><path><editType>edit</editType><file>include/osmo-bts/tx_power.h</file></path><path><editType>edit</editType><file>src/common/tx_power.c</file></path><path><editType>edit</editType><file>src/common/bts_shutdown_fsm.c</file></path></item><kind>git</kind></changeSet><culprit><absoluteUrl>https://jenkins.osmocom.org/jenkins/user/fixeria</absoluteUrl><fullName>Vadim Yanitskiy</fullName></culprit></run><run><action _class='hudson.matrix.MatrixChildParametersAction'><parameter _class='hudson.model.StringParameterValue'><name>COMMENT_TYPE</name><value></value></parameter><parameter _class='hudson.model.StringParameterValue'><name>DISTRO</name><value></value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_BRANCH</name><value>master</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_CHANGE_NUMBER</name><value>42524</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_HOST</name><value>gerrit.osmocom.org</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PATCHSET_NUMBER</name><value>1</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PATCHSET_REVISION</name><value>4c6324213ac87f9979df7e6d0f596f175ddb27f6</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PATCHSET_UPLOADER_NAME</name><value>fixeria</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PORT</name><value>29418</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PROJECT</name><value>osmo-bts</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_REFSPEC</name><value>refs/changes/24/42524/1</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_REPO_URL</name><value>ssh://jenkins@gerrit.osmocom.org:29418/osmo-bts</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>PIPELINE_BUILD_URL</name><value>https://jenkins.osmocom.org/jenkins/job/gerrit-osmo-bts/1129/</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>PROJECT_NAME</name><value>osmo-bts</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>BRANCH_CI</name><value>master</value></parameter></action><action></action><action _class='hudson.model.CauseAction'><cause _class='hudson.model.Cause$UpstreamCause'><shortDescription>Started by upstream project "gerrit-osmo-bts-build" build number 1,127</shortDescription><upstreamBuild>1127</upstreamBuild><upstreamProject>gerrit-osmo-bts-build</upstreamProject><upstreamUrl>job/gerrit-osmo-bts-build/</upstreamUrl></cause></action><action _class='jenkins.metrics.impl.TimeInQueueAction'><blockedDurationMillis>0</blockedDurationMillis><blockedTimeMillis>0</blockedTimeMillis><buildableDurationMillis>0</buildableDurationMillis><buildableTimeMillis>0</buildableTimeMillis><buildingDurationMillis>68545</buildingDurationMillis><executingTimeMillis>68545</executingTimeMillis><executorUtilization>1.0</executorUtilization><subTaskCount>0</subTaskCount><waitingDurationMillis>0</waitingDurationMillis><waitingTimeMillis>0</waitingTimeMillis></action><action></action><action _class='hudson.plugins.git.util.BuildData'><buildsByBranchName><_2023q1 _class='hudson.plugins.git.util.Build'><buildNumber>374</buildNumber><marked><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><branch><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><name>2023q1</name></branch></marked><revision><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><branch><SHA1>bfdc23b1c676d017da2c1dff26d937be9c9926e2</SHA1><name>2023q1</name></branch></revision></_2023q1><osmith1.7.1 _class='hudson.plugins.git.util.Build'><buildNumber>794</buildNumber><marked><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><branch><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><name>osmith/1.7.1</name></branch></marked><revision><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><branch><SHA1>f79a23bab0e43959d25363d2a4903127e0a1cb3a</SHA1><name>osmith/1.7.1</name></branch></revision></osmith1.7.1><osmith1.7.2 _class='hudson.plugins.git.util.Build'><buildNumber>874</buildNumber><marked><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><branch><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><name>osmith/1.7.2</name></branch></marked><revision><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><branch><SHA1>75a087d16ba2539b8bcf05102b41d820e8187241</SHA1><name>osmith/1.7.2</name></branch></revision></osmith1.7.2><master _class='hudson.plugins.git.util.Build'><buildNumber>1127</buildNumber><marked><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><branch><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><name>master</name></branch></marked><revision><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><branch><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><name>master</name></branch></revision></master></buildsByBranchName><lastBuiltRevision><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><branch><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><name>master</name></branch></lastBuiltRevision><remoteUrl>ssh://jenkins@gerrit.osmocom.org:29418/osmo-bts</remoteUrl><scmName></scmName></action><action></action><action _class='org.jenkinsci.plugins.displayurlapi.actions.RunDisplayAction'></action><building>false</building><displayName>#1127</displayName><duration>68545</duration><estimatedDuration>64908</estimatedDuration><fullDisplayName>gerrit-osmo-bts-build » BTS_MODEL=trx,FIRMWARE_VERSION=master,0,default,osmocom-gerrit #1127</fullDisplayName><id>1127</id><inProgress>false</inProgress><keepLog>false</keepLog><number>1127</number><queueId>74557</queueId><result>SUCCESS</result><timestamp>1774792375960</timestamp><url>https://jenkins.osmocom.org/jenkins/view/all/job/gerrit-osmo-bts-build/BTS_MODEL=trx,FIRMWARE_VERSION=master,WITH_MANUALS=0,a4=default,label=osmocom-gerrit/1127/</url><builtOn>build4-deb12build-ansible</builtOn><changeSet _class='hudson.plugins.git.GitChangeSetList'><item _class='hudson.plugins.git.GitChangeSet'><affectedPath>src/common/tx_power.c</affectedPath><affectedPath>include/osmo-bts/tx_power.h</affectedPath><affectedPath>src/common/bts_shutdown_fsm.c</affectedPath><commitId>4c6324213ac87f9979df7e6d0f596f175ddb27f6</commitId><timestamp>1774610689000</timestamp><author><absoluteUrl>https://jenkins.osmocom.org/jenkins/user/fixeria</absoluteUrl><fullName>Vadim Yanitskiy</fullName></author><authorEmail>vyanitskiy@sysmocom.de</authorEmail><comment>bts_shutdown_fsm: fix spurious RAMP_COMPL events in WAIT_TRX_CLOSED

With multiple TRXes ramping down in lockstep, both their final
ramp-timer callbacks fire back-to-back in the same event loop pass,
setting p_total_cur_mdBm to the target value for both before any async
hardware acknowledgement arrives.  When the first SETPOWER ack returns
and fires ramp_down_compl_cb() for TRX0, the remaining-TRX check in
st_wait_ramp_down_compl() inspects p_total_cur_mdBm for TRX1 and finds
it already at the target - concluding that all TRXes are done.  The FSM
then transitions to WAIT_TRX_CLOSED, and the second ack (for TRX1)
fires ramp_down_compl_cb() into the wrong state, producing:

  BTS_SHUTDOWN(...){WAIT_TRX_CLOSED}: Event BTS_SHUTDOWN_EV_TRX_RAMP_COMPL not permitted

The root cause is that p_total_cur_mdBm is a *requested* value set in
the timer callback, not a confirmed one.  The hardware confirmation
arrives asynchronously via power_trx_change_compl() -&gt;
power_ramp_do_step(), which is also where compl_cb() is invoked.

Fix by adding a 'complete' flag to trx_power_params.ramp that is:

* cleared when _power_ramp_start() begins a new ramp, and
* set just before compl_cb() is called in power_ramp_do_step()

The shutdown FSM remaining-TRX count then checks !ramp.complete instead of
comparing p_total_cur_mdBm against the target, correctly reflecting which
TRXes have actually received hardware confirmation of ramp completion.

Change-Id: Ia71393e871187d6b44b7f520eb421bab354aafd1
</comment><date>2026-03-27 18:24:49 +0700</date><id>4c6324213ac87f9979df7e6d0f596f175ddb27f6</id><msg>bts_shutdown_fsm: fix spurious RAMP_COMPL events in WAIT_TRX_CLOSED</msg><path><editType>edit</editType><file>src/common/tx_power.c</file></path><path><editType>edit</editType><file>include/osmo-bts/tx_power.h</file></path><path><editType>edit</editType><file>src/common/bts_shutdown_fsm.c</file></path></item><kind>git</kind></changeSet><culprit><absoluteUrl>https://jenkins.osmocom.org/jenkins/user/fixeria</absoluteUrl><fullName>Vadim Yanitskiy</fullName></culprit></run><run><action _class='hudson.matrix.MatrixChildParametersAction'><parameter _class='hudson.model.StringParameterValue'><name>COMMENT_TYPE</name><value></value></parameter><parameter _class='hudson.model.StringParameterValue'><name>DISTRO</name><value></value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_BRANCH</name><value>master</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_CHANGE_NUMBER</name><value>42524</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_HOST</name><value>gerrit.osmocom.org</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PATCHSET_NUMBER</name><value>1</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PATCHSET_REVISION</name><value>4c6324213ac87f9979df7e6d0f596f175ddb27f6</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PATCHSET_UPLOADER_NAME</name><value>fixeria</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PORT</name><value>29418</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_PROJECT</name><value>osmo-bts</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_REFSPEC</name><value>refs/changes/24/42524/1</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>GERRIT_REPO_URL</name><value>ssh://jenkins@gerrit.osmocom.org:29418/osmo-bts</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>PIPELINE_BUILD_URL</name><value>https://jenkins.osmocom.org/jenkins/job/gerrit-osmo-bts/1129/</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>PROJECT_NAME</name><value>osmo-bts</value></parameter><parameter _class='hudson.model.StringParameterValue'><name>BRANCH_CI</name><value>master</value></parameter></action><action></action><action _class='hudson.model.CauseAction'><cause _class='hudson.model.Cause$UpstreamCause'><shortDescription>Started by upstream project "gerrit-osmo-bts-build" build number 1,127</shortDescription><upstreamBuild>1127</upstreamBuild><upstreamProject>gerrit-osmo-bts-build</upstreamProject><upstreamUrl>job/gerrit-osmo-bts-build/</upstreamUrl></cause></action><action _class='jenkins.metrics.impl.TimeInQueueAction'><blockedDurationMillis>0</blockedDurationMillis><blockedTimeMillis>0</blockedTimeMillis><buildableDurationMillis>1</buildableDurationMillis><buildableTimeMillis>1</buildableTimeMillis><buildingDurationMillis>226867</buildingDurationMillis><executingTimeMillis>226867</executingTimeMillis><executorUtilization>1.0</executorUtilization><subTaskCount>0</subTaskCount><waitingDurationMillis>0</waitingDurationMillis><waitingTimeMillis>0</waitingTimeMillis></action><action></action><action _class='hudson.plugins.git.util.BuildData'><buildsByBranchName><master _class='hudson.plugins.git.util.Build'><buildNumber>1127</buildNumber><marked><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><branch><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><name>master</name></branch></marked><revision><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><branch><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><name>master</name></branch></revision></master></buildsByBranchName><lastBuiltRevision><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><branch><SHA1>4c6324213ac87f9979df7e6d0f596f175ddb27f6</SHA1><name>master</name></branch></lastBuiltRevision><remoteUrl>ssh://jenkins@gerrit.osmocom.org:29418/osmo-bts</remoteUrl><scmName></scmName></action><action></action><action _class='org.jenkinsci.plugins.displayurlapi.actions.RunDisplayAction'></action><building>false</building><displayName>#1127</displayName><duration>226867</duration><estimatedDuration>220304</estimatedDuration><fullDisplayName>gerrit-osmo-bts-build » BTS_MODEL=trx,FIRMWARE_VERSION=master,0,default,raspbian #1127</fullDisplayName><id>1127</id><inProgress>false</inProgress><keepLog>false</keepLog><number>1127</number><queueId>74563</queueId><result>SUCCESS</result><timestamp>1774792375960</timestamp><url>https://jenkins.osmocom.org/jenkins/view/all/job/gerrit-osmo-bts-build/BTS_MODEL=trx,FIRMWARE_VERSION=master,WITH_MANUALS=0,a4=default,label=raspbian/1127/</url><builtOn>lx2-raspbian12build-ansible</builtOn><changeSet _class='hudson.plugins.git.GitChangeSetList'><item _class='hudson.plugins.git.GitChangeSet'><affectedPath>src/common/tx_power.c</affectedPath><affectedPath>include/osmo-bts/tx_power.h</affectedPath><affectedPath>src/common/bts_shutdown_fsm.c</affectedPath><commitId>4c6324213ac87f9979df7e6d0f596f175ddb27f6</commitId><timestamp>1774610689000</timestamp><author><absoluteUrl>https://jenkins.osmocom.org/jenkins/user/fixeria</absoluteUrl><fullName>Vadim Yanitskiy</fullName></author><authorEmail>vyanitskiy@sysmocom.de</authorEmail><comment>bts_shutdown_fsm: fix spurious RAMP_COMPL events in WAIT_TRX_CLOSED

With multiple TRXes ramping down in lockstep, both their final
ramp-timer callbacks fire back-to-back in the same event loop pass,
setting p_total_cur_mdBm to the target value for both before any async
hardware acknowledgement arrives.  When the first SETPOWER ack returns
and fires ramp_down_compl_cb() for TRX0, the remaining-TRX check in
st_wait_ramp_down_compl() inspects p_total_cur_mdBm for TRX1 and finds
it already at the target - concluding that all TRXes are done.  The FSM
then transitions to WAIT_TRX_CLOSED, and the second ack (for TRX1)
fires ramp_down_compl_cb() into the wrong state, producing:

  BTS_SHUTDOWN(...){WAIT_TRX_CLOSED}: Event BTS_SHUTDOWN_EV_TRX_RAMP_COMPL not permitted

The root cause is that p_total_cur_mdBm is a *requested* value set in
the timer callback, not a confirmed one.  The hardware confirmation
arrives asynchronously via power_trx_change_compl() -&gt;
power_ramp_do_step(), which is also where compl_cb() is invoked.

Fix by adding a 'complete' flag to trx_power_params.ramp that is:

* cleared when _power_ramp_start() begins a new ramp, and
* set just before compl_cb() is called in power_ramp_do_step()

The shutdown FSM remaining-TRX count then checks !ramp.complete instead of
comparing p_total_cur_mdBm against the target, correctly reflecting which
TRXes have actually received hardware confirmation of ramp completion.

Change-Id: Ia71393e871187d6b44b7f520eb421bab354aafd1
</comment><date>2026-03-27 18:24:49 +0700</date><id>4c6324213ac87f9979df7e6d0f596f175ddb27f6</id><msg>bts_shutdown_fsm: fix spurious RAMP_COMPL events in WAIT_TRX_CLOSED</msg><path><editType>edit</editType><file>include/osmo-bts/tx_power.h</file></path><path><editType>edit</editType><file>src/common/bts_shutdown_fsm.c</file></path><path><editType>edit</editType><file>src/common/tx_power.c</file></path></item><kind>git</kind></changeSet><culprit><absoluteUrl>https://jenkins.osmocom.org/jenkins/user/fixeria</absoluteUrl><fullName>Vadim Yanitskiy</fullName></culprit></run></matrixBuild>