Pull from github (tstellar):

Prefer using memfd_create() for the ring buffer.

We were using /dev/shm, but this won't work on systems that
either don't have /dev/shm or have mounted it with noexec, because
for everything other than gfx700 we map the ring buffer with PROT_EXEC.

memfd_create() is Linux specific and was added in Linux 3.17, so we
will fallback to using /dev/shm on systems where memfd_create() is
not available.

Change-Id: I58fb533eebc362f6d29dc3e316a80801014d50e8
This commit is contained in:
Sean Keely
2017-11-22 14:35:59 -06:00
parent 4b603e803d
commit b93ffafdc7
3 changed files with 76 additions and 40 deletions
@@ -349,6 +349,10 @@ class AqlQueue : public core::Queue, private core::LocalSignal, public core::Sig
void AllocRegisteredRingBuffer(uint32_t queue_size_pkts);
void FreeRegisteredRingBuffer();
/// @brief Abstracts the file handle use for double mapping queues.
void CloseRingBufferFD(const char* ring_buf_shm_path, int fd) const;
int CreateRingBufferFD(const char* ring_buf_shm_path, uint32_t ring_buf_phys_size_bytes) const;
static bool DynamicScratchHandler(hsa_signal_value_t error_code, void* arg);
/// @brief Define the Scratch Buffer Descriptor and related parameters