typed_shmem - Shared memory crate!

Crates.io: https://crates.io/crates/typed_shmem Github: https://github.com/UpsettingBoy/typed_shmem

Some moths ago I started experimenting with IPC in Rust and I came to find shared_memory create. I really like it except the part where I needed to cast bytes into the type I was using in the shared memory region.

I found that prone to errors (like forgetting the type of the shared memory), although I can understand why that design decision.

After that, I decided to create my own crate (and ofc learn along the way). So here I present it in case someone find it useful.

Keep in mind that I am not very experienced with unsafe behaviors so if someone could help me reviewing the unsafe code under unix.rs and windows.rs it will be very appreciated!

Also thanks to the people of the rust community discord for some tips!.

πŸ‘︎ 12
πŸ’¬︎
πŸ‘€︎ u/UpsettingBoy
πŸ“…︎ Jan 23 2021
🚨︎ report
Need help with shmem

I'm having trouble with the VM not generating a shmem file for this device

<shmem name='scream-ivshmem'>
      <model type='ivshmem-plain'/>
      <size unit='M'>2</size>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0b' function='0x0'/>
</shmem>

i looked in the dev/shm folder but it was empty while the VM was running. I'm running a single GPU pass through and I noticed that when I disabled all of my startup scripts and removed the gpu's pcie devices, it created the file as expected.

This leads me to belive that there's something in my startup script that is preventing the creation of the file.

Heres what the startup script looks like

#!/bin/bash
sleep 3

set -x

#beep

# Stop display manager
systemctl stop display-manager
# rc-service xdm stop
echo 0 > /sys/class/vtconsole/vtcon0/bind
echo 0 > /sys/class/vtconsole/vtcon1/bind
# Unbind EFI Framebuffer
echo efi-framebuffer.0 > /sys/bus/platform/drivers/efi-framebuffer/unbind

sleep 3

# Unload NVIDIA kernel modules
modprobe -r nvidia_drm
modprobe -r nvidia_modeset
modprobe -r nvidia_uvm
modprobe -r i2c_nvidia_gpu
# Unload AMD kernel module
# modprobe -r amdgpu
#sleep 2
# Detach GPU devices from host
# Use your GPU and HDMI Audio PCI host device
virsh nodedev-detach pci_0000_01_00_0
virsh nodedev-detach pci_0000_01_00_1
virsh nodedev-detach pci_0000_01_00_2
virsh nodedev-detach pci_0000_01_00_3
virsh nodedev-detach pci_0000_00_01_0

# Load vfio module
modprobe vfio
modprobe vfio-pci
modprobe vfio_iommu_type1

I'd appreciate any and all help.

πŸ‘︎ 11
πŸ’¬︎
πŸ‘€︎ u/MamaSendHelpPls
πŸ“…︎ May 05 2021
🚨︎ report
Question about linking libandroid-shmem

I'm trying to use a Linux program on Android, but getting shared memory errors, and would like to implement libandroid-shmem with my program so that it will work in termux. I'm not very good with Linux, but if I was to ask someone else to help me with this, what would be the proper terminology to use to describe how I'd like to implement this into my program?

I feel like I'm a bit over my head with this, but I'd really like to get this certain program running on Android.

Thanks.

πŸ‘︎ 7
πŸ’¬︎
πŸ‘€︎ u/va3oso
πŸ“…︎ Apr 26 2021
🚨︎ report
mm: shmem: Add case-insensitive support for tmpfs [LWN.net] lwn.net/Articles/850214/
πŸ‘︎ 3
πŸ’¬︎
πŸ‘€︎ u/ehempel
πŸ“…︎ Apr 06 2021
🚨︎ report
shmem-ipc: High-performance communication between untrusted processes on Linux crates.io/crates/shmem-ip…
πŸ‘︎ 51
πŸ’¬︎
πŸ‘€︎ u/diwic
πŸ“…︎ Feb 09 2021
🚨︎ report
My big rescue boy Marshmallow (Shmem for short)
πŸ‘︎ 6
πŸ’¬︎
πŸ‘€︎ u/Getchanoodlevegan
πŸ“…︎ Feb 25 2021
🚨︎ report
I think I might be doing something wrong (shmem bug in compositor)
πŸ‘︎ 9
πŸ’¬︎
πŸ‘€︎ u/klange
πŸ“…︎ Oct 16 2012
🚨︎ report
6/15/12- Bleeding Fractals, Nicknames, Sovereignties, Our Sunday Affairs, Ted Nguyent, and Mumblr @ Shmem's facebook.com/events/39610…
πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/Schiffty5
πŸ“…︎ Jun 11 2012
🚨︎ report
SERIOUS: This subreddit needs to understand what a "dad joke" really means.

