+Cc Danilo
On Thu, 2026-06-18 at 15:03 +0100, André Draszik wrote:
> Since commit 541c8f2468b9 ("dma-buf: detach fence ops on signal v3"),
> I'm seeing the BUG_ON() triggering in drm_crtc's fence_to_crtc() via
> drm_crtc_fence_get_driver_name() regularly:
>
> Call trace:
> panic+0x58/0x5c
> die+0x160/0x178
> bug_brk_handler+0x70/0xa4
> call_el1_break_hook+0x3c/0x1a0
> do_el1_brk64+0x24/0x74
> el1_brk64+0x34/0x54
> el1h_64_sync_handler+0x80/0xfc
> el1h_64_sync+0x84/0x88
> drm_crtc_fence_get_driver_name+0x60/0x68 (P)
> sync_file_get_name+0x184/0x45c
> sync_file_ioctl+0x404/0xf70
> __arm64_sys_ioctl+0x124/0x1dc
>
> This looks to be caused by a code flow similar to the following:
>
> +++ snip +++
> thread A thread B
>
> ioctl(SYNC_IOC_FILE_INFO)
> sync_file_ioctl()
> sync_file_get_name()
> dma_fence_signal_timestamp_locked() dma_fence_driver_name()
> ops = rcu_dereference(fence->ops)
> if (!dma_fence_test_signaled_flag())
> ops->get_driver_name(fence) i.e.
> drm_crtc_fence_get_driver_name()
> test_and_set_bit(SIGNALED)
> RCU_INIT_POINTER(fence->ops, NULL)
> drm_crtc_fence_get_driver_name()
> BUG_ON(rcu_access_pointer(fence->ops)
> != &drm_crtc_fence_ops)
Now this looks like a very similar problem that I have recently been
concerned with:
https://lore.kernel.org/dri-devel/20260612104251.2264707-2-phasta@kernel.or…https://lore.kernel.org/dri-devel/fa0dc9757bf8343516c4b156a2b70ec91b64ef8f.…
I continue to believe because of bugs like this and the ones I have
quoted in the threads above the robustness of the kernel could be
greatly improved if we could get dma_fence fully synchronized with its
lock.
That said:
> +++ snap +++
>
> I see two ways to resolve this:
> a) simply drop the BUG_ON(). It can not work anymore since above
> commit, as it is racy now.
> b) pass the original 'ops' pointer obtained in dma_fence_driver_name()
> to all callees.
>
> This patch implements option a), as because:
> * I don't see much benefit in passing the extra pointer just for this
> BUG_ON() to work.
> * Requiring the dma_fence_ops in those callbacks is an implementation
> detail of the drm_crtc driver, and therefore upper layers shouldn't
> have to care about that.
> * The existence of the BUG_ON() doesn't appear to be consistent with
> implementations of ::get_driver_name() or ::get_timeline_name() in
> the majority of other DRM drivers in the first place. Those that do
> have a similar BUG_ON() (i915, xe) probably also need an update
> similar to this patch here but I'm not in a position to test those.
>
> Note that the adjacent drm_crtc_fence_get_timeline_name() has the same
> problem and is fixed by this patch as well.
>
> Fixes: 541c8f2468b9 ("dma-buf: detach fence ops on signal v3")
> Signed-off-by: André Draszik <andre.draszik(a)linaro.org>
> ---
> drivers/gpu/drm/drm_crtc.c | 11 +++--------
> 1 file changed, 3 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index 63ead8ba6756..31c8636e7467 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -73,6 +73,9 @@
> * &drm_mode_config_funcs.atomic_check.
> */
>
> +#define fence_to_crtc(f) container_of((f)->extern_lock, \
> + struct drm_crtc, fence_lock)
I agree that macros should be avoided if possible.
> +
> /**
> * drm_crtc_from_index - find the registered CRTC at an index
> * @dev: DRM device
> @@ -154,14 +157,6 @@ static void drm_crtc_crc_fini(struct drm_crtc *crtc)
> #endif
> }
>
> -static const struct dma_fence_ops drm_crtc_fence_ops;
> -
> -static struct drm_crtc *fence_to_crtc(struct dma_fence *fence)
> -{
> - BUG_ON(rcu_access_pointer(fence->ops) != &drm_crtc_fence_ops);
+1
BUG_ON is more or less deprecated and should not be used anymore. There
needs to be bombastic justification for shooting down the entire
kernel.
P.
> - return container_of(fence->extern_lock, struct drm_crtc, fence_lock);
> -}
> -
> static const char *drm_crtc_fence_get_driver_name(struct dma_fence *fence)
> {
> struct drm_crtc *crtc = fence_to_crtc(fence);
>
> ---
> base-commit: e2cae00c05d196491c318196792297f2dfbaa02c
> change-id: 20260618-linux-drm_crtc_fix2-23a7c354a412
>
> Best regards,
Changes since v2:
- Don't drop DriverFenceData as a whole, but only the members we
really want to drop. Gives more robustness. (Gary).
- Break apart large pin_init_from_closure(). (Danilo, Onur)
- Remove rcu_barrier() and synchronize_rcu() from FenceCtx::drop().
FenceCtx might drop in atomic context, where you must not perform
those operations. With the current way C dma_fence is designed, the
driver must wait for a grace period manually until it unloads.
- Repair the DriverFenceBorrow implementation, properly injecting a
life time into it. (Danilo)
- Fix memory layout bug for rcu_head. (Onur)
- Drop RCU patches, since this series doesn't need them anymore.
Changes since v1:
- Remove unnecessary mutable references (Alice)
- Split up unsafe comments where possible (Danilo)
- Remove PhantomData + implement FenceCtx ops trait (Boris)
- Consistently call FenceCtx generic data `T`. FenceDataType is
derived from that. (Boris)
- Add abstractions for call_rcu() and synchronize_rcu() (Danilo)
- Add ECANCELED error code in Rust (Alice)
- Remove the rcu_barrier() from FenceCtx::drop() – because we now use
call_rcu(), there can be no UAF access to the FenceCtx anymore. In
any case, it is illegal to use either call_rcu() or
synchronize_rcu() in FenceCtx::drop(), because our new
drop_driver_fence_data() can run in atomic context and might put the
last fence_ctx reference.
So we now only have to guard against module unload, which it seems
either the driver or Rust driver-core / module unload infrastructure
must solve.
- Minor formatting etc. changes
- Add C helpers to MAINTAINERS. (Danilo)
- Ensure that `Fence::is_signaled()` is fully synchronized, i.e., all
callbacks really have run. See [1] and [2]. (Myself, Christian
König)
Changes since the RFCs:
- Include support for ForeignOwnable for ARef, so that a Fence can be
stuffed into an XArray et al. (Code by Danilo)
- Implement ForeignOwnable (with new borrow type) for DriverFence, so
that it can be stuffed into an XArray.
- Include the rcu::RcuBox data type to defer dropping data with RCU
(Cody by Alice)
- Port DmaFence to RcuBox to make UAF bugs through later, new dma_fence
callbacks (backend_ops) impossible.
- Force users to pass their fence data in an RcuBox (or have it not
need drop()) through a Sealed trait.
- Document the rules for the user's DriverFence::data's drop
implementation very clearly (deadlock danger).
- rustfmt, Clippy.
- Various style suggestions, safety comments, etc. (Önur)
- Add __rust_helper prefix to helper functions. (Önur)
Changes in RFC v3:
- Omit JobQueue patches for now
- Completely redesign the memory layout: Instead of a Fence
refcounting a DriverFence, both now live in the same allocation to
allow for future support the dma_fence backend_ops callbacks which
need to do container_of. (mostly Boris's feedback)
- Allow for pre-allocating fences to avoid deadlocks when submitting
jobs to a GPU. (Boris)
- Simultaneously, allow for pre-preparing fence callback objects, so
the driver can allocate them when it sees fit. (code largely stolen
and inspired by Daniel).
- Signal fences on drop, ensure synchronization.
- Force users to set an error code when signalling.
- Write more documentation
- A ton of minor other changes.
[1] https://lore.kernel.org/dri-devel/20260608142436.265820-2-phasta@kernel.org/
[2] https://lore.kernel.org/dri-devel/20260612104251.2264707-2-phasta@kernel.or…
Alright, so since the last RFCs did not reveal significant design
issues, I decided to transition this series to a v1 and hope that we can
get it upstream.
This now includes code for more common infrastructure that dma_fence
needs, contributed by Danilo and Alice.
---
Old cover letter for RFC:
So, this is the spiritual successor of the first / second RFC [1]. v2
also contained code for drm::JobQueue, but mostly to show how the fence
code would be used. JobQueue is under heavy rework right now, so I don't
want to bother your eyes with it. The docstring examples should show how
Rust fences are supposed to be used, though.
This v3 contains a huge amount of highly valuable feedback from a
variety of people, notably Boris, but also from Alice, Gary and Danilo.
There are some TODOs open (a better trait for fence backend_ops and RCU
support), but my hope is that this effort is now finally approaching its
end.
I would greatly appreciate feedback and especially more information
about what might be missing to make this usable, which is obviously
where Daniel's and Boris's feedback will be valuable once more.
Please regard this patch just as what it's titled: an RFC, to discuss a
bit more and to inform a broader community about what the current state
is and where this is heading at.
Many regards,
Philipp
[1] https://lore.kernel.org/rust-for-linux/20260203081403.68733-2-phasta@kernel…
Danilo Krummrich (1):
rust: types: implement ForeignOwnable for ARef<T>
Philipp Stanner (3):
rust: error: Add ECANCELED error code
rust: Add dma_fence abstractions
MAINTAINERS: Add entry for Rust dma-buf
MAINTAINERS | 3 +
rust/bindings/bindings_helper.h | 1 +
rust/helpers/dma_fence.c | 48 ++
rust/helpers/helpers.c | 1 +
rust/kernel/dma_buf/dma_fence.rs | 852 +++++++++++++++++++++++++++++++
rust/kernel/dma_buf/mod.rs | 14 +
rust/kernel/error.rs | 1 +
rust/kernel/lib.rs | 1 +
rust/kernel/sync/aref.rs | 39 ++
9 files changed, 960 insertions(+)
create mode 100644 rust/helpers/dma_fence.c
create mode 100644 rust/kernel/dma_buf/dma_fence.rs
create mode 100644 rust/kernel/dma_buf/mod.rs
base-commit: 848bf57e98e1678ce7a49eb4e0bf0502da95dc07
--
2.54.0
On Thu, 18 Jun 2026, André Draszik <andre.draszik(a)linaro.org> wrote:
> Since commit 541c8f2468b9 ("dma-buf: detach fence ops on signal v3"),
> I'm seeing the BUG_ON() triggering in drm_crtc's fence_to_crtc() via
> drm_crtc_fence_get_driver_name() regularly:
>
> Call trace:
> panic+0x58/0x5c
> die+0x160/0x178
> bug_brk_handler+0x70/0xa4
> call_el1_break_hook+0x3c/0x1a0
> do_el1_brk64+0x24/0x74
> el1_brk64+0x34/0x54
> el1h_64_sync_handler+0x80/0xfc
> el1h_64_sync+0x84/0x88
> drm_crtc_fence_get_driver_name+0x60/0x68 (P)
> sync_file_get_name+0x184/0x45c
> sync_file_ioctl+0x404/0xf70
> __arm64_sys_ioctl+0x124/0x1dc
>
> This looks to be caused by a code flow similar to the following:
>
> +++ snip +++
> thread A thread B
>
> ioctl(SYNC_IOC_FILE_INFO)
> sync_file_ioctl()
> sync_file_get_name()
> dma_fence_signal_timestamp_locked() dma_fence_driver_name()
> ops = rcu_dereference(fence->ops)
> if (!dma_fence_test_signaled_flag())
> ops->get_driver_name(fence) i.e.
> drm_crtc_fence_get_driver_name()
> test_and_set_bit(SIGNALED)
> RCU_INIT_POINTER(fence->ops, NULL)
> drm_crtc_fence_get_driver_name()
> BUG_ON(rcu_access_pointer(fence->ops)
> != &drm_crtc_fence_ops)
> +++ snap +++
>
> I see two ways to resolve this:
> a) simply drop the BUG_ON(). It can not work anymore since above
> commit, as it is racy now.
> b) pass the original 'ops' pointer obtained in dma_fence_driver_name()
> to all callees.
>
> This patch implements option a), as because:
> * I don't see much benefit in passing the extra pointer just for this
> BUG_ON() to work.
> * Requiring the dma_fence_ops in those callbacks is an implementation
> detail of the drm_crtc driver, and therefore upper layers shouldn't
> have to care about that.
> * The existence of the BUG_ON() doesn't appear to be consistent with
> implementations of ::get_driver_name() or ::get_timeline_name() in
> the majority of other DRM drivers in the first place. Those that do
> have a similar BUG_ON() (i915, xe) probably also need an update
> similar to this patch here but I'm not in a position to test those.
>
> Note that the adjacent drm_crtc_fence_get_timeline_name() has the same
> problem and is fixed by this patch as well.
>
> Fixes: 541c8f2468b9 ("dma-buf: detach fence ops on signal v3")
> Signed-off-by: André Draszik <andre.draszik(a)linaro.org>
> ---
> drivers/gpu/drm/drm_crtc.c | 11 +++--------
> 1 file changed, 3 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index 63ead8ba6756..31c8636e7467 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -73,6 +73,9 @@
> * &drm_mode_config_funcs.atomic_check.
> */
>
> +#define fence_to_crtc(f) container_of((f)->extern_lock, \
> + struct drm_crtc, fence_lock)
> +
> /**
> * drm_crtc_from_index - find the registered CRTC at an index
> * @dev: DRM device
> @@ -154,14 +157,6 @@ static void drm_crtc_crc_fini(struct drm_crtc *crtc)
> #endif
> }
>
> -static const struct dma_fence_ops drm_crtc_fence_ops;
> -
> -static struct drm_crtc *fence_to_crtc(struct dma_fence *fence)
> -{
> - BUG_ON(rcu_access_pointer(fence->ops) != &drm_crtc_fence_ops);
Whether removing the BUG_ON() turns out to be the right choice or not, I
couldn't say, but please don't turn this function into a macro, at least
not without rationale. (I can't think of any.)
BR,
Jani.
> - return container_of(fence->extern_lock, struct drm_crtc, fence_lock);
> -}
> -
> static const char *drm_crtc_fence_get_driver_name(struct dma_fence *fence)
> {
> struct drm_crtc *crtc = fence_to_crtc(fence);
>
> ---
> base-commit: e2cae00c05d196491c318196792297f2dfbaa02c
> change-id: 20260618-linux-drm_crtc_fix2-23a7c354a412
>
> Best regards,
--
Jani Nikula, Intel
Have you ever wondered what your life would look like if you made entirely different choices? Life simulation games have always been a fascinating genre for gamers, but few capture the unpredictable, hilarious, and sometimes chaotic nature of existence quite like Bitlife. Instead of relying on heavy 3D graphics, it is a text-based simulator that focuses entirely on the ripple effects of your decisions. It’s perfect for casual gaming sessions, so let's dive into how to play and get the most out of this quirky experience.
https://bitlifefree.io/
Gameplay: Growing Up, One Year at a Time
The premise of the game is incredibly simple but highly addictive. You are born with a random set of basic stats—Happiness, Health, Smarts, and Looks—in a random country to random parents. From there, you control your character's life year by year simply by tapping the "Age" button.
In your early years, your choices are understandably limited to things like interacting with your parents, going to the doctor, or playing with pets. But as you grow into a teenager and an adult, the world completely opens up. You can choose to study hard, drop out, date, travel the world, buy real estate, or even turn to a life of crime.
Every year, the game throws random scenarios at you: a classmate might insult you, you might be offered a questionable substance at a party, or you might find a wallet on the street. How you react directly impacts your stats and future opportunities. You might even have to pass mini-games, like navigating a maze for your driving test or escaping from prison. The ultimate goal is simply to live your life until your character passes away, leaving behind a unique legacy and a tombstone summarizing your deeds.
Tips for a Great Experience
If you are just starting out, here are a few tips to make your virtual life more successful—or at least more entertaining:
Keep an eye on your core stats: Your Health and Happiness are crucial. If they drop too low, your character might face early health issues. Go to the gym, meditate, go to the movies, or spend time with family to keep these bars in the green.
Education pays off (usually): If you want a high-paying, stable career like a doctor, judge, or CEO, use the "Study harder" option every year during school. Read books at the library to passively boost your Smarts stat.
Hunt for Ribbons: At the end of every life, you are awarded a ribbon based on how you lived (e.g., "Hero," "Scandalous," "Lazy," or "Rich"). Trying to collect all the different ribbons is a great way to give yourself specific goals.
Don't be afraid of the absurd: The real charm of the game is in its wild unpredictability. Sometimes, making terrible choices, trying to become a famous actor, or buying a crazy exotic pet leads to the most memorable playthroughs. Don't always play it safe!
Conclusion
Ultimately, the beauty of this simulator lies in its endless replayability. Every time you hit the button to start a new life, it is a completely blank slate. You can be a saint in one lifetime and an absolute menace to society in the next. Whether you have five minutes to kill on a bus commute or an hour to craft a sprawling, multi-generational family dynasty, diving into Bitlife offers a fun, lighthearted escape into a world where you pull all the strings. Give it a try, and see exactly where your choices take you!
Saving progress should feel comforting.
You've survived a difficult section. You've made it through another encounter. Your progress is secure.
In theory, a save point represents safety.
Yet some of the most memorable horror games somehow make saving feel tense.
I've always found that fascinating.
In most genres, saving is a completely mechanical action. You barely think about it. Open a menu, press a button, move on.
In horror games, however, save systems often become part of the experience itself.
Sometimes they even become part of the fear.
Safety Feels Temporary
One thing horror games understand exceptionally well is that safety and danger become more meaningful when they exist side by side.
A safe room feels comforting because the rest of the world doesn't.
A save point feels valuable because progress can be lost.
That contrast creates emotional weight.
I still remember older survival horror games where reaching a save location felt like completing a journey.
Not because the act of saving was exciting.
Because getting there was.
Every hallway between me and that room carried risk. Every enemy encounter threatened valuable resources. Every mistake felt expensive.
The save point became more than a feature.
It became a destination.
Relief Can Be an Emotion Too
People often discuss fear when talking about horror games.
Relief deserves more attention.
In many ways, relief is one of the most important emotions the genre creates.
Without moments of relief, tension eventually becomes exhausting.
Players need opportunities to recover.
Save rooms often provide exactly that.
The music changes.
The atmosphere softens.
The pressure decreases.
For a few moments, players can breathe.
Those quiet pauses create an interesting effect. Instead of weakening the horror, they strengthen it.
The next dangerous section feels more intense because you've experienced a brief sense of comfort.
The contrast matters.
Fear isn't effective when it never changes.
Limited Saving Changes Behavior
Some horror games allow unlimited saves.
Others place restrictions on them.
Whether through limited resources, specific locations, or special conditions, these systems dramatically influence how players think.
I've noticed that limited saving changes decision-making almost immediately.
Players become cautious.
Resources feel more valuable.
Exploration becomes riskier.
Every choice carries additional weight because mistakes have consequences.
Suddenly, saving isn't just a technical feature.
It's a strategic decision.
Should I save now?
Should I keep going?
Can I survive the next section without doing it?
These questions create tension even when no immediate threat exists.
That's impressive design.
The game generates anxiety through decision-making rather than direct danger.
The Walk Back Is Sometimes Scarier
One of my favorite horror gaming experiences involves leaving a save room.
Entering feels great.
Leaving feels terrible.
The moment you step back into the unknown, the comfort disappears.
The music fades.
The safety vanishes.
The uncertainty returns.
What's interesting is that nothing may have changed.
The environment is the same.
The enemies are the same.
The layout remains familiar.
Yet emotionally, everything feels different.
You know you're moving away from security.
That awareness alone increases tension.
I've experienced situations where opening the door to leave a save room felt more intimidating than entering a boss area.
Not because I expected a specific threat.
Because I was abandoning certainty.
Modern Horror Uses Saving Differently
Contemporary horror games often approach saving in a less restrictive way.
Autosaves are common.
Checkpoints are frequent.
Players rarely lose significant amounts of progress.
That shift has obvious advantages. It reduces frustration and makes games more accessible.
At the same time, it changes the emotional role of saving.
Older horror games often transformed save systems into part of the atmosphere.
Modern games typically treat them as invisible support systems.
Neither approach is inherently better.
They're simply pursuing different goals.
One emphasizes vulnerability.
The other prioritizes convenience.
Interestingly, both can still create effective horror when used thoughtfully.
For another perspective on player vulnerability, see our [discussion about why limited resources increase tension].
Safe Rooms Become Emotional Anchors
Some locations in horror games remain memorable long after the details of the story fade.
Safe rooms are often among them.
Players remember how those spaces felt.
The familiar music.
The calm atmosphere.
The temporary sense of control.
I've finished games years ago and forgotten specific enemy encounters, yet I can still picture certain save rooms clearly.
That's remarkable when you think about it.
These locations rarely contain action.
Nothing dramatic happens there.
Their importance comes entirely from emotion.
They provide stability within unstable worlds.
The player develops a relationship with them.
Returning feels reassuring.
Leaving feels uncomfortable.
Few game mechanics achieve that kind of emotional significance.
Fear Feels Bigger When Progress Matters
A major reason save systems affect horror so strongly is simple.
Consequences matter.
If players feel that failure costs nothing, tension often decreases.
When progress becomes valuable, fear gains additional weight.
Suddenly every encounter feels important.
Every decision matters.
Every mistake carries consequences beyond the immediate moment.
This doesn't mean horror games need harsh punishment systems.
Excessive penalties can easily become frustrating.
But a small amount of risk often makes emotional investment stronger.
Players care more because they have something to lose.
And caring is essential for fear.
Without investment, horror struggles to have lasting impact.
The Psychology of "Just One More Room"
I've fallen into this trap countless times.
You're standing near a save point.
Logic says you should save and stop playing.
Instead, you think:
"I'll check one more room."
Then another room.
Then another hallway.
Then another objective.
Before long, you've wandered into a situation far more dangerous than expected.
Horror games thrive on this kind of curiosity.
Players constantly balance caution against exploration.
The save point represents security.
The unexplored area represents possibility.
Most of the time, curiosity wins.
That's why horror games remain so engaging despite the fear they create.
Players aren't simply avoiding danger.
They're actively seeking answers.
Why Save Points Remain Memorable
Not every horror game uses traditional save rooms anymore.
Not every game limits progress in meaningful ways.
Yet the underlying idea remains powerful.
Players need moments of safety.
Moments of relief.
Moments where tension briefly relaxes before building again.
Save points became iconic because they delivered those emotions consistently.
They represented hope within hostile environments.
A reminder that survival was possible.
A chance to regroup before facing whatever came next.
And perhaps that's why so many horror fans remember them so fondly.
They weren't frightening on their own.
They mattered because of everything waiting outside.
After all, what makes a safe place feel truly safe if there was never any danger to escape from in the first place?
https://horrorgamesfree.com
College life is often seen as an exciting phase filled with new experiences, independence, friendships, and opportunities. However, behind the social events and academic growth, many students also face stress, anxiety, loneliness, and pressure to perform well. Managing mental health during this time is just as important as achieving good grades, because emotional well-being directly impacts concentration, productivity, and overall success. Learning how to take care of your mental health can help students handle challenges more effectively and enjoy a more balanced college experience.
Many students struggle to keep up with assignments, deadlines, and academic expectations, which can sometimes feel overwhelming. In such situations, academic support services like pay for someone to <a href="https://myassignmenthelp.com/ca/do-my-homework.html">do my homework online</a> from MyAssignmentHelp can help reduce academic pressure and allow students to focus on maintaining better mental and emotional well-being alongside their studies.
Understanding Mental Health in College Life
Mental health refers to a person’s emotional, psychological, and social well-being. In college, students go through major life transitions—moving away from home, adapting to new environments, managing finances, and handling academic responsibilities. All of these changes can affect mental stability.
It is normal to feel stressed occasionally, but prolonged stress or emotional exhaustion should not be ignored. Recognizing early signs such as fatigue, loss of motivation, irritability, or difficulty concentrating is important for taking timely action.
Maintain a Balanced Routine
One of the most effective ways to support mental health is by maintaining a balanced daily routine. A structured lifestyle helps reduce chaos and creates a sense of stability.
Students should try to:
Follow a consistent sleep schedule
Allocate time for study and relaxation
Avoid last-minute cramming
Include breaks between study sessions
Set realistic daily goals
A balanced routine helps prevent burnout and ensures that students do not feel overwhelmed by academic pressure.
Prioritize Sleep and Rest
Sleep plays a crucial role in mental health. Lack of sleep can increase stress levels, reduce concentration, and negatively impact memory.
College students often sacrifice sleep to complete assignments or prepare for exams, but this habit can be harmful in the long run. Ideally, students should aim for 7–9 hours of quality sleep each night.
Creating a bedtime routine, limiting screen time before sleep, and avoiding caffeine late in the day can significantly improve sleep quality.
Stay Physically Active
Physical activity is not just good for the body but also essential for mental well-being. Exercise releases endorphins, which are natural mood boosters.
Students do not need intense workouts to benefit from physical activity. Simple habits like walking, cycling, yoga, or light stretching can make a big difference.
Regular exercise helps:
Reduce stress and anxiety
Improve focus and concentration
Boost energy levels
Enhance overall mood
Even 20–30 minutes of activity a day can have noticeable positive effects.
Build Strong Social Connections
Social support is one of the most important factors in maintaining good mental health. College is a great place to build friendships and connections that provide emotional support.
Students should try to:
Spend time with supportive friends
Participate in group activities
Join clubs or student organizations
Talk openly about feelings when needed
Having people to talk to can reduce feelings of loneliness and help students cope better with stress.
Learn Stress Management Techniques
Stress is unavoidable in college, but it can be managed effectively with the right techniques.
Some helpful stress management strategies include:
Deep breathing exercises
Meditation and mindfulness practices
Journaling thoughts and emotions
Listening to calming music
Taking short breaks during study sessions
These techniques help calm the mind and improve emotional balance.
Avoid Overloading Yourself
Many students try to take on too many responsibilities at once—academics, part-time jobs, extracurricular activities, and social commitments. While involvement is important, overloading can lead to burnout.
Learning to say no when necessary is a healthy habit. Students should prioritize tasks based on importance and avoid unnecessary pressure.
It is better to do a few things well than to do everything poorly due to exhaustion.
Seek Help When Needed
One of the most important aspects of mental health is recognizing when help is needed. Unfortunately, many students hesitate to seek support due to stigma or fear of judgment.
However, asking for help is a sign of strength, not weakness. Support can come from:
Friends and family
College counselors
Mentors or professors
Mental health professionals
Talking about problems can provide relief and open up solutions that may not be visible when dealing with stress alone.
Limit Social Media Usage
While social media helps students stay connected, excessive use can negatively affect mental health. Constant comparison with others, exposure to unrealistic lifestyles, and online pressure can increase anxiety and reduce self-esteem.
Students should:
Set time limits for social media use
Avoid comparing themselves to others
Take digital detox breaks
Focus on real-life interactions
Reducing screen time can improve focus, productivity, and emotional well-being.
Practice Self-Care Regularly
Self-care is essential for maintaining mental balance. It involves taking time to do activities that bring relaxation and happiness.
Self-care can include:
Reading a book
Watching a favorite show
Spending time in nature
Pursuing hobbies
Taking rest without guilt
Prioritizing self-care helps recharge the mind and improves resilience against stress.
Develop a Positive Mindset
A positive mindset plays a major role in mental health. College life comes with challenges, and setbacks are a normal part of the journey.
Instead of focusing on failures, students should:
Learn from mistakes
Celebrate small achievements
Stay hopeful during difficult times
Practice gratitude
Positive thinking helps build confidence and reduces emotional distress.
Maintain Academic Balance
Academic pressure is one of the biggest sources of stress for college students. Managing coursework effectively can significantly improve mental health.
Students should break tasks into smaller steps, avoid procrastination, and seek academic support when necessary. Staying organized can reduce last-minute stress and improve overall performance.
Conclusion
Mental health is a vital part of a successful and fulfilling college experience. Students who take care of their emotional well-being are more likely to perform better academically, build stronger relationships, and enjoy their college journey. By maintaining a balanced routine, staying physically active, managing stress, and seeking support when needed, students can create a healthier and more positive lifestyle. Remember, college is not just about academic achievement—it is also about growing as a person, and mental well-being
On Wed, Jun 10, 2026 at 04:43:20PM +0100, Matt Evans wrote:
> Previously, vfio_pci_zap_bars() (and the wrapper
> vfio_pci_zap_and_down_write_memory_lock()) calls were paired with
> calls to vfio_pci_dma_buf_move().
>
> This commit replaces them with a unified new function,
> vfio_pci_zap_revoke_bars() containing both the vfio_pci_dma_buf_move()
> and the unmap_mapping_range(), making it harder for callers to omit
> one. It adds a wrapper, vfio_pci_lock_zap_revoke_bars(), which takes
> the write memory_lock before zapping, and adds a new
> vfio_pci_unrevoke_bars() for the re-enable path.
>
> As of "vfio/pci: Convert BAR mmap() to use a DMABUF", the
> unmap_mapping_range() to zap is no longer performed for vfio-pci since
> the DMABUFs used for BAR mappings already zap PTEs when the
> vfio_pci_dma_buf_move() occurs.
>
> However, it must be assumed that VFIO drivers which override the .mmap
> op could create mappings _not_ backed by DMABUFs. So, the zap is
> still performed on revoke if .mmap is overridden, using a new
> zap_bars_on_revoke flag. A driver can explicitly opt out; the flag is
> cleared by the hisi_acc_vfio_pci driver, since its .mmap just wraps
> vfio_pci_core_mmap() and so still uses DMABUFs.
>
> Signed-off-by: Matt Evans <matt(a)ozlabs.org>
> ---
> .../vfio/pci/hisilicon/hisi_acc_vfio_pci.c | 8 +++
> drivers/vfio/pci/vfio_pci_config.c | 30 ++++----
> drivers/vfio/pci/vfio_pci_core.c | 70 +++++++++++++------
> drivers/vfio/pci/vfio_pci_priv.h | 3 +-
> include/linux/vfio_pci_core.h | 1 +
> 5 files changed, 73 insertions(+), 39 deletions(-)
>
> diff --git a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c
> index 86362ec424a5..51990f6d66d5 100644
> --- a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c
> +++ b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c
> @@ -1692,6 +1692,14 @@ static int hisi_acc_vfio_pci_probe(struct pci_dev *pdev, const struct pci_device
> if (ret)
> goto out_put_vdev;
>
> + /*
> + * hisi_acc_vfio_pci_mmap() calls down to
> + * vfio_pci_core_mmap(), so BAR mappings are still
> + * DMABUF-backed. They don't require a zap on revoke, so opt
> + * out:
> + */
> + hisi_acc_vdev->core_device.zap_bars_on_revoke = false;
> +
This seems to be happening after we vfio_pci_core_register_device, which
could be slightly problematic if another device in the same group races
to trigger a hot reset before we can set this to false. Could we
initialize this flag before registration instead?
> hisi_acc_vfio_debug_init(hisi_acc_vdev);
> return 0;
>
> diff --git a/drivers/vfio/pci/vfio_pci_config.c b/drivers/vfio/pci/vfio_pci_config.c
> index a10ed733f0e3..8bfab0da481c 100644
> --- a/drivers/vfio/pci/vfio_pci_config.c
> +++ b/drivers/vfio/pci/vfio_pci_config.c
> @@ -590,12 +590,10 @@ static int vfio_basic_config_write(struct vfio_pci_core_device *vdev, int pos,
> virt_mem = !!(le16_to_cpu(*virt_cmd) & PCI_COMMAND_MEMORY);
> new_mem = !!(new_cmd & PCI_COMMAND_MEMORY);
>
> - if (!new_mem) {
> - vfio_pci_zap_and_down_write_memory_lock(vdev);
> - vfio_pci_dma_buf_move(vdev, true);
> - } else {
> + if (!new_mem)
> + vfio_pci_lock_zap_revoke_bars(vdev);
> + else
> down_write(&vdev->memory_lock);
> - }
>
> /*
> * If the user is writing mem/io enable (new_mem/io) and we
> @@ -631,7 +629,7 @@ static int vfio_basic_config_write(struct vfio_pci_core_device *vdev, int pos,
> *virt_cmd |= cpu_to_le16(new_cmd & mask);
>
> if (__vfio_pci_memory_enabled(vdev))
> - vfio_pci_dma_buf_move(vdev, false);
> + vfio_pci_unrevoke_bars(vdev);
> up_write(&vdev->memory_lock);
> }
>
> @@ -712,16 +710,14 @@ static int __init init_pci_cap_basic_perm(struct perm_bits *perm)
> static void vfio_lock_and_set_power_state(struct vfio_pci_core_device *vdev,
> pci_power_t state)
> {
> - if (state >= PCI_D3hot) {
> - vfio_pci_zap_and_down_write_memory_lock(vdev);
> - vfio_pci_dma_buf_move(vdev, true);
> - } else {
> + if (state >= PCI_D3hot)
> + vfio_pci_lock_zap_revoke_bars(vdev);
> + else
> down_write(&vdev->memory_lock);
> - }
>
> vfio_pci_set_power_state(vdev, state);
> if (__vfio_pci_memory_enabled(vdev))
> - vfio_pci_dma_buf_move(vdev, false);
> + vfio_pci_unrevoke_bars(vdev);
> up_write(&vdev->memory_lock);
> }
>
> @@ -908,11 +904,10 @@ static int vfio_exp_config_write(struct vfio_pci_core_device *vdev, int pos,
> &cap);
>
> if (!ret && (cap & PCI_EXP_DEVCAP_FLR)) {
> - vfio_pci_zap_and_down_write_memory_lock(vdev);
> - vfio_pci_dma_buf_move(vdev, true);
> + vfio_pci_lock_zap_revoke_bars(vdev);
> pci_try_reset_function(vdev->pdev);
> if (__vfio_pci_memory_enabled(vdev))
> - vfio_pci_dma_buf_move(vdev, false);
> + vfio_pci_unrevoke_bars(vdev);
> up_write(&vdev->memory_lock);
> }
> }
> @@ -993,11 +988,10 @@ static int vfio_af_config_write(struct vfio_pci_core_device *vdev, int pos,
> &cap);
>
> if (!ret && (cap & PCI_AF_CAP_FLR) && (cap & PCI_AF_CAP_TP)) {
> - vfio_pci_zap_and_down_write_memory_lock(vdev);
> - vfio_pci_dma_buf_move(vdev, true);
> + vfio_pci_lock_zap_revoke_bars(vdev);
> pci_try_reset_function(vdev->pdev);
> if (__vfio_pci_memory_enabled(vdev))
> - vfio_pci_dma_buf_move(vdev, false);
> + vfio_pci_unrevoke_bars(vdev);
> up_write(&vdev->memory_lock);
> }
> }
> diff --git a/drivers/vfio/pci/vfio_pci_core.c b/drivers/vfio/pci/vfio_pci_core.c
> index f9636d8f9e2a..5ea0bd4e7876 100644
> --- a/drivers/vfio/pci/vfio_pci_core.c
> +++ b/drivers/vfio/pci/vfio_pci_core.c
> @@ -319,8 +319,7 @@ static int vfio_pci_runtime_pm_entry(struct vfio_pci_core_device *vdev,
> * The vdev power related flags are protected with 'memory_lock'
> * semaphore.
> */
> - vfio_pci_zap_and_down_write_memory_lock(vdev);
> - vfio_pci_dma_buf_move(vdev, true);
> + vfio_pci_lock_zap_revoke_bars(vdev);
>
> if (vdev->pm_runtime_engaged) {
> up_write(&vdev->memory_lock);
> @@ -406,7 +405,7 @@ static void vfio_pci_runtime_pm_exit(struct vfio_pci_core_device *vdev)
> down_write(&vdev->memory_lock);
> __vfio_pci_runtime_pm_exit(vdev);
> if (__vfio_pci_memory_enabled(vdev))
> - vfio_pci_dma_buf_move(vdev, false);
> + vfio_pci_unrevoke_bars(vdev);
> up_write(&vdev->memory_lock);
> }
>
> @@ -1256,6 +1255,8 @@ static int vfio_pci_ioctl_set_irqs(struct vfio_pci_core_device *vdev,
> return ret;
> }
>
> +static void vfio_pci_zap_revoke_bars(struct vfio_pci_core_device *vdev);
> +
> static int vfio_pci_ioctl_reset(struct vfio_pci_core_device *vdev,
> void __user *arg)
> {
> @@ -1264,7 +1265,7 @@ static int vfio_pci_ioctl_reset(struct vfio_pci_core_device *vdev,
> if (!vdev->reset_works)
> return -EINVAL;
>
> - vfio_pci_zap_and_down_write_memory_lock(vdev);
> + down_write(&vdev->memory_lock);
>
> /*
> * This function can be invoked while the power state is non-D0. If
> @@ -1277,10 +1278,11 @@ static int vfio_pci_ioctl_reset(struct vfio_pci_core_device *vdev,
> */
> vfio_pci_set_power_state(vdev, PCI_D0);
>
> - vfio_pci_dma_buf_move(vdev, true);
> + vfio_pci_zap_revoke_bars(vdev);
I'm wondering if this change in behavior is correct?
BEFORE this patch the sequence was:
1. zap vma mappings
2. Enter D0
After this patch the sequence becomes
1. Take the lock
2. Enter D0
3. zap vma mappings
My worry is if user-space accesses a BAR *during* the transition to D0,
it could crash since the mappings still exist during the transition?
The old code is immune to it because it removed user-mappings first.
Following the discussion from v1 regarding the ordering of
vfio_pci_dma_buf_move() and the D0 transition.. while it makes sense to
perform the DMABUF revocation/move after the hardware is in D0.. I'm not
too confident about moving zap after D0 :/
I mean, sure, the user would just see all Fs on a read and writes will
be dropped silently until we are in D0.. but the behaviour before this
change was that the user access will fault and hang on the memory_lock
instead which ensures that the user observes a consistent dev state..
> +
> ret = pci_try_reset_function(vdev->pdev);
> if (__vfio_pci_memory_enabled(vdev))
> - vfio_pci_dma_buf_move(vdev, false);
> + vfio_pci_unrevoke_bars(vdev);
> up_write(&vdev->memory_lock);
>
> return ret;
> @@ -1648,20 +1650,37 @@ ssize_t vfio_pci_core_write(struct vfio_device *core_vdev, const char __user *bu
> }
Thanks,
Praan