Ever found yourself in need of a quick, engaging, and surprisingly challenging game that you can jump into anytime, anywhere? Look no further than the captivating world of Slope Game. This seemingly simple title offers a deceptively deep experience, testing your reflexes and spatial awareness in a way that’s both frustrating and incredibly rewarding. If you've never rolled into its vibrant, geometric landscapes, you're in for a treat!
https://slopegamefree.com/
Gameplay: Master the Art of the Tilt
Playing Slope Game is refreshingly straightforward. Your primary objective is to keep your ball from falling off the edges of the platforms or colliding with red obstacles. The ball is always moving forward, and your only controls are to steer it left or right.
Steering: On a desktop, you'll typically use the A and D keys or the left and right arrow keys to shift the ball's direction. On mobile devices, it’s often a touch-and-drag or tilt-to-steer mechanism. The key is subtlety. Small, precise adjustments are far more effective than wild, sweeping movements, which will often send your ball careening off the edge.
Speed: The ball constantly gains speed, which is where the real challenge lies. As you progress, the platforms become narrower, the gaps wider, and the red obstacles more frequent. What was a gentle curve at the start becomes a frantic maneuver later on.
Obstacles: Keep a keen eye out for the static and sometimes moving red blocks. Touching these spells instant doom. Learning their patterns and anticipating their appearance is crucial for long-term survival.
Tips for Rolling Success
While it may seem like pure luck at first, there are definite strategies you can employ to improve your high score:
Focus on the Path Ahead: Don't just look at where your ball is; always be scanning the screen for what's coming up next. This allows you to plan your turns and avoid sudden surprises.
Small Adjustments are Key: Resist the urge to oversteer. Gentle taps or small nudges are almost always more effective than holding down a direction key, especially as your speed increases.
Embrace the Center: Whenever possible, try to keep your ball centered on the path. This gives you the most leeway for unexpected obstacles or sudden turns.
Learn from Your Fails: Every time you fall, take a moment to understand why. Did you oversteer? Miss an obstacle? Knowing your weaknesses will help you avoid repeating the same mistakes.
Practice Makes Perfect: Like any skill-based game, consistent practice is the best way to improve. Your reflexes will sharpen, and your muscle memory for precise steering will develop over time.
Conclusion: A Simple Game, Endless Fun
Slope Game embodies the beauty of simplicity in game design. It doesn't rely on flashy graphics or complex storylines, but rather on addictive gameplay that challenges your reflexes and keeps you coming back for "just one more run." Whether you have a few minutes to spare or an hour to dedicate, this game offers a rewarding and endlessly replayable experience. So, if you're looking for a fun and engaging way to test your agility, give Slope Game a try – you might just find your new favorite time-waster.
Feeling the itch for a satisfying puzzle challenge? Look no further than games like Block Blast. These engaging tile-matching experiences offer a delightful blend of strategy and spatial reasoning, perfect for a quick mental workout or a longer, relaxing session. Let's explore how to get the most out of these captivating games.
https://blockblasts.io/
Introduction: What is Block Blasting?
At its core, a block-blasting game is about clearing a grid by strategically placing various-shaped blocks. Imagine a blend of Tetris and a jigsaw puzzle, where your goal isn't just to complete lines, but to eliminate entire clusters of blocks. The beauty lies in its simplicity: no complex narratives or intricate controls, just pure, unadulterated puzzle-solving fun. Many versions of this game exist, but for this article, we’ll be focusing on a general approach that applies to most variations, including Block Blast itself.
Gameplay: The Fundamentals of Cube Clearing
The basic premise is straightforward. You're presented with a grid, typically 8x8 or 10x10, and a queue of three randomly generated blocks at the bottom of your screen. Your task is to drag and drop these blocks onto the grid. The magic happens when you form a complete horizontal or vertical line (or sometimes both) with your placed blocks. Once a line is complete, it disappears, freeing up space and earning you points.
The challenge intensifies as the grid fills up. If you run out of space to place any of the three available blocks, the game ends. This creates a constant tension and encourages careful planning. Some games also feature special blocks – perhaps a bomb that clears a small area, or a rotating block that offers more placement options. These additions add another layer of strategic depth, keeping the gameplay fresh and exciting.
Tips for Becoming a Block Blast Champion
While Block Blast is easy to pick up, mastering it requires a bit of strategy. Here are a few tips to help you maximize your scores and playtime:
Look Ahead:Â Always consider the next few blocks in your queue. Don't just place a block to clear one line if it compromises your ability to place subsequent, larger blocks.
Keep the Center Clear:Â It's tempting to fill up the edges first, but an open center gives you far more flexibility for larger, irregularly shaped blocks.
Prioritize Large Blocks:Â While clearing single lines is good, try to set up opportunities to clear multiple lines simultaneously, or to use your larger blocks effectively.
Don't Be Afraid to Sacrifice:Â Sometimes, you might need to place a block in a less-than-ideal spot to avoid an immediate game over. It's about damage control.
Identify Patterns:Â As you play more, you'll start to recognize common block combinations and how they fit together best. Practice truly makes perfect here.
Utilize Special Blocks Wisely:Â If your game has them, don't just use special blocks impulsively. Save bombs for truly sticky situations, or use rotators to maximize space.
Conclusion: A Refreshing Puzzle Experience
Games like Block Blast offer a genuinely enjoyable and mentally stimulating experience. They're easy to pick up, yet provide endless opportunities for strategic refinement. Whether you're looking to unwind after a long day or sharpen your problem-solving skills, these block-clearing puzzles are a fantastic choice. So, what are you waiting for? Dive in and start blasting those blocks!
If you have lost cryptocurrency to fraud, hacks, or scams, time is critical. The faster you act, the higher the chance of recovery. You do not have to face this alone.
Join the thousands of clients who have reclaimed their financial freedom with MUYERN TRUST HACKER.
Ready to Start Your Recovery?
Contact our specialist team today for a confidential, no-obligation case assessment.
What App: [ +1.2.0.2.7.0.3.2.2.3.9 ]
If you have lost cryptocurrency to fraud, hacks, or scams, time is critical. The faster you act, the higher the chance of recovery. You do not have to face this alone.
Join the thousands of clients who have reclaimed their financial freedom with MUYERN TRUST HACKER.
Ready to Start Your Recovery?
Contact our specialist team today for a confidential, no-obligation case assessment.
Email: [ muyerntrusted(at)mail-me(.)c o m ]
What App: [ +1.2.0.2.7.0.3.2.2.3.9 ]
From: Arnd Bergmann <arnd(a)arndb.de>
While system heap and system_cc_shared heap share a lot of code
and hence the same source file, their users have different needs.
system heap users need it to be a loadable module, while
system_cc_shared heap users don't.
Building as a loadable module breaks system_cc_shared heap on
powerpc and s390 due to un-exported set_memory_encrypted /
set_memory_decrypted functions.
Fix these by reorganising code to put the system_cc_shared heap
under a new Kconfig symbol, which allows either building both
into the kernel, or leave encryption up to the consumers of the
system heap.
Fixes: fd55edff8a0a ("dma-buf: heaps: system: Turn the heap into a module")
Signed-off-by: Arnd Bergmann <arnd(a)arndb.de>
Signed-off-by: Sumit Semwal <sumit.semwal(a)linaro.org>
---
drivers/dma-buf/heaps/Kconfig | 8 ++++++++
drivers/dma-buf/heaps/system_heap.c | 16 ++++++++++------
2 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/drivers/dma-buf/heaps/Kconfig b/drivers/dma-buf/heaps/Kconfig
index e273fb18feca..a39decdcf067 100644
--- a/drivers/dma-buf/heaps/Kconfig
+++ b/drivers/dma-buf/heaps/Kconfig
@@ -5,6 +5,14 @@ config DMABUF_HEAPS_SYSTEM
Choose this option to enable the system dmabuf heap. The system heap
is backed by pages from the buddy allocator. If in doubt, say Y.
+config DMABUF_HEAPS_CC_SYSTEM
+ bool "DMA-BUF System Heap for decrypted CoCo VMs"
+ depends on DMABUF_HEAPS && ARCH_HAS_MEM_ENCRYPT && DMABUF_HEAPS_SYSTEM=y
+ help
+ Choose this option to enable the system_cc_shared dmabuf heap. This
+ allows allocating shared (decrypted) memory for confidential computing
+ (CoCo) VMs.
+
config DMABUF_HEAPS_CMA
tristate "DMA-BUF CMA Heap"
depends on DMABUF_HEAPS && DMA_CMA
diff --git a/drivers/dma-buf/heaps/system_heap.c b/drivers/dma-buf/heaps/system_heap.c
index c92bdec356fc..71d9028cc3df 100644
--- a/drivers/dma-buf/heaps/system_heap.c
+++ b/drivers/dma-buf/heaps/system_heap.c
@@ -48,6 +48,9 @@ struct dma_heap_attachment {
bool cc_shared;
};
+#define cc_shared_buffer(b) (IS_ENABLED(CONFIG_DMABUF_HEAPS_CC_SYSTEM) && \
+ (b)->cc_shared)
+
#define LOW_ORDER_GFP (GFP_HIGHUSER | __GFP_ZERO)
#define HIGH_ORDER_GFP (((GFP_HIGHUSER | __GFP_ZERO | __GFP_NOWARN \
| __GFP_NORETRY) & ~__GFP_RECLAIM) \
@@ -161,7 +164,7 @@ static struct sg_table *system_heap_map_dma_buf(struct dma_buf_attachment *attac
unsigned long attrs;
int ret;
- attrs = a->cc_shared ? DMA_ATTR_CC_SHARED : 0;
+ attrs = cc_shared_buffer(a) ? DMA_ATTR_CC_SHARED : 0;
ret = dma_map_sgtable(attachment->dev, table, direction, attrs);
if (ret)
return ERR_PTR(ret);
@@ -233,7 +236,7 @@ static int system_heap_mmap(struct dma_buf *dmabuf, struct vm_area_struct *vma)
int i, ret;
prot = vma->vm_page_prot;
- if (buffer->cc_shared)
+ if (cc_shared_buffer(buffer))
prot = pgprot_decrypted(prot);
for_each_sgtable_sg(table, sg, i) {
@@ -282,7 +285,7 @@ static void *system_heap_do_vmap(struct system_heap_buffer *buffer)
}
prot = PAGE_KERNEL;
- if (buffer->cc_shared)
+ if (cc_shared_buffer(buffer))
prot = pgprot_decrypted(prot);
vaddr = vmap(pages, npages, VM_MAP, prot);
vfree(pages);
@@ -349,7 +352,7 @@ static void system_heap_dma_buf_release(struct dma_buf *dmabuf)
* Intentionally leak pages that cannot be re-encrypted
* to prevent shared memory from being reused.
*/
- if (buffer->cc_shared &&
+ if (cc_shared_buffer(buffer) &&
system_heap_set_page_encrypted(page))
continue;
@@ -456,7 +459,7 @@ static struct dma_buf *system_heap_allocate(struct dma_heap *heap,
list_del(&page->lru);
}
- if (cc_shared) {
+ if (cc_shared_buffer(buffer)) {
for_each_sgtable_sg(table, sg, i) {
ret = system_heap_set_page_decrypted(sg_page(sg));
if (ret)
@@ -485,7 +488,7 @@ static struct dma_buf *system_heap_allocate(struct dma_heap *heap,
* Intentionally leak pages that cannot be re-encrypted
* to prevent shared memory from being reused.
*/
- if (buffer->cc_shared &&
+ if (cc_shared_buffer(buffer) &&
system_heap_set_page_encrypted(p))
continue;
__free_pages(p, compound_order(p));
@@ -525,6 +528,7 @@ static int __init system_heap_create(void)
return PTR_ERR(sys_heap);
if (IS_ENABLED(CONFIG_HIGHMEM) ||
+ !IS_ENABLED(CONFIG_DMABUF_HEAPS_CC_SYSTEM) ||
!cc_platform_has(CC_ATTR_MEM_ENCRYPT))
return 0;
--
2.43.0
Have you ever felt the urge to build towering castles, explore deep caves, or simply survive a night in a world made entirely of blocks? If you've heard of Minecraft, you know the feeling. But what if you could jump into a similar sandbox experience right from your web browser, with no installation required? Enter Eaglercraft, a fascinating project that brings a familiar block-based adventure to everyone with an internet connection. https://eaglercraftweb.com/
What is Eaglercraft and How Do You Play?
At its core, Eaglercraft is an open-source project that emulates the classic Minecraft experience (specifically, older versions like 1.5.2) and runs entirely in a web browser. This means you can play on a school computer, a friend’s laptop, or any device that can open a website, making it incredibly accessible.
Getting started is as simple as it sounds:
Launch the Game: Navigate to an Eaglercraft website.
Choose Your Name: Pick a username for your in-game character.
Select a Game Mode: You’ll typically find two main options:
Singleplayer: This is your own private world. You can choose between Survival Mode, where you must gather resources and fend off monsters to survive, or Creative Mode, where you have unlimited resources and can fly, allowing you to build anything you can imagine without limits.
Multiplayer: This is where you can join servers and play with others. You can team up to build massive cities, compete in mini-games like sky-wars, or join survival servers to brave the world together.
Once in the game, the controls are straightforward for anyone who has played a first-person PC game. You use W, A, S, D to move, the mouse to look around, the left mouse button to break blocks or attack, and the right mouse button to place blocks or interact with objects.
Tips for a Great First Experience
Jumping into a new world can be a bit overwhelming, so here are a few friendly tips to get you started on the right foot:
Your First Day is Crucial: If you're in Survival mode, your first priority is to gather wood. Punch a tree to get logs, then use your inventory to craft them into planks. From there, make a crafting table. This table is your key to unlocking all other tools and items.
Shelter Before Dark: Nighttime brings monsters. Before the sun sets, use your newly gathered wood or dirt to build a simple shelter. Even a small dirt hut will keep you safe until morning. A bed, crafted from wool and planks, will allow you to skip the night entirely.
Explore Multiplayer Servers: The real magic of Eaglercraft often lies in its community. Don't be shy about joining a multiplayer server. You’ll find incredible player-made creations and different game modes you can’t experience in singleplayer. Just remember to be respectful and follow the server’s rules.
Don't Be Afraid to Experiment: The beauty of a sandbox game is that there is no right or wrong way to play. Want to spend your time farming? Go for it. Feel like digging straight down to find diamonds? Be careful, but have fun! Let your curiosity guide you.
A World of Your Own Making
Eaglercraft serves as a wonderful gateway into the world of sandbox games. It captures the essence of creative freedom and survival adventure that has made the genre so beloved, while removing the barrier of installations or powerful hardware. Whether you’re looking to relive some nostalgic moments or trying a block-building game for the very first time, it offers a simple and delightful way to explore, build, and connect with a community of fellow players. So go ahead, load it up, and see what kind of world you can create.
In a world filled with hyper-realistic graphics and complex narratives, there's a timeless charm to be found in the classics. One such gem that continues to captivate players, young and old, is the ubiquitous Snake Game. Its elegant simplicity belies a surprising depth of strategy and a satisfyingly addictive quality. If you've ever found yourself with a few minutes to spare, or just craving a dose of nostalgic fun, understanding how to play or experience this iconic game is a delightful journey.
https://snakegame.onl
The Basics: A Dance of Pixels and Precision
At its core, Snake Game is wonderfully straightforward. You control a "snake" – typically a series of colored blocks – navigating a confined playing field. Your objective is to guide the snake to consume "food" (often represented as a single pixel or fruit) that appears randomly on the screen. Each time your snake eats, it grows longer. The challenge arises from this very growth; the longer your snake becomes, the more difficult it is to maneuver without hitting the boundaries of the playing area or, crucially, hitting your own ever-expanding body.
Movement is typically controlled with arrow keys or a simple swipe mechanic on touchscreens. Up, down, left, and right are your only commands, but the timing and foresight with which you use them are paramount. The game progresses in a continuous loop, with your snake constantly moving forward. The moment you collide with a wall or your own tail, it's game over. Your score is usually determined by the number of food items you've consumed.
Beyond the Basics: Tips for Becoming a Serpent Savant
While the rules are easy to grasp, mastering Snake Game requires a bit of practice and a few strategic insights.
The Art of the Open Space: Always try to keep a significant portion of the playing field open, especially in front of your snake. Don't box yourself into corners or create unavoidable dead-ends too early. Think a few moves ahead about where your tail will be.
Perimeter Prowling: A common strategy is to keep your snake moving along the outer edges of the playing area. This gives you more room to react and lessens the chance of an unexpected collision with your own body.
Controlled Chaos: Sometimes, the food appears in a tricky spot. Don't be afraid to make a quick, daring move to grab it, but always have an escape plan. Rapid changes in direction can be your friend, but only if executed with precision.
Embrace the Challenge: As your snake grows, the game inevitably becomes more intense. Embrace this escalating difficulty! It's where the true thrill of the game lies. Don't get discouraged by early "game over" screens; each attempt refines your reflexes and strategic thinking.
A Timeless Classic for Everyone
Whether you remember it from early mobile phones or are discovering it for the first time on a web browser, the allure of the Snake Game remains potent. Its simple mechanics make it accessible to anyone, while its increasing difficulty offers a continuous challenge. It's a fantastic way to unwind, test your reflexes, and experience the satisfaction of a well-executed plan. So, why not give it a try? You can easily find it online, for instance, at Snake Game, and embark on your own pixelated adventure. You might just find yourself happily lost in the pursuit of the longest snake.
Hi all,
This series is based on previous RFCs/discussions:
Tech topic: https://lore.kernel.org/linux-iommu/20250918214425.2677057-1-amastro@fb.com/
RFCv1: https://lore.kernel.org/all/20260226202211.929005-1-mattev@meta.com/
RFCv2: https://lore.kernel.org/kvm/20260312184613.3710705-1-mattev@meta.com/
The background/rationale is covered in more detail in the RFC cover
letters. The TL;DR is:
The goal is to enable userspace driver designs that use VFIO to export
DMABUFs representing subsets of PCI device BARs, and "vend" those
buffers from a primary process to other subordinate processes by fd.
These processes then mmap() the buffers and their access to the device
is isolated to the exported ranges. This is an improvement on sharing
the VFIO device fd to subordinate processes, which would allow
unfettered access.
This is achieved by enabling mmap() of vfio-pci DMABUFs, passed by fd
to subordinate processes. Second, a new ioctl()-based revocation
mechanism is added to allow the primary process to forcibly revoke
access to previously-shared BAR spans, even if the subordinate
processes haven't cleanly exited.
(The related topic of safe delegation of iommufd control to the
subordinate processes is not addressed here, and is follow-up work.)
As well as isolation and revocation, another advantage to accessing a
BAR through a VMA backed by a DMABUF is that it's straightforward to
mmap() the buffer with access attributes, such as write-combining.
Feedback from the RFCs requested that, instead of creating
DMABUF-specific vm_ops and .fault paths, to go the whole way and
migrate the existing VFIO PCI BAR mmap() to be backed by a DMABUF too,
resulting in a common vm_ops and fault handler for mmap()s of both the
VFIO device and explicitly-exported DMABUFs. This will help future
iommufd emulation of VFIO Type1 peer-to-peer, making it easier to get
a DMABUF for a VFIO BAR as a DMA target.
mmap() conversion to use DMABUF underneath has been done for vfio-pci,
but not sub-drivers:
nvgrace-gpu's mmap() override path is unchanged; I kept this out of
scope for now not least because I don't have a thorough test setup
for this system. I would prefer to help the nvgrace-gpu maintainers
enable BAR mmap() DMABUFs themselves.
Notes on patches
================
PCI/P2PDMA: Add CONFIG_PCI_P2PDMA_CORE
Later in the series, vfio-pci's mmap() is going to depend on
pcim_p2pdma_provider() which depended on CONFIG_PCI_P2PDMA, which
in turn depended on ZONE_DEVICE (which isn't available on 32-bit
and some archs, because they lack MEMORY_HOTPLUG and friends).
VFIO does _not_ require actual P2P to be present for basic mmap()
functionality, only for the optional CONFIG_DMA_SHARED_BUFFER
feature.
This splits P2PDMA into a CONFIG_PCI_P2PDMA_CORE (which currently
contains pcim_p2pdma_provider()) and an optional CONFIG_PCI_P2PDMA
(which depends on ZONE_DEVICE etc., and provides P2P
functionality).
vfio/pci: Add a helper to look up PFNs for DMABUFs
vfio/pci: Add a helper to create a DMABUF for a BAR-map VMA
The first is for a DMABUF VMA fault handler to determine
arbitrary-sized PFNs from ranges in DMABUF. Secondly, refactor
DMABUF export for use by the existing export feature and add a new
helper that creates a DMABUF corresponding to a VFIO BAR mmap()
request.
vfio/pci: Convert BAR mmap() to use a DMABUF
The vfio-pci core mmap() creates a DMABUF with the helper, and the
vm_ops fault handler uses the other helper to resolve the fault.
Because this depends on DMABUF structs/code, CONFIG_VFIO_PCI_CORE
needs to depend on CONFIG_DMA_SHARED_BUFFER. The
CONFIG_VFIO_PCI_DMABUF still conditionally enables the export
support code.
NOTE: The user mmap()s a device fd, but the resulting VMA's vm_file
becomes that of the DMABUF which takes ownership of the device and
puts it on release. This maintains the existing behaviour of a VMA
keeping the VFIO device open.
BAR zapping then happens via the existing vfio_pci_dma_buf_move()
path, which now needs to unmap PTEs in the DMABUF's address_space.
vfio/pci: Provide a user-facing name for BAR mappings
There was a request for decent debug naming in /proc/<pid>/maps
etc. comparable to the existing VFIO names: since the VMAs are
DMABUFs, they have a "dmabuf:" prefix and can't be 100% identical
to before. This is a user-visible change, but this patch at least
now gives us extra info on the BDF & BAR being mapped.
vfio/pci: Clean up BAR zap and revocation
In general (see NOTE!) the vfio_pci_zap_bars() is now obsolete,
since it unmaps PTEs in the VFIO device address_space which is now
unused. This consolidates all calls (e.g. around reset) with the
neighbouring vfio_pci_dma_buf_move()s into new functions, to
revoke-zap/unrevoke.
!!! NOTE: the nvgrace-gpu driver continues to use its own private
vm_ops, fault handler, etc. for its special memregions, and these
DO still add PTEs to the VFIO device address_space. So, a
temporary flag, vdev->bar_needs_zap, maintains the old behaviour
for this use. At least this patch's consolidation makes it easy to
remove the remaining zap when this need goes away; a FIXME reminds
that this can be removed when nvgrace-gpu is converted.
vfio/pci: Support mmap() of a VFIO DMABUF
Adds mmap() for a DMABUF fd exported from vfio-pci.
It was a goal to keep the VFIO device fd lifetime behaviour
unchanged with respect to the DMABUFs. An application can close
all device fds, and this will revoke/clean up all DMABUFs; no
mappings or other access can be performed now. When enabling
mmap() of the DMABUFs, this means access through the VMA is also
revoked. This complicates the fault handler because whilst the
DMABUF exists, it has no guarantee that the corresponding VFIO
device is still alive. Adds synchronisation ensuring the vdev is
available before vdev->memory_lock is touched; this holds the
device registration so that even if the buffer has been cleaned up,
vdev hasn't been freed and so the lock can be safely taken.
(I decided against the alternative of preventing cleanup by holding
the VFIO device open if any DMABUFs exist, because it's both a
change of behaviour and less clean overall.)
I've added a chonky comment in place, happy to clarify more if you
have ideas.
This commit makes VFIO_PCI_CORE depend on PCI_P2PDMA_CORE (commit
1) to bring in (only) the P2PDMA provider code.
vfio/pci: Permanently revoke a DMABUF on request
By weight, this is mostly a rename of revoked to an enum, status.
There are now 3 states for a buffer, usable and revoked
temporary/permanent. A new VFIO device ioctl is added,
VFIO_DEVICE_PCI_DMABUF_REVOKE, which passes a DMABUF (exported from
that device) and permanently revokes it. Thus a userspace driver
can guarantee any downstream consumers of a shared fd are prevented
from accessing a BAR range, and that range can be reused.
The code doing revocation in vfio_pci_dma_buf_move() is moved,
unchanged, to a common function for use by _move() and the new
ioctl path.
Q: I can't think of a good reason to temporarily revoke/unrevoke
buffers from userspace, so didn't add a 'flags' field to the ioctl
struct. Easy to add if people think it's worthwhile for future
use.
vfio/pci: Add mmap() attributes to DMABUF feature
Adds a new VFIO feature, VFIO_DEVICE_FEATURE_DMA_BUF_MEMATTR.
After a DMABUF is exported, this feature ioctl() isused to set a
memory attribute that will be used by future mmap()s of the DMABUF
fd (i.e. it does nothing for any existing maps).
The default is UC, and via the feature one can specify CPU access
as WC. The attribute is an enum/scalar rather than
bitmap/cumulative. The attributes follow a "try-fail" model where
a client can request an attribute and either succeed or fail with
ENOTSUPP if it's unknown; if future attributes are
platform-specific then their support can be probed.
(Since it's just UC/WC for now, there is no reservation or numeric
structure to the namespace yet, but we could support
system/arch-specific values in future by carving out base +
arch-specific + IMPDEF ranges.)
Testing
=======
(The [RFC ONLY] userspace test program, for QEMU edu-plus, has been
dropped from the series, but can be found in the GitHub branch below.
It at least illustrates the export, map, revoke, attribute, and close
semantics interoperate.)
This code has been tested in mapping DMABUFs of single/multiple
ranges, aliasing mmap()s, aliasing ranges across DMABUFs, vm_pgoff >
0, revocation, shutdown/cleanup scenarios, and hugepage mappings seem
to work correctly. I've lightly tested WC mappings also (by observing
resulting PTEs as having the correct attributes...). No regressions
observed on the VFIO selftests, or on our internal vfio-pci
applications.
End
===
This is based on VFIO next (e.g. at b9285405c5f6).
These commits are on GitHub for easier browsing, along with
"[RFC ONLY] selftests: vfio: Add standalone vfio_dmabuf_mmap_test":
https://github.com/metamev/linux/compare/b9285405c5f6...metamev:linux:dev/m…
Thanks for reading,
Matt
================================================================================
Change log:
v2:
- Rebase on VFIO next, picking up Alex's
vfio_pci_dma_buf_move()/vfio_pci_dma_buf_cleanup() fixes, and
dropping "vfio/pci: Fix vfio_pci_dma_buf_cleanup() double-put"
- Added "PCI/P2PDMA: Add CONFIG_PCI_P2PDMA_CORE" so that the
newly-added vfio-pci hard dependency on the P2PDMA provider instead
pulls in the _CORE variant and not the full-fat CONFIG_PCI_P2PDMA.
This means that the core of vfio-pci does not need ZONE_DEVICE, but
if it's available then enabling P2PDMA in turn enables DMABUF
export. Fixes basic VFIO operation on 32b or other platforms without
ZONE_DEVICE.
- Fixed comment inaccuracy in vfio_pci_dma_buf_revoke() and cleaned
up vdev validity test.
- vfio_pci_dma_buf_find_pfn(): use PAGE_ALIGN(), better span variable
naming, OVF check
- Made vm_pgoffs use consistent (keeping the resource index at the
top and masking where offset is used). For BAR mmap, use new
vma_pgoff_adjust to create the DMABUF with the exact mmap()ed span
instead of from the start of the BAR with an invisible portion
before the mapping.
- Added VFIO_DEVICE_FEATURE_DMA_BUF_MEMATTR to set memory attributes,
instead of using the export `flags` field.
- vfio_pci_ioctl_reset: Moved vfio_pci_zap_revoke_bars()
(effectively, vfio_pci_dma_buf_move()) back after D0 transition.
Note, if a BAR zap is needed, it's done in this function so now
happens after this D0 transition with the _move; it was done before
it at the time of the memory_lock taking.
- Minimised vfio_pci_dma_buf_mmap() (removed redundant span check),
added READ_ONCE for memattr
- Misc fixes: comment in DMABUF name generation, removed superfluous
READ_ONCE from faulthandler
v1:
https://lore.kernel.org/kvm/20260416131815.2729131-1-mattev@meta.com/
- Cleanup of the common DMABUF-aware VMA vm_ops fault handler and
export code.
- Fixed a lot of races, particularly faults racing with DMABUF
cleanup (if the VFIO device fds close, for example).
- Added nicer human-readable names for VFIO mmap() VMAs
RFCv2: Respin based on the feedback/suggestions:
https://lore.kernel.org/kvm/20260312184613.3710705-1-mattev@meta.com/
- Transform the existing VFIO BAR mmap path to also use DMABUFs
behind the scenes, and then simply share that code for
explicitly-mapped DMABUFs. Jason wanted to go that direction to
enable iommufd VFIO type 1 emulation to pick up a DMABUF for an IO
mapping.
- Revoke buffers using a VFIO device fd ioctl
RFCv1:
https://lore.kernel.org/all/20260226202211.929005-1-mattev@meta.com/
Matt Evans (9):
PCI/P2PDMA: Add CONFIG_PCI_P2PDMA_CORE
vfio/pci: Add a helper to look up PFNs for DMABUFs
vfio/pci: Add a helper to create a DMABUF for a BAR-map VMA
vfio/pci: Convert BAR mmap() to use a DMABUF
vfio/pci: Provide a user-facing name for BAR mappings
vfio/pci: Clean up BAR zap and revocation
vfio/pci: Support mmap() of a VFIO DMABUF
vfio/pci: Permanently revoke a DMABUF on request
vfio/pci: Add mmap() attributes to DMABUF feature
drivers/pci/Kconfig | 10 +-
drivers/pci/Makefile | 2 +-
drivers/pci/p2pdma.c | 16 +
drivers/vfio/pci/Kconfig | 4 +-
drivers/vfio/pci/Makefile | 3 +-
drivers/vfio/pci/nvgrace-gpu/main.c | 5 +
drivers/vfio/pci/vfio_pci_config.c | 30 +-
drivers/vfio/pci/vfio_pci_core.c | 225 +++++++++---
drivers/vfio/pci/vfio_pci_dmabuf.c | 548 ++++++++++++++++++++++++----
drivers/vfio/pci/vfio_pci_priv.h | 57 ++-
include/linux/pci-p2pdma.h | 24 +-
include/linux/pci.h | 2 +-
include/linux/vfio_pci_core.h | 1 +
include/uapi/linux/vfio.h | 57 +++
14 files changed, 815 insertions(+), 169 deletions(-)
--
2.47.3
In rocket_job_run(), after taking an extra fence reference for
job->done_fence via dma_fence_get(), the error paths have three bugs:
- The dma_fence reference held by job->done_fence is never released,
causing a reference leak.
- pm_runtime_get_sync() increments the usage counter even on failure,
but the error path does not decrement it, leaking the runtime PM
reference and preventing the NPU from suspending.
- A valid but unsignaled fence is returned to the DRM scheduler,
which triggers WARN("Fence ... released with pending signals!")
when the scheduler drops its reference.
Fix by replacing pm_runtime_get_sync() with pm_runtime_resume_and_get()
which auto-balances the usage counter on failure, releasing both fence
references on error, and returning ERR_PTR(ret) instead of the
unsignaled fence.
Cc: stable(a)vger.kernel.org
Fixes: 0810d5ad88a1 ("accel/rocket: Add job submission IOCTL")
Signed-off-by: ZhaoJinming <zhaojinming(a)uniontech.com>
---
drivers/accel/rocket/rocket_job.c | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/drivers/accel/rocket/rocket_job.c b/drivers/accel/rocket/rocket_job.c
index ac51bff39833..e8a073e22ac2 100644
--- a/drivers/accel/rocket/rocket_job.c
+++ b/drivers/accel/rocket/rocket_job.c
@@ -310,13 +310,22 @@ static struct dma_fence *rocket_job_run(struct drm_sched_job *sched_job)
dma_fence_put(job->done_fence);
job->done_fence = dma_fence_get(fence);
- ret = pm_runtime_get_sync(core->dev);
- if (ret < 0)
- return fence;
+ ret = pm_runtime_resume_and_get(core->dev);
+ if (ret < 0) {
+ dma_fence_put(job->done_fence);
+ job->done_fence = NULL;
+ dma_fence_put(fence);
+ return ERR_PTR(ret);
+ }
ret = iommu_attach_group(job->domain->domain, core->iommu_group);
- if (ret < 0)
- return fence;
+ if (ret < 0) {
+ pm_runtime_put(core->dev);
+ dma_fence_put(job->done_fence);
+ job->done_fence = NULL;
+ dma_fence_put(fence);
+ return ERR_PTR(ret);
+ }
scoped_guard(mutex, &core->job_lock) {
core->in_flight_job = job;
--
2.20.1