I don't want to step on anybody's toes here, but the amount of non-dad jokes here in this subreddit really annoys me. First of all, dad jokes CAN be NSFW, it clearly says so in the sub rules. Secondly, it doesn't automatically make it a dad joke if it's from a conversation between you and your child. Most importantly, the jokes that your CHILDREN tell YOU are not dad jokes. The point of a dad joke is that it's so cheesy only a dad who's trying to be funny would make such a joke. That's it. They are stupid plays on words, lame puns and so on. There has to be a clever pun or wordplay for it to be considered a dad joke.

Again, to all the fellow dads, I apologise if I'm sounding too harsh. But I just needed to get it off my chest.

πŸ‘︎ 17k
πŸ’¬︎
πŸ‘€︎ u/anywhereiroa
πŸ“…︎ Jan 15 2022
🚨︎ report
Blind Girl Here. Give Me Your Best Blind Jokes!

Do your worst!

πŸ‘︎ 5k
πŸ’¬︎
πŸ‘€︎ u/Leckzsluthor
πŸ“…︎ Jan 02 2022
🚨︎ report
This subreddit is 10 years old now.

I'm surprised it hasn't decade.

πŸ‘︎ 14k
πŸ’¬︎
πŸ‘€︎ u/frexyincdude
πŸ“…︎ Jan 14 2022
🚨︎ report
Windows 10 Looking Glass VFIO

I finally got it working on a Dell Precision 7750 for work. It's a pretty capable laptop, with an Intel i9-10885H with UHD graphics, 32 GB RAM, and a NVIDIA Quadro RTX 4000.

My host OS is Gentoo 5.15.11 running X11 on the Intel UHD. The kernel is module-less and an efistub so IOMMU and vfio-pci are built in. So for those to work I have the following built-in kernel command-line options:

iommu=pt intel_iommu=on vfio-pci.ids=10de:1eb6,10de:10f8,10de:1ad8,10de:1ad9

Those PCI IDs belong to the Quadro card. Luckily it's in its own IOMMU group along with a PCI bridge. The bridge was excluded in the PCI pass-through.

First, I set up Windows 10 in virt-manager as a regular VM with QXL graphics, a custom ACPI table, the Looking Glass IVSHMEM device, and with KVM hidden.

I performed the usual installation of the virtio-win drivers and installed TightVNC so I could eventually connect to the VM without the QXL graphics. The Looking Glass IVSHMEM device driver was also installed according their instructions.

Only once that was all working did I start making changes to the libvirt domain XML for the PCI pass-through. The Quadro card was added through the virt-manager interface and I edited the XML taking care to make sure all of its components were connected to the same PCI bus and slot. I gave each component an alias name in order to be able to set the sub device and vendor IDs to what they said they were in bare-bones Windows. This step was important for getting this to work for me, thankfully I found this post which outlined it nicely.

One option that resulted in a black screen upon boot-up was manually setting the VBIOS ROM.

I also passed the VM audio to my PulseAudio server on the host.

Once the PCI pass-through VM was booted up I installed the NVIDIA drivers and, using the NVIDIA Control Panel, set one of my graphics outputs f

... keep reading on reddit ➑

πŸ‘︎ 7
πŸ’¬︎
πŸ‘€︎ u/corrmaan
πŸ“…︎ Jan 14 2022
🚨︎ report
Dropped my best ever dad joke & no one was around to hear it

For context I'm a Refuse Driver (Garbage man) & today I was on food waste. After I'd tipped I was checking the wagon for any defects when I spotted a lone pea balanced on the lifts.

I said "hey look, an escaPEA"

No one near me but it didn't half make me laugh for a good hour or so!

Edit: I can't believe how much this has blown up. Thank you everyone I've had a blast reading through the replies πŸ˜‚

πŸ‘︎ 19k
πŸ’¬︎
πŸ‘€︎ u/Vegetable-Acadia
πŸ“…︎ Jan 11 2022
🚨︎ report
What starts with a W and ends with a T

It really does, I swear!

πŸ‘︎ 6k
πŸ’¬︎
πŸ‘€︎ u/PsychedeIic_Sheep
πŸ“…︎ Jan 13 2022
🚨︎ report
What is a a bisexual person doing when they’re not dating anybody?

They’re on standbi

πŸ‘︎ 11k
πŸ’¬︎
πŸ‘€︎ u/Toby-the-Cactus
πŸ“…︎ Jan 12 2022
🚨︎ report
Requesting suggestions for languages, libraries, and architectures for parallel (and sometimes non parallel) numerical and scientific computations

