Skip to content

Commit 7b2a233

Browse files
committed
[cleanup] Add flag to skip PDA module removal
1 parent f5b8106 commit 7b2a233

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

src/CommandLineUtilities/ProgramCleanup.cxx

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,11 @@ class ProgramCleanup : public Program
3939
return { "Cleanup", "Cleans up ReadoutCard state", "roc-cleanup" };
4040
}
4141

42-
virtual void addOptions(po::options_description&)
42+
virtual void addOptions(po::options_description& options)
4343
{
44+
options.add_options()("light",
45+
po::bool_switch(&mOptions.light)->default_value(false),
46+
"Flag to run a \"light\" roc-cleanup, skipping PDA module removal");
4447
}
4548

4649
virtual void run(const po::variables_map&)
@@ -53,7 +56,9 @@ class ProgramCleanup : public Program
5356
std::cout << "1. Free PDA DMA buffers" << std::endl;
5457
std::cout << "2. Clean CRORC FIFO shared memory files under /dev/shm which match AliceO2_ROC_*" << std::endl;
5558
std::cout << "3. Clean all hugepage resources under /var/lib/hugetlbfs/global/pagesize-{2MB, 1GB}/ which match readout* and roc-bench-dma*" << std::endl;
56-
std::cout << "4. Remove and reinsert the uio_pci_dma kernel module" << std::endl;
59+
if (!mOptions.light) {
60+
std::cout << "4. Remove and reinsert the uio_pci_dma kernel module" << std::endl;
61+
}
5762
std::cout << std::endl;
5863
std::cout << "In case instances of readout.exe or roc-bench-dma are running, they will fail." << std::endl;
5964
std::cout << std::endl;
@@ -79,13 +84,18 @@ class ProgramCleanup : public Program
7984
std::cout << "Removing roc-bench-dma 1GB hugepage mappings" << std::endl;
8085
system("rm /var/lib/hugetlbfs/global/pagesize-1GB/roc-bench-dma*");
8186

82-
std::cout << "Removing uio_pci_dma" << std::endl;
83-
system("modprobe -r uio_pci_dma");
84-
std::cout << "Reinserting uio_pci_dma" << std::endl;
85-
system("modprobe uio_pci_dma");
87+
if (!mOptions.light) {
88+
std::cout << "Removing uio_pci_dma" << std::endl;
89+
system("modprobe -r uio_pci_dma");
90+
std::cout << "Reinserting uio_pci_dma" << std::endl;
91+
system("modprobe uio_pci_dma");
92+
}
8693
}
8794

8895
private:
96+
struct OptionsStruct {
97+
bool light = false;
98+
} mOptions;
8999
};
90100

91101
int main(int argc, char** argv)

0 commit comments

Comments
 (0)