Skip to content

Commit fd63d0a

Browse files
Add documentation about PDA, C-RORC
1 parent 69d89be commit fd63d0a

File tree

3 files changed

+19
-11
lines changed

3 files changed

+19
-11
lines changed

README.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,10 @@ DMA can be paused and resumed at any time using `stopDma()` and `startDma()`
100100

101101
## Note for when bad things happen
102102
The driver uses some files in shared memory:
103-
* `/dev/shm/alice_o2/rorc/[PCI address]/channel_[channel number]/fifo` - For card FIFOs
104-
* `/dev/shm/alice_o2/rorc/[PCI address]/channel_[channel number]/.lock` - For locking channels
105-
* `/dev/shm/sem.alice_o2_rorc_[PCI address]_channel_[channel number].mutex` - For locking channels
106-
* `/var/lib/hugetlbfs/global/pagesize-[page size]/rorc-dma-bench_id=[PCI address]_chan_[channel number]` - For card benchmark DMA buffers
103+
* `/dev/shm/AliceO2_RoC_[PCI address]_Channel_[channel number]_fifo` - For card FIFOs
104+
* `/dev/shm/AliceO2_RoC_[PCI address]_Channel_[channel number].lock` - For locking channels
105+
* `/dev/shm/sem.AliceO2_RoC_[PCI address]_Channel_[channel number]_Mutex` - For locking channels
106+
* `/var/lib/hugetlbfs/global/pagesize-[page size]/roc-dma-bench_id=[PCI address]_chan_[channel number]` - For roc-bench-dma buffers
107107

108108
If the process crashes badly (such as with a segfault), it may be necessary to clean up the mutex manually, either by
109109
deleting with `rm` or by using the `roc-channel-cleanup` utility.
@@ -186,9 +186,12 @@ Resets a card channel
186186

187187
### roc-run-script
188188
*Deprecated, see section "Python interface"*
189-
190189
Run a Python script that can use a simple interface to use the library.
191190

191+
### roc-setup-hugetlbfs
192+
Setup hugetlbfs directories & mounts. If using hugepages, should be run once per boot.
193+
194+
192195

193196
Exceptions
194197
-------------------
@@ -256,7 +259,7 @@ If PDA is not detected on the system, only a dummy implementation of the interfa
256259

257260
4. Optionally, insert kernel module. If the utilities are run as root, PDA will do this automatically.
258261
~~~
259-
modprobe uio\_pci\_dma
262+
modprobe uio_pci_dma
260263
~~~
261264

262265
### Hugepages
@@ -340,10 +343,8 @@ The issue has occurred on Dell R720 servers.
340343

341344
Permissions
342345
-------------------
343-
The library must be run either by root users, or users part of the group 'pda'. In case of 'pda' group users, make sure
344-
the `/dev/shm/alice_o2` and `/mnt/hugetlbfs/alice_o2` directories have sufficient permissions that allow those
345-
users to create/read/write files.
346-
Also, the PDA kernel module must be inserted as root in any case.
346+
The library must be run either by root users, or users part of the group 'pda'.
347+
The PDA kernel module must be inserted as root in any case.
347348

348349

349350
ALICE Low-level Front-end (ALF) DIM Server

src/Crorc/CrorcDmaChannel.cxx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ CrorcDmaChannel::~CrorcDmaChannel()
8181

8282
void CrorcDmaChannel::deviceStartDma()
8383
{
84+
// With the C-RORC, we can't start DMA until we have enough memory to cover 128 DMA pages (which should be covered by
85+
// 1 superpage). So we set the "pending DMA start" state and actually start once a superpage has been pushed.
8486
log("DMA start deferred until superpage available");
8587

8688
mFifoBack = 0;
@@ -285,6 +287,7 @@ void CrorcDmaChannel::pushSuperpage(Superpage superpage)
285287
if (!Utilities::isMultiple(superpage.getSize(), MIN_SIZE)) {
286288
BOOST_THROW_EXCEPTION(CrorcException()
287289
<< ErrorInfo::Message("Could not enqueue superpage, C-RORC backend requires superpage size multiple of 1 MiB"));
290+
// We require 1 MiB because this fits 128 8KiB DMA pages (see deviceStartDma() for why we need that)
288291
}
289292

290293
SuperpageQueueEntry entry;

src/Pda/README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,8 @@ The obstacle to this is that some of the exceptions thrown are somewhat ReadoutC
3030
For example, in `PdaDmaBuffer.cxx`, one of the exceptions presents the message:
3131
*"Scatter-gather node smaller than 2 MiB (minimum hugepage size. This means the IOMMU is off and the buffer is not
3232
backed by hugepages - an unsupported buffer configuration."*
33-
While this is helpful in the context of the way it is used in ReadoutCard, it may not apply in different situations.
33+
While this is helpful in the context of the way it is used in ReadoutCard, it may not apply in different situations.
34+
35+
## Locking
36+
If multiple DMA buffers are concurrently created/destroyed, the PDA kernel module will lock up, requiring a reboot.
37+
To prevent this from happening, the global lock `PdaLock` is used in `PdaDmaBuffer.cxx` and `Driver.cxx`.

0 commit comments

Comments
 (0)