A lot of the work I am interested to do will be mostly built from scratch by myself, provided there is fair support for numerical types (like complex numbers) and high precision numerical operations (if not, I'll be happy to write those routines as well). Many of my areas of interest are computationally demanding (python codes choke for large enough datasets) but are often parallelizable, and I am looking for guidance on implementing the same. I love math and physics, especially domains that involve rigorous analysis, ranging from physical/mathematic concepts like turbulence, topology, wave optics, electromagnetism and quantum physics to computational concepts like cryptography and information theory. I also love signal processing, especially relating to random and sparse signals. They require a decent amount of precision while simultaneously being fast enough. I wish to be able to run the code on low power and high power manycore or SIMD processors, with the sequential parts being run on a general-purpose processor or highly pipelined FPGA. Energy efficiency is one of my key targets along with speed (many scenarios are energy constrained) even if it requires a longer and customized code. Another area of interest I have, while not my primary goal is to implement redundancy using parallelism (including different compression storage methods: eg RAID). I would like to have some control over the different memory allocations (hierarchies of caches and scratchpad memories) and if possible, some of the caching schemes while still being usable across multiple architectures. If possible, options to optimize for burst and broadcasting, prescence or absence of hardware lockstep, depending upon hardware support (use of switches to do different routines for different hardware when it comes to memory copy and allocation, basically caching). Sorry for the long and open ended question, I realized it would be hard to really come to a decision without getting a holistic picture of the whole domain atleast to a fair level of depth. I am looking for suggestions in both hardware and software for the same.

My primary concern is software - including but not limited to languages, compilers and directives. Being not from a software programming background, I find it hard to search for the proper areas (and keywords). I would like to share my current understanding of the scenario in terms of software - I have currently explored Cuda, OpenCL, Fortran, OpenMP, OpenMPI, OpenACC, Julia

... keep reading on reddit ➑

πŸ‘︎ 6
πŸ’¬︎
πŸ‘€︎ u/manueljenkin
πŸ“…︎ Jan 16 2022
🚨︎ report
Geddit? No? Only me?
πŸ‘︎ 6k
πŸ’¬︎
πŸ‘€︎ u/shampy311
πŸ“…︎ Dec 28 2021
🚨︎ report
I wanna hear your best airplane puns.

Pilot on me!!

πŸ‘︎ 3k
πŸ’¬︎
πŸ‘€︎ u/Paulie_Felice
πŸ“…︎ Jan 07 2022
🚨︎ report
E or ß?
πŸ‘︎ 9k
πŸ’¬︎
πŸ‘€︎ u/Amazekam
πŸ“…︎ Jan 03 2022
🚨︎ report
What did Spartacus say when the lion ate his wife?

Nothing, he was gladiator.

πŸ‘︎ 9k
πŸ’¬︎
πŸ‘€︎ u/rj104
πŸ“…︎ Jan 15 2022
🚨︎ report
Pun intended.
πŸ‘︎ 5k
πŸ’¬︎
πŸ‘€︎ u/Sharmaji1301
πŸ“…︎ Jan 15 2022
🚨︎ report
No spoilers
πŸ‘︎ 9k
πŸ’¬︎
πŸ‘€︎ u/Onfour
πŸ“…︎ Jan 06 2022
🚨︎ report
Covid problems
πŸ‘︎ 7k
πŸ’¬︎
πŸ‘€︎ u/theincrediblebou
πŸ“…︎ Jan 12 2022
🚨︎ report
These aren't dad jokes...

Dad jokes are supposed to be jokes you can tell a kid and they will understand it and find it funny.

This sub is mostly just NSFW puns now.

If it needs a NSFW tag it's not a dad joke. There should just be a NSFW puns subreddit for that.

Edit* I'm not replying any longer and turning off notifications but to all those that say "no one cares", there sure are a lot of you arguing about it. Maybe I'm wrong but you people don't need to be rude about it. If you really don't care, don't comment.

πŸ‘︎ 12k
πŸ’¬︎
πŸ‘€︎ u/Lance986
πŸ“…︎ Dec 15 2021
🚨︎ report
I had a vasectomy because I didn’t want any kids.

When I got home, they were still there.

πŸ‘︎ 10k
πŸ’¬︎
πŸ‘€︎ u/demotrek
πŸ“…︎ Jan 13 2022
🚨︎ report
Spi__
πŸ‘︎ 6k
πŸ’¬︎
πŸ‘€︎ u/Fast_Echidna_8520
πŸ“…︎ Jan 11 2022
🚨︎ report
I dislike karma whores who make posts that imply it's their cake day, simply for upvotes.

I won't be doing that today!

πŸ‘︎ 15k
πŸ’¬︎
πŸ‘€︎ u/djcarves
πŸ“…︎ Dec 27 2021
🚨︎ report
The Ancient Romans II
πŸ‘︎ 6k
πŸ’¬︎
πŸ‘€︎ u/mordrathe
πŸ“…︎ Dec 29 2021
🚨︎ report
I'd like to dedicate this joke to my wisdom teeth.

[Removed]

πŸ‘︎ 7k
πŸ’¬︎
πŸ‘€︎ u/ThoughtPumP
πŸ“…︎ Jan 14 2022
🚨︎ report
I did it, I finally did it. After 4 years and 92 days I went from being a father, to a dad.

This morning, my 4 year old daughter.

Daughter: I'm hungry

Me: nerves building, smile widening

Me: Hi hungry, I'm dad.

She had no idea what was going on but I finally did it.

Thank you all for listening.

πŸ‘︎ 17k
πŸ’¬︎
πŸ‘€︎ u/Sk2ec
πŸ“…︎ Jan 01 2022
🚨︎ report
How do you stop Canadian bacon from curling in your frying pan?

You take away their little brooms

πŸ‘︎ 6k
πŸ’¬︎
πŸ‘€︎ u/Majorpain2006
πŸ“…︎ Jan 09 2022
🚨︎ report
It this sub dead?

There hasn't been a post all year!

πŸ‘︎ 13k
πŸ’¬︎
πŸ‘€︎ u/TheTreelo
πŸ“…︎ Jan 01 2022
🚨︎ report
School Was Clothed
πŸ‘︎ 5k
πŸ’¬︎
πŸ‘€︎ u/Kennydoe
πŸ“…︎ Jan 08 2022
🚨︎ report
Where do you find a cow with no legs?

Where ever you left it πŸ€·β€β™€οΈπŸ€­

πŸ‘︎ 3k
πŸ’¬︎
πŸ‘€︎ u/kitkatty0309
πŸ“…︎ Jan 16 2022
🚨︎ report
Naan-negotiable
πŸ‘︎ 5k
πŸ’¬︎
πŸ‘€︎ u/sjmaeff
πŸ“…︎ Jan 16 2022
🚨︎ report
Remember that joke I told you about the chiropractor?

It was about a weak back.

πŸ‘︎ 6k
πŸ’¬︎
πŸ‘€︎ u/tanglwyst
πŸ“…︎ Jan 16 2022
🚨︎ report
Letting loose with these puns
πŸ‘︎ 6k
πŸ’¬︎
πŸ“…︎ Jan 13 2022
🚨︎ report
Couch potato
πŸ‘︎ 8k
πŸ’¬︎
πŸ“…︎ Dec 31 2021
🚨︎ report
Baka!
πŸ‘︎ 5k
πŸ’¬︎
πŸ‘€︎ u/ridi86
πŸ“…︎ Jan 09 2022
🚨︎ report
All dad jokes are bad and here’s why

Why

πŸ‘︎ 7k
πŸ’¬︎
πŸ‘€︎ u/LordCinko
πŸ“…︎ Jan 13 2022
🚨︎ report
My name is ABCDEFGHIJKMNOPQRSTUVWXYZ

It’s pronounced β€œNoel.”

πŸ‘︎ 14k
πŸ’¬︎
πŸ‘€︎ u/beef_fried_rice
πŸ“…︎ Dec 25 2021
🚨︎ report
concrete πŸ—Ώ
πŸ‘︎ 5k
πŸ’¬︎
πŸ‘€︎ u/Fast_Echidna_8520
πŸ“…︎ Jan 07 2022
🚨︎ report
Why are people so surprised and angry about Djokovic being an anti-vaxxer?

After all his first name is No-vac

πŸ‘︎ 4k
πŸ’¬︎
πŸ‘€︎ u/hangryman23
πŸ“…︎ Jan 06 2022
🚨︎ report
If Korean pop is shortened to Kpop and Korean Drama is Kdrama...

What, then, is Chinese rap?

Edit:

Notable mentions from the comments:

  • Spanish/Swedish/Swiss/Serbian hits

  • French/Finnish art

  • Country/Canadian rap

  • Chinese/Country/Canadian rock

  • Turkish/Tunisian/Taiwanese rap

πŸ‘︎ 3k
πŸ’¬︎
πŸ‘€︎ u/hootanahalf
πŸ“…︎ Jan 09 2022
🚨︎ report
That’s Michelle
πŸ‘︎ 5k
πŸ’¬︎
πŸ‘€︎ u/FLEXSEALBREAKER
πŸ“…︎ Jan 10 2022
🚨︎ report
Is this sub still active?

There hasn't been a single post this year!

(Happy 2022 from New Zealand)

πŸ‘︎ 10k
πŸ’¬︎
πŸ‘€︎ u/DonStimpo
πŸ“…︎ Dec 31 2021
🚨︎ report
What did 0 say to 8 ?

What did 0 say to 8 ?

" Nice Belt "

So What did 3 say to 8 ?

" Hey, you two stop making out "

πŸ‘︎ 9k
πŸ’¬︎
πŸ‘€︎ u/designjeevan
πŸ“…︎ Jan 03 2022
🚨︎ report

Please note that this site uses cookies to personalise content and adverts, to provide social media features, and to analyse web traffic. Click here for more information.