mirror of
https://github.com/CHN-beta/nixos.git
synced 2024-10-22 21:38:44 +08:00
Compare commits
27 Commits
b84367f6b4
...
421a0854d0
Author | SHA1 | Date | |
---|---|---|---|
421a0854d0 | |||
d70544a2d4 | |||
fb6525d986 | |||
1fbd9f2f98 | |||
5c579399d5 | |||
59552cb86e | |||
447106a5e8 | |||
9ce119ea5c | |||
2ccc906d42 | |||
92599b7419 | |||
48388ee644 | |||
da26391714 | |||
bdd2cca8d6 | |||
f0097cddb4 | |||
738bcb7277 | |||
1a1f36caed | |||
4204981cd9 | |||
e2b3735392 | |||
87b7ca3689 | |||
61316148e1 | |||
45cd321bce | |||
4f35f43613 | |||
6eee2f4eaf | |||
a312f6c06b | |||
965e8cc8dc | |||
85c41f98fe | |||
5f134d09c2 |
@ -48,8 +48,8 @@ inputs:
|
||||
{ march = "znver4"; cuda = { enable = true; capabilities = [ "8.9" ]; forwardCompat = false; }; };
|
||||
kernel =
|
||||
{
|
||||
variant = "xanmod-latest";
|
||||
patches = [ "hibernate-progress" "amdgpu" ];
|
||||
variant = "cachyos";
|
||||
patches = [ "hibernate-progress" ];
|
||||
modules.modprobeConfig =
|
||||
[ "options iwlwifi power_save=0" "options iwlmvm power_scheme=1" "options iwlwifi uapsd_disable=1" ];
|
||||
};
|
||||
@ -142,7 +142,7 @@ inputs:
|
||||
waydroid = {};
|
||||
docker = {};
|
||||
};
|
||||
bugs = [ "xmunet" "backlight" "amdpstate" "bluetooth" ];
|
||||
bugs = [ "xmunet" "backlight" "amdpstate" "plasma" ];
|
||||
};
|
||||
boot =
|
||||
{
|
||||
@ -190,6 +190,11 @@ inputs:
|
||||
};
|
||||
system.nixos.tags = [ "nvidia" ];
|
||||
};
|
||||
xanmod.configuration =
|
||||
{
|
||||
nixos.system.kernel.variant = inputs.lib.mkForce "xanmod-latest";
|
||||
system.nixos.tags = [ "xanmod" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ inputs:
|
||||
waydroid = {};
|
||||
docker = {};
|
||||
};
|
||||
bugs = [ "xmunet" "suspend-hibernate-no-platform" "bluetooth" ];
|
||||
bugs = [ "xmunet" "suspend-hibernate-no-platform" "plasma" ];
|
||||
packages.vasp = null;
|
||||
};
|
||||
powerManagement.resumeCommands = ''${inputs.pkgs.systemd}/bin/systemctl restart iptsd'';
|
||||
|
505
flake.lock
505
flake.lock
File diff suppressed because it is too large
Load Diff
@ -3,7 +3,7 @@
|
||||
|
||||
inputs =
|
||||
{
|
||||
nixpkgs.url = "github:CHN-beta/nixpkgs/nixos-unstable";
|
||||
nixpkgs.url = "github:CHN-beta/nixpkgs/next";
|
||||
"nixpkgs-23.11".url = "github:CHN-beta/nixpkgs/nixos-23.11";
|
||||
"nixpkgs-23.05".url = "github:CHN-beta/nixpkgs/nixos-23.05";
|
||||
"nixpkgs-22.11".url = "github:NixOS/nixpkgs/nixos-22.11";
|
||||
@ -26,7 +26,7 @@
|
||||
inputs = { nixpkgs.follows = "nixpkgs"; home-manager.follows = "home-manager"; };
|
||||
};
|
||||
nur-linyinfeng = { url = "github:linyinfeng/nur-packages"; inputs.nixpkgs.follows = "nixpkgs"; };
|
||||
nixos-hardware.url = "github:CHN-beta/nixos-hardware";
|
||||
nixos-hardware.url = "github:CHN-beta/nixos-hardware/next";
|
||||
envfs = { url = "github:Mic92/envfs"; inputs.nixpkgs.follows = "nixpkgs"; };
|
||||
nix-fast-build = { url = "github:/Mic92/nix-fast-build"; inputs.nixpkgs.follows = "nixpkgs"; };
|
||||
nix-flatpak.url = "github:gmodena/nix-flatpak";
|
||||
@ -38,8 +38,8 @@
|
||||
gricad = { url = "github:Gricad/nur-packages"; flake = false; };
|
||||
catppuccin.url = "github:catppuccin/nix";
|
||||
bscpkgs = { url = "git+https://git.chn.moe/chn/bscpkgs.git"; inputs.nixpkgs.follows = "nixpkgs"; };
|
||||
poetry2nix = { url = "github:CHN-beta/poetry2nix"; inputs.nixpkgs.follows = "nixpkgs"; };
|
||||
winapps = { url = "github:CHN-beta/winapps/feat-nix-packaging"; inputs.nixpkgs.follows = "nixpkgs"; };
|
||||
poetry2nix = { url = "github:nix-community/poetry2nix"; inputs.nixpkgs.follows = "nixpkgs"; };
|
||||
winapps = { url = "github:winapps-org/winapps/feat-nix-packaging"; inputs.nixpkgs.follows = "nixpkgs"; };
|
||||
|
||||
misskey = { url = "git+https://github.com/CHN-beta/misskey?submodules=1"; flake = false; };
|
||||
rsshub = { url = "github:DIYgod/RSSHub"; flake = false; };
|
||||
|
@ -1,2 +1,4 @@
|
||||
{ inputs }: let inherit (inputs.self.packages.x86_64-linux) pkgs; in
|
||||
{}
|
||||
{
|
||||
git-lfs-transfer = "sha256-1cGlhLdnU6yTqzcB3J1cq3gawncbtdgkb3LFh2ZmXbM=";
|
||||
}
|
||||
|
@ -40,9 +40,11 @@ inputs:
|
||||
amdpstate.boot.kernelParams = [ "amd_pstate=active" ];
|
||||
hibernate-mt7921e.powerManagement.resumeCommands =
|
||||
let modprobe = "${inputs.pkgs.kmod}/bin/modprobe"; in "${modprobe} -r -w 3000 mt7921e && ${modprobe} mt7921e";
|
||||
# could not use bt keyboard
|
||||
# https://github.com/bluez/bluez/issues/745
|
||||
bluetooth.hardware.bluetooth.settings.General.JustWorksRepairing = "always";
|
||||
# https://discuss.kde.org/t/bug-power-profiles-daemon-0-23-seems-starts-too-late-for-powerdevil/21416
|
||||
# remove in plasma 6.2
|
||||
plasma.nixpkgs.overlays = [(final: prev: { kdePackages = prev.kdePackages.overrideScope
|
||||
(final: prev: { powerdevil = prev.powerdevil.overrideAttrs
|
||||
(prev: { patches = prev.patches or [] ++ [ ./plasma.patch ]; });});})];
|
||||
};
|
||||
in
|
||||
{
|
||||
|
381
modules/bugs/plasma.patch
Normal file
381
modules/bugs/plasma.patch
Normal file
@ -0,0 +1,381 @@
|
||||
From 8e698dbcdc9ce95095ea2739713fde05ca4822f5 Mon Sep 17 00:00:00 2001
|
||||
From: Jakob Petsovits <jpetso@petsovits.com>
|
||||
Date: Fri, 13 Sep 2024 17:05:35 +0200
|
||||
Subject: [PATCH] applets/batterymonitor: React to D-Bus service (un)register
|
||||
events
|
||||
|
||||
Previously, the "Power and Battery" applet only checked for the
|
||||
presence of PowerDevil's D-Bus services once when it starts up.
|
||||
This appears to (mostly?) work for applets embedded in a panel,
|
||||
but does not work for applets on the desktop itself.
|
||||
Likely there's a timing issue and applets on the desktop start
|
||||
sooner than PowerDevil will advertise its services.
|
||||
|
||||
A better way to work is for the applet to monitor the bus for when
|
||||
the relevant services appear or disappear. When observing a service
|
||||
registered or unregistered event, the applet gets set up accordingly.
|
||||
|
||||
This fixes the race condition for two out of three applet parts
|
||||
(power profiles, inhibitions) but does not fix battery status;
|
||||
the data for that is coming from `BatteryControlModel`
|
||||
in plasma-workspace. A similar fix will have to be implemented there.
|
||||
|
||||
CCBUG: 488915
|
||||
CCBUG: 489003
|
||||
CCBUG: 492859
|
||||
CCBUG: 492945
|
||||
---
|
||||
.../plugin/powermanagementcontrol.cpp | 100 +++++++++++++++---
|
||||
.../plugin/powermanagementcontrol.h | 12 ++-
|
||||
.../plugin/powerprofilescontrol.cpp | 78 +++++++++++++-
|
||||
.../plugin/powerprofilescontrol.h | 11 +-
|
||||
4 files changed, 185 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/applets/batterymonitor/plugin/powermanagementcontrol.cpp b/applets/batterymonitor/plugin/powermanagementcontrol.cpp
|
||||
index fa3e59c49..72af079a7 100644
|
||||
--- a/applets/batterymonitor/plugin/powermanagementcontrol.cpp
|
||||
+++ b/applets/batterymonitor/plugin/powermanagementcontrol.cpp
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <QDBusInterface>
|
||||
#include <QDBusMetaType>
|
||||
#include <QDBusReply>
|
||||
+#include <QDBusServiceWatcher>
|
||||
#include <QString>
|
||||
#include <QVariant>
|
||||
|
||||
@@ -26,11 +27,53 @@ static constexpr QLatin1StringView FDO_POWERMANAGEMENT_SERVICE("org.freedesktop.
|
||||
|
||||
PowerManagementControl::PowerManagementControl(QObject *parent)
|
||||
: QObject(parent)
|
||||
+ , m_solidWatcher(new QDBusServiceWatcher)
|
||||
+ , m_fdoWatcher(new QDBusServiceWatcher)
|
||||
{
|
||||
qDBusRegisterMetaType<QList<InhibitionInfo>>();
|
||||
qDBusRegisterMetaType<InhibitionInfo>();
|
||||
|
||||
+ // Watch for PowerDevil's power management service
|
||||
+ m_solidWatcher->setConnection(QDBusConnection::sessionBus());
|
||||
+ m_solidWatcher->setWatchMode(QDBusServiceWatcher::WatchForRegistration | QDBusServiceWatcher::WatchForUnregistration);
|
||||
+ m_solidWatcher->addWatchedService(SOLID_POWERMANAGEMENT_SERVICE);
|
||||
+
|
||||
+ connect(m_solidWatcher.get(), &QDBusServiceWatcher::serviceRegistered, this, &PowerManagementControl::onServiceRegistered);
|
||||
+ connect(m_solidWatcher.get(), &QDBusServiceWatcher::serviceUnregistered, this, &PowerManagementControl::onServiceUnregistered);
|
||||
+ // If it's up and running already, let's cache it
|
||||
if (QDBusConnection::sessionBus().interface()->isServiceRegistered(SOLID_POWERMANAGEMENT_SERVICE)) {
|
||||
+ onServiceRegistered(SOLID_POWERMANAGEMENT_SERVICE);
|
||||
+ }
|
||||
+
|
||||
+ // Watch for the freedesktop.org power management service
|
||||
+ m_fdoWatcher->setConnection(QDBusConnection::sessionBus());
|
||||
+ m_fdoWatcher->setWatchMode(QDBusServiceWatcher::WatchForRegistration | QDBusServiceWatcher::WatchForUnregistration);
|
||||
+ m_fdoWatcher->addWatchedService(FDO_POWERMANAGEMENT_SERVICE);
|
||||
+
|
||||
+ connect(m_fdoWatcher.get(), &QDBusServiceWatcher::serviceRegistered, this, &PowerManagementControl::onServiceRegistered);
|
||||
+ connect(m_fdoWatcher.get(), &QDBusServiceWatcher::serviceUnregistered, this, &PowerManagementControl::onServiceUnregistered);
|
||||
+ // If it's up and running already, let's cache it
|
||||
+ if (QDBusConnection::sessionBus().interface()->isServiceRegistered(FDO_POWERMANAGEMENT_SERVICE)) {
|
||||
+ onServiceRegistered(FDO_POWERMANAGEMENT_SERVICE);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+PowerManagementControl::~PowerManagementControl()
|
||||
+{
|
||||
+}
|
||||
+
|
||||
+void PowerManagementControl::onServiceRegistered(const QString &serviceName)
|
||||
+{
|
||||
+ if (serviceName == FDO_POWERMANAGEMENT_SERVICE) {
|
||||
+ if (!QDBusConnection::sessionBus().connect(FDO_POWERMANAGEMENT_SERVICE,
|
||||
+ QStringLiteral("/org/freedesktop/PowerManagement"),
|
||||
+ QStringLiteral("org.freedesktop.PowerManagement.Inhibit"),
|
||||
+ QStringLiteral("HasInhibitChanged"),
|
||||
+ this,
|
||||
+ SLOT(onHasInhibitionChanged(bool)))) {
|
||||
+ qCDebug(APPLETS::BATTERYMONITOR) << "Error connecting to fdo inhibition changes via dbus";
|
||||
+ }
|
||||
+ } else if (serviceName == SOLID_POWERMANAGEMENT_SERVICE) {
|
||||
m_isManuallyInhibited = InhibitMonitor::self().getInhibit();
|
||||
connect(&InhibitMonitor::self(), &InhibitMonitor::isManuallyInhibitedChanged, this, &PowerManagementControl::onIsManuallyInhibitedChanged);
|
||||
connect(&InhibitMonitor::self(), &InhibitMonitor::isManuallyInhibitedChangeError, this, &PowerManagementControl::onisManuallyInhibitedErrorChanged);
|
||||
@@ -119,21 +162,54 @@ PowerManagementControl::PowerManagementControl(QObject *parent)
|
||||
qCDebug(APPLETS::BATTERYMONITOR) << "Error connecting to temporarily blocked inhibition changes via dbus";
|
||||
}
|
||||
}
|
||||
-
|
||||
- if (QDBusConnection::sessionBus().interface()->isServiceRegistered(FDO_POWERMANAGEMENT_SERVICE)) {
|
||||
- if (!QDBusConnection::sessionBus().connect(FDO_POWERMANAGEMENT_SERVICE,
|
||||
- QStringLiteral("/org/freedesktop/PowerManagement"),
|
||||
- QStringLiteral("org.freedesktop.PowerManagement.Inhibit"),
|
||||
- QStringLiteral("HasInhibitChanged"),
|
||||
- this,
|
||||
- SLOT(onHasInhibitionChanged(bool)))) {
|
||||
- qCDebug(APPLETS::BATTERYMONITOR) << "Error connecting to fdo inhibition changes via dbus";
|
||||
- }
|
||||
- }
|
||||
}
|
||||
|
||||
-PowerManagementControl::~PowerManagementControl()
|
||||
+void PowerManagementControl::onServiceUnregistered(const QString &serviceName)
|
||||
{
|
||||
+ if (serviceName == FDO_POWERMANAGEMENT_SERVICE) {
|
||||
+ QDBusConnection::sessionBus().disconnect(FDO_POWERMANAGEMENT_SERVICE,
|
||||
+ QStringLiteral("/org/freedesktop/PowerManagement"),
|
||||
+ QStringLiteral("org.freedesktop.PowerManagement.Inhibit"),
|
||||
+ QStringLiteral("HasInhibitChanged"),
|
||||
+ this,
|
||||
+ SLOT(onHasInhibitionChanged(bool)));
|
||||
+ } else if (serviceName == SOLID_POWERMANAGEMENT_SERVICE) {
|
||||
+ disconnect(&InhibitMonitor::self(), &InhibitMonitor::isManuallyInhibitedChanged, this, &PowerManagementControl::onIsManuallyInhibitedChanged);
|
||||
+ disconnect(&InhibitMonitor::self(), &InhibitMonitor::isManuallyInhibitedChangeError, this, &PowerManagementControl::onisManuallyInhibitedErrorChanged);
|
||||
+
|
||||
+ QDBusConnection::sessionBus().disconnect(SOLID_POWERMANAGEMENT_SERVICE,
|
||||
+ QStringLiteral("/org/kde/Solid/PowerManagement/Actions/HandleButtonEvents"),
|
||||
+ QStringLiteral("org.kde.Solid.PowerManagement.Actions.HandleButtonEvents"),
|
||||
+ QStringLiteral("triggersLidActionChanged"),
|
||||
+ this,
|
||||
+ SLOT(triggersLidActionChanged(bool)));
|
||||
+ QDBusConnection::sessionBus().disconnect(SOLID_POWERMANAGEMENT_SERVICE,
|
||||
+ QStringLiteral("/org/kde/Solid/PowerManagement/PolicyAgent"),
|
||||
+ QStringLiteral("org.kde.Solid.PowerManagement.PolicyAgent"),
|
||||
+ QStringLiteral("InhibitionsChanged"),
|
||||
+ this,
|
||||
+ SLOT(onInhibitionsChanged(QList<InhibitionInfo>, QStringList)));
|
||||
+ QDBusConnection::sessionBus().disconnect(SOLID_POWERMANAGEMENT_SERVICE,
|
||||
+ QStringLiteral("/org/kde/Solid/PowerManagement/PolicyAgent"),
|
||||
+ QStringLiteral("org.kde.Solid.PowerManagement.PolicyAgent"),
|
||||
+ QStringLiteral("PermanentlyBlockedInhibitionsChanged"),
|
||||
+ this,
|
||||
+ SLOT(onPermanentlyBlockedInhibitionsChanged(QList<InhibitionInfo>, QList<InhibitionInfo>)));
|
||||
+ QDBusConnection::sessionBus().disconnect(SOLID_POWERMANAGEMENT_SERVICE,
|
||||
+ QStringLiteral("/org/kde/Solid/PowerManagement/PolicyAgent"),
|
||||
+ QStringLiteral("org.kde.Solid.PowerManagement.PolicyAgent"),
|
||||
+ QStringLiteral("TemporarilyBlockedInhibitionsChanged"),
|
||||
+ this,
|
||||
+ SLOT(onTemporarilyBlockedInhibitionsChanged(QList<InhibitionInfo>, QList<InhibitionInfo>)));
|
||||
+
|
||||
+ m_inhibitions = QList<QVariantMap>();
|
||||
+ m_blockedInhibitions = QList<QVariantMap>();
|
||||
+ m_hasInhibition = false;
|
||||
+ m_isManuallyInhibited = false;
|
||||
+ m_isManuallyInhibitedError = false;
|
||||
+ m_isLidPresent = false;
|
||||
+ m_triggersLidAction = false;
|
||||
+ }
|
||||
}
|
||||
|
||||
void PowerManagementControl::inhibit(const QString &reason)
|
||||
diff --git a/applets/batterymonitor/plugin/powermanagementcontrol.h b/applets/batterymonitor/plugin/powermanagementcontrol.h
|
||||
index 1057a5569..467993660 100644
|
||||
--- a/applets/batterymonitor/plugin/powermanagementcontrol.h
|
||||
+++ b/applets/batterymonitor/plugin/powermanagementcontrol.h
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
+#include "applicationdata_p.h"
|
||||
+
|
||||
#include <QHash>
|
||||
#include <QIcon>
|
||||
#include <QObject>
|
||||
@@ -16,10 +18,12 @@
|
||||
#include <qqmlregistration.h>
|
||||
#include <qtmetamacros.h>
|
||||
|
||||
-#include "applicationdata_p.h"
|
||||
+#include <memory>
|
||||
|
||||
using InhibitionInfo = QPair<QString, QString>;
|
||||
|
||||
+class QDBusServiceWatcher;
|
||||
+
|
||||
class PowerManagementControl : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -53,6 +57,8 @@ Q_SIGNALS:
|
||||
void isManuallyInhibitedErrorChanged(bool status);
|
||||
|
||||
private Q_SLOTS:
|
||||
+ void onServiceRegistered(const QString &serviceName);
|
||||
+ void onServiceUnregistered(const QString &serviceName);
|
||||
void onInhibitionsChanged(const QList<InhibitionInfo> &added, const QStringList &removed);
|
||||
void onPermanentlyBlockedInhibitionsChanged(const QList<InhibitionInfo> &added, const QList<InhibitionInfo> &removed);
|
||||
void onTemporarilyBlockedInhibitionsChanged(const QList<InhibitionInfo> &added, const QList<InhibitionInfo> &removed);
|
||||
@@ -79,7 +85,7 @@ private:
|
||||
|
||||
Q_OBJECT_BINDABLE_PROPERTY(PowerManagementControl, QList<QVariantMap>, m_inhibitions, &PowerManagementControl::inhibitionsChanged)
|
||||
Q_OBJECT_BINDABLE_PROPERTY(PowerManagementControl, QList<QVariantMap>, m_blockedInhibitions, &PowerManagementControl::blockedInhibitionsChanged)
|
||||
- Q_OBJECT_BINDABLE_PROPERTY(PowerManagementControl, bool, m_hasInhibition, &PowerManagementControl::hasInhibitionChanged)
|
||||
+ Q_OBJECT_BINDABLE_PROPERTY_WITH_ARGS(PowerManagementControl, bool, m_hasInhibition, false, &PowerManagementControl::hasInhibitionChanged)
|
||||
Q_OBJECT_BINDABLE_PROPERTY_WITH_ARGS(PowerManagementControl, bool, m_isLidPresent, false, &PowerManagementControl::isLidPresentChanged)
|
||||
Q_OBJECT_BINDABLE_PROPERTY_WITH_ARGS(PowerManagementControl, bool, m_triggersLidAction, false, &PowerManagementControl::triggersLidActionChanged)
|
||||
Q_OBJECT_BINDABLE_PROPERTY_WITH_ARGS(PowerManagementControl, bool, m_isManuallyInhibited, false, &PowerManagementControl::isManuallyInhibitedChanged)
|
||||
@@ -89,6 +95,8 @@ private:
|
||||
false,
|
||||
&PowerManagementControl::isManuallyInhibitedErrorChanged)
|
||||
|
||||
+ std::unique_ptr<QDBusServiceWatcher> m_solidWatcher;
|
||||
+ std::unique_ptr<QDBusServiceWatcher> m_fdoWatcher;
|
||||
bool m_isSilent = false;
|
||||
|
||||
ApplicationData m_data;
|
||||
diff --git a/applets/batterymonitor/plugin/powerprofilescontrol.cpp b/applets/batterymonitor/plugin/powerprofilescontrol.cpp
|
||||
index 2c5670b1b..d059095a3 100644
|
||||
--- a/applets/batterymonitor/plugin/powerprofilescontrol.cpp
|
||||
+++ b/applets/batterymonitor/plugin/powerprofilescontrol.cpp
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <QDBusMetaType>
|
||||
#include <QDBusPendingCallWatcher>
|
||||
#include <QDBusReply>
|
||||
+#include <QDBusServiceWatcher>
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QIcon>
|
||||
@@ -25,11 +26,31 @@ static constexpr QLatin1StringView SOLID_POWERMANAGEMENT_SERVICE("org.kde.Solid.
|
||||
|
||||
PowerProfilesControl::PowerProfilesControl(QObject *parent)
|
||||
: QObject(parent)
|
||||
+ , m_solidWatcher(new QDBusServiceWatcher)
|
||||
{
|
||||
qDBusRegisterMetaType<QList<QVariantMap>>();
|
||||
qDBusRegisterMetaType<QVariantMap>();
|
||||
|
||||
+ // Watch for PowerDevil's power management service
|
||||
+ m_solidWatcher->setConnection(QDBusConnection::sessionBus());
|
||||
+ m_solidWatcher->setWatchMode(QDBusServiceWatcher::WatchForRegistration | QDBusServiceWatcher::WatchForUnregistration);
|
||||
+ m_solidWatcher->addWatchedService(SOLID_POWERMANAGEMENT_SERVICE);
|
||||
+
|
||||
+ connect(m_solidWatcher.get(), &QDBusServiceWatcher::serviceRegistered, this, &PowerProfilesControl::onServiceRegistered);
|
||||
+ connect(m_solidWatcher.get(), &QDBusServiceWatcher::serviceUnregistered, this, &PowerProfilesControl::onServiceUnregistered);
|
||||
+ // If it's up and running already, let's cache it
|
||||
if (QDBusConnection::sessionBus().interface()->isServiceRegistered(SOLID_POWERMANAGEMENT_SERVICE)) {
|
||||
+ onServiceRegistered(SOLID_POWERMANAGEMENT_SERVICE);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+PowerProfilesControl::~PowerProfilesControl()
|
||||
+{
|
||||
+}
|
||||
+
|
||||
+void PowerProfilesControl::onServiceRegistered(const QString &serviceName)
|
||||
+{
|
||||
+ if (serviceName == SOLID_POWERMANAGEMENT_SERVICE) {
|
||||
if (QDBusConnection::systemBus().interface()->isServiceRegistered(QStringLiteral("org.freedesktop.UPower.PowerProfiles"))) {
|
||||
QDBusMessage profileChoices = QDBusMessage::createMethodCall(QStringLiteral("org.kde.Solid.PowerManagement"),
|
||||
QStringLiteral("/org/kde/Solid/PowerManagement/Actions/PowerProfile"),
|
||||
@@ -181,6 +202,7 @@ PowerProfilesControl::PowerProfilesControl(QObject *parent)
|
||||
SLOT(updatePowerProfileHolds(QList<QVariantMap>)))) {
|
||||
qCDebug(APPLETS::BATTERYMONITOR) << "error connecting to profile hold changes via dbus";
|
||||
}
|
||||
+ m_isTlpInstalled = false;
|
||||
m_isPowerProfileDaemonInstalled = true;
|
||||
} else {
|
||||
m_isTlpInstalled = !QStandardPaths::findExecutable(QStringLiteral("tlp")).isEmpty();
|
||||
@@ -188,8 +210,62 @@ PowerProfilesControl::PowerProfilesControl(QObject *parent)
|
||||
}
|
||||
}
|
||||
|
||||
-PowerProfilesControl::~PowerProfilesControl()
|
||||
+void PowerProfilesControl::onServiceUnregistered(const QString &serviceName)
|
||||
{
|
||||
+ if (serviceName == SOLID_POWERMANAGEMENT_SERVICE) {
|
||||
+ m_isPowerProfileDaemonInstalled = false;
|
||||
+ // leave m_isTlpInstalled as is, it's not going to change just because PowerDevil disappeared
|
||||
+
|
||||
+ QDBusConnection::sessionBus().disconnect(SOLID_POWERMANAGEMENT_SERVICE,
|
||||
+ QStringLiteral("/org/kde/Solid/PowerManagement/Actions/PowerProfile"),
|
||||
+ QStringLiteral("org.kde.Solid.PowerManagement.Actions.PowerProfile"),
|
||||
+ QStringLiteral("configuredProfileChanged"),
|
||||
+ this,
|
||||
+ SLOT(updatePowerProfileConfiguredProfile(QString)));
|
||||
+
|
||||
+ QDBusConnection::sessionBus().disconnect(SOLID_POWERMANAGEMENT_SERVICE,
|
||||
+ QStringLiteral("/org/kde/Solid/PowerManagement/Actions/PowerProfile"),
|
||||
+ QStringLiteral("org.kde.Solid.PowerManagement.Actions.PowerProfile"),
|
||||
+ QStringLiteral("currentProfileChanged"),
|
||||
+ this,
|
||||
+ SLOT(updatePowerProfileCurrentProfile(QString)));
|
||||
+
|
||||
+ QDBusConnection::sessionBus().disconnect(SOLID_POWERMANAGEMENT_SERVICE,
|
||||
+ QStringLiteral("/org/kde/Solid/PowerManagement/Actions/PowerProfile"),
|
||||
+ QStringLiteral("org.kde.Solid.PowerManagement.Actions.PowerProfile"),
|
||||
+ QStringLiteral("profileChoicesChanged"),
|
||||
+ this,
|
||||
+ SLOT(updatePowerProfileChoices(QStringList)));
|
||||
+
|
||||
+ QDBusConnection::sessionBus().disconnect(SOLID_POWERMANAGEMENT_SERVICE,
|
||||
+ QStringLiteral("/org/kde/Solid/PowerManagement/Actions/PowerProfile"),
|
||||
+ QStringLiteral("org.kde.Solid.PowerManagement.Actions.PowerProfile"),
|
||||
+ QStringLiteral("performanceInhibitedReasonChanged"),
|
||||
+ this,
|
||||
+ SLOT(updatePowerProfilePerformanceInhibitedReason(QString)));
|
||||
+
|
||||
+ QDBusConnection::sessionBus().disconnect(SOLID_POWERMANAGEMENT_SERVICE,
|
||||
+ QStringLiteral("/org/kde/Solid/PowerManagement/Actions/PowerProfile"),
|
||||
+ QStringLiteral("org.kde.Solid.PowerManagement.Actions.PowerProfile"),
|
||||
+ QStringLiteral("performanceDegradedReasonChanged"),
|
||||
+ this,
|
||||
+ SLOT(updatePowerProfilePerformanceDegradedReason(QString)));
|
||||
+
|
||||
+ QDBusConnection::sessionBus().disconnect(SOLID_POWERMANAGEMENT_SERVICE,
|
||||
+ QStringLiteral("/org/kde/Solid/PowerManagement/Actions/PowerProfile"),
|
||||
+ QStringLiteral("org.kde.Solid.PowerManagement.Actions.PowerProfile"),
|
||||
+ QStringLiteral("profileHoldsChanged"),
|
||||
+ this,
|
||||
+ SLOT(updatePowerProfileHolds(QList<QVariantMap>)));
|
||||
+
|
||||
+ updatePowerProfileHolds({});
|
||||
+ updatePowerProfilePerformanceDegradedReason(QString());
|
||||
+ updatePowerProfilePerformanceInhibitedReason(QString());
|
||||
+ updatePowerProfileChoices({});
|
||||
+ updatePowerProfileCurrentProfile(QString());
|
||||
+ updatePowerProfileConfiguredProfile(QString());
|
||||
+ m_profileError = QString();
|
||||
+ }
|
||||
}
|
||||
|
||||
bool PowerProfilesControl::isTlpInstalled() const
|
||||
diff --git a/applets/batterymonitor/plugin/powerprofilescontrol.h b/applets/batterymonitor/plugin/powerprofilescontrol.h
|
||||
index f54c9e813..dc2fd58a2 100644
|
||||
--- a/applets/batterymonitor/plugin/powerprofilescontrol.h
|
||||
+++ b/applets/batterymonitor/plugin/powerprofilescontrol.h
|
||||
@@ -6,13 +6,17 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
+#include "applicationdata_p.h"
|
||||
+
|
||||
#include <QDBusPendingCall>
|
||||
#include <QObject>
|
||||
#include <QObjectBindableProperty>
|
||||
#include <QStringList>
|
||||
#include <qqmlregistration.h>
|
||||
|
||||
-#include "applicationdata_p.h"
|
||||
+#include <memory>
|
||||
+
|
||||
+class QDBusServiceWatcher;
|
||||
|
||||
class PowerProfilesControl : public QObject
|
||||
{
|
||||
@@ -52,6 +56,9 @@ private:
|
||||
QBindable<QList<QVariantMap>> bindableProfileHolds();
|
||||
|
||||
private Q_SLOTS:
|
||||
+ void onServiceRegistered(const QString &serviceName);
|
||||
+ void onServiceUnregistered(const QString &serviceName);
|
||||
+
|
||||
void updatePowerProfileChoices(const QStringList &choices);
|
||||
void updatePowerProfileConfiguredProfile(const QString &profile);
|
||||
void updatePowerProfileCurrentProfile(const QString &profile);
|
||||
@@ -83,6 +90,8 @@ private:
|
||||
Q_OBJECT_BINDABLE_PROPERTY(PowerProfilesControl, QString, m_degradationReason, &PowerProfilesControl::degradationReasonChanged)
|
||||
Q_OBJECT_BINDABLE_PROPERTY(PowerProfilesControl, QList<QVariantMap>, m_profileHolds, &PowerProfilesControl::profileHoldsChanged)
|
||||
|
||||
+ std::unique_ptr<QDBusServiceWatcher> m_solidWatcher;
|
||||
+
|
||||
bool m_isSilent = false;
|
||||
bool m_isTlpInstalled = false;
|
||||
|
||||
--
|
||||
GitLab
|
||||
|
@ -31,43 +31,43 @@ inputs:
|
||||
# color management
|
||||
argyllcms xcalib
|
||||
# networking
|
||||
remmina putty mtr-gui
|
||||
remmina # putty mtr-gui
|
||||
# media
|
||||
mpv nomacs spotify yesplaymusic simplescreenrecorder imagemagick gimp netease-cloud-music-gtk vlc obs-studio
|
||||
waifu2x-converter-cpp inkscape blender whalebird paraview
|
||||
mpv nomacs yesplaymusic simplescreenrecorder imagemagick gimp netease-cloud-music-gtk
|
||||
waifu2x-converter-cpp inkscape blender paraview vlc whalebird # spotify obs-studio
|
||||
# themes
|
||||
catppuccin catppuccin-sddm catppuccin-cursors catppuccinifier-gui catppuccinifier-cli catppuccin-plymouth
|
||||
(catppuccin-kde.override { flavour = [ "latte" ]; }) (catppuccin-kvantum.override { variant = "latte"; })
|
||||
klassy
|
||||
localPackages.slate localPackages.blurred-wallpaper tela-circle-icon-theme
|
||||
klassy localPackages.slate localPackages.blurred-wallpaper tela-circle-icon-theme
|
||||
# catppuccin catppuccin-sddm catppuccin-cursors catppuccinifier-gui catppuccinifier-cli catppuccin-plymouth
|
||||
# (catppuccin-kde.override { flavour = [ "latte" ]; }) (catppuccin-kvantum.override { variant = "latte"; })
|
||||
# terminal
|
||||
warp-terminal
|
||||
# warp-terminal
|
||||
# development
|
||||
adb-sync scrcpy weston cage openbox krita jetbrains.clion android-studio dbeaver-bin cling fprettify
|
||||
aircrack-ng
|
||||
adb-sync scrcpy dbeaver-bin cling aircrack-ng
|
||||
# weston cage openbox krita jetbrains.clion android-studio fprettify
|
||||
# desktop sharing
|
||||
rustdesk-flutter
|
||||
# rustdesk-flutter
|
||||
# password and key management
|
||||
yubikey-manager yubikey-manager-qt yubikey-personalization yubikey-personalization-gui bitwarden electrum
|
||||
jabref
|
||||
john crunch hashcat
|
||||
yubikey-manager yubikey-manager-qt yubikey-personalization yubikey-personalization-gui bitwarden hashcat
|
||||
# electrum jabref john crunch
|
||||
# download
|
||||
qbittorrent nur-xddxdd.baidupcs-go wgetpaste onedrive onedrivegui rclone
|
||||
qbittorrent # nur-xddxdd.baidupcs-go wgetpaste onedrive onedrivegui rclone
|
||||
# editor
|
||||
typora appflowy notion-app-enhanced joplin-desktop standardnotes logseq
|
||||
typora # appflowy notion-app-enhanced joplin-desktop standardnotes logseq
|
||||
# news
|
||||
fluent-reader rssguard newsflash newsboat
|
||||
# fluent-reader rssguard newsflash newsboat
|
||||
# nix tools
|
||||
nixpkgs-fmt appimage-run nixd nix-serve node2nix nix-prefetch-github prefetch-npm-deps nix-prefetch-docker
|
||||
nix-template nil pnpm-lock-export bundix
|
||||
# instant messager
|
||||
element-desktop telegram-desktop discord fluffychat zoom-us signal-desktop slack nur-linyinfeng.wemeet
|
||||
nheko # qq nur-xddxdd.wechat-uos TODO: cinny-desktop
|
||||
element-desktop telegram-desktop discord zoom-us slack nur-linyinfeng.wemeet nheko
|
||||
# fluffychat signal-desktop qq nur-xddxdd.wechat-uos cinny-desktop
|
||||
# browser
|
||||
google-chrome tor-browser microsoft-edge
|
||||
google-chrome tor-browser # microsoft-edge
|
||||
# office
|
||||
crow-translate zotero pandoc ydict libreoffice-qt texstudio poppler_utils pdftk pdfchain hdfview
|
||||
davinci-resolve texliveFull
|
||||
crow-translate zotero pandoc libreoffice-qt texliveFull poppler_utils pdftk pdfchain davinci-resolve
|
||||
# TODO: enable in next release
|
||||
# hdfview
|
||||
# ydict texstudio
|
||||
# matplot++ needs old gnuplot
|
||||
inputs.pkgs."pkgs-23.11".gnuplot
|
||||
# math, physics and chemistry
|
||||
@ -75,7 +75,7 @@ inputs:
|
||||
(mathematica.overrideAttrs (prev: { postInstall = (prev.postInstall or "") + "ln -s ${prev.src} $out/src"; }))
|
||||
(quantum-espresso.override { stdenv = gcc14Stdenv; gfortran = gfortran14; }) jmol mpi localPackages.ufo
|
||||
# virtualization
|
||||
wineWowPackages.stagingFull virt-viewer bottles genymotion playonlinux
|
||||
virt-viewer bottles # wineWowPackages.stagingFull genymotion playonlinux
|
||||
# media
|
||||
nur-xddxdd.svp
|
||||
# for kdenlive auto subtitle
|
||||
|
@ -10,15 +10,12 @@ inputs:
|
||||
nixos.packages.packages._packages =
|
||||
let cuda = let inherit (inputs.config.nixos.system.nixpkgs) cuda; in cuda.enable && cuda.capabilities != null;
|
||||
in
|
||||
if cuda then [((inputs.pkgs.lammps-mpi.override { stdenv = inputs.pkgs.cudaPackages.backendStdenv; })
|
||||
if cuda then [((inputs.pkgs.lammps.override { stdenv = inputs.pkgs.cudaPackages.backendStdenv; })
|
||||
.overrideAttrs (prev:
|
||||
{
|
||||
cmakeFlags = prev.cmakeFlags ++ inputs.lib.optionals cuda
|
||||
[
|
||||
"-DPKG_GPU=on" "-DGPU_API=cuda" "-DCMAKE_POLICY_DEFAULT_CMP0146=OLD"
|
||||
];
|
||||
nativeBuildInputs = prev.nativeBuildInputs ++ inputs.lib.optionals cuda
|
||||
[ inputs.pkgs.cudaPackages.cudatoolkit ];
|
||||
cmakeFlags = prev.cmakeFlags ++ [ "-DPKG_GPU=on" "-DGPU_API=cuda" "-DCMAKE_POLICY_DEFAULT_CMP0146=OLD" ];
|
||||
nativeBuildInputs = prev.nativeBuildInputs ++ [ inputs.pkgs.cudaPackages.cudatoolkit ];
|
||||
buildInputs = prev.buildInputs ++ [ inputs.pkgs.mpi ];
|
||||
}))]
|
||||
else [ inputs.pkgs.lammps-mpi ];
|
||||
};
|
||||
|
@ -32,13 +32,13 @@ inputs:
|
||||
# networking
|
||||
ipset iptables iproute2 dig nettools traceroute tcping-go whois tcpdump nmap inetutils wireguard-tools
|
||||
# nix tools
|
||||
nix-output-monitor nix-tree ssh-to-age (callPackage "${inputs.topInputs.nix-fast-build}" {}) nix-inspect
|
||||
nix-output-monitor nix-tree ssh-to-age nix-inspect # (callPackage "${inputs.topInputs.nix-fast-build}" {})
|
||||
# development
|
||||
gdb try inputs.topInputs.plasma-manager.packages.${inputs.pkgs.system}.rc2nix rr hexo-cli gh nix-init hugo
|
||||
# stupid things
|
||||
toilet lolcat
|
||||
# office
|
||||
todo-txt-cli pdfgrep ffmpeg-full
|
||||
pdfgrep ffmpeg-full # todo-txt-cli
|
||||
]
|
||||
++ (with inputs.config.boot.kernelPackages; [ cpupower usbip ])
|
||||
++ (inputs.lib.optional (inputs.config.nixos.system.nixpkgs.arch == "x86_64") rar);
|
||||
|
@ -33,18 +33,7 @@ inputs:
|
||||
enable = true;
|
||||
# TCP 139 445 UDP 137 138
|
||||
openFirewall = !samba.private;
|
||||
securityType = "user";
|
||||
extraConfig =
|
||||
''
|
||||
workgroup = WORKGROUP
|
||||
server string = Samba Server
|
||||
server role = standalone server
|
||||
hosts allow = ${samba.hostsAllowed}
|
||||
dns proxy = no
|
||||
'';
|
||||
# obey pam restrictions = yes
|
||||
# encrypt passwords = no
|
||||
shares = listToAttrs (map
|
||||
settings = listToAttrs (map
|
||||
(share:
|
||||
{
|
||||
name = share.name;
|
||||
@ -60,7 +49,8 @@ inputs:
|
||||
"force directory mode" = "2755";
|
||||
};
|
||||
})
|
||||
(attrsToList samba.shares));
|
||||
(attrsToList samba.shares))
|
||||
// { global."hosts allow" = "${samba.hostsAllowed}"; };
|
||||
};
|
||||
};
|
||||
nixos.services.xray.client.v2ray-forwarder =
|
||||
|
@ -56,8 +56,6 @@ inputs:
|
||||
{
|
||||
enable = true;
|
||||
settingsFile = inputs.config.sops.templates."xray-client.json".path;
|
||||
package = inputs.pkgs.xray.overrideAttrs
|
||||
(prev: { patches = prev.patches or [] ++ [ ./disable-splice.patch ];});
|
||||
};
|
||||
dnsmasq =
|
||||
{
|
||||
@ -347,8 +345,6 @@ inputs:
|
||||
{
|
||||
enable = true;
|
||||
settingsFile = inputs.config.sops.templates."xray-server.json".path;
|
||||
package = inputs.pkgs.xray.overrideAttrs
|
||||
(prev: { patches = prev.patches or [] ++ [ ./disable-splice.patch ];});
|
||||
};
|
||||
sops =
|
||||
{
|
@ -1,14 +0,0 @@
|
||||
diff --git a/proxy/proxy.go b/proxy/proxy.go
|
||||
index db92051..54d36b4 100644
|
||||
--- a/proxy/proxy.go
|
||||
+++ b/proxy/proxy.go
|
||||
@@ -504,7 +504,8 @@ func CopyRawConnIfExist(ctx context.Context, readerConn net.Conn, writerConn net
|
||||
splice = false
|
||||
}
|
||||
}
|
||||
- if splice {
|
||||
+ _ = splice
|
||||
+ if false {
|
||||
newError("CopyRawConn splice").WriteToLog(session.ExportIDToError(ctx))
|
||||
statWriter, _ := writer.(*dispatcher.SizeStatWriter)
|
||||
//runtime.Gosched() // necessary
|
@ -1,47 +0,0 @@
|
||||
From 123c4d46272b7e72d7db3fe8b4131a8cc99613fb Mon Sep 17 00:00:00 2001
|
||||
From: Alex Deucher <alexander.deucher@amd.com>
|
||||
Date: Wed, 14 Aug 2024 10:28:24 -0400
|
||||
Subject: [PATCH] drm/amdgpu/sdma5.2: limit wptr workaround to sdma 5.2.1
|
||||
|
||||
The workaround seems to cause stability issues on other
|
||||
SDMA 5.2.x IPs.
|
||||
|
||||
Fixes: a03ebf116303 ("drm/amdgpu/sdma5.2: Update wptr registers as well as doorbell")
|
||||
Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3556
|
||||
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
|
||||
---
|
||||
drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c | 18 ++++++++++--------
|
||||
1 file changed, 10 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c b/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c
|
||||
index d740255edf5a..bc9b240a3488 100644
|
||||
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c
|
||||
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c
|
||||
@@ -225,14 +225,16 @@ static void sdma_v5_2_ring_set_wptr(struct amdgpu_ring *ring)
|
||||
DRM_DEBUG("calling WDOORBELL64(0x%08x, 0x%016llx)\n",
|
||||
ring->doorbell_index, ring->wptr << 2);
|
||||
WDOORBELL64(ring->doorbell_index, ring->wptr << 2);
|
||||
- /* SDMA seems to miss doorbells sometimes when powergating kicks in.
|
||||
- * Updating the wptr directly will wake it. This is only safe because
|
||||
- * we disallow gfxoff in begin_use() and then allow it again in end_use().
|
||||
- */
|
||||
- WREG32(sdma_v5_2_get_reg_offset(adev, ring->me, mmSDMA0_GFX_RB_WPTR),
|
||||
- lower_32_bits(ring->wptr << 2));
|
||||
- WREG32(sdma_v5_2_get_reg_offset(adev, ring->me, mmSDMA0_GFX_RB_WPTR_HI),
|
||||
- upper_32_bits(ring->wptr << 2));
|
||||
+ if (amdgpu_ip_version(adev, SDMA0_HWIP, 0) == IP_VERSION(5, 2, 1)) {
|
||||
+ /* SDMA seems to miss doorbells sometimes when powergating kicks in.
|
||||
+ * Updating the wptr directly will wake it. This is only safe because
|
||||
+ * we disallow gfxoff in begin_use() and then allow it again in end_use().
|
||||
+ */
|
||||
+ WREG32(sdma_v5_2_get_reg_offset(adev, ring->me, mmSDMA0_GFX_RB_WPTR),
|
||||
+ lower_32_bits(ring->wptr << 2));
|
||||
+ WREG32(sdma_v5_2_get_reg_offset(adev, ring->me, mmSDMA0_GFX_RB_WPTR_HI),
|
||||
+ upper_32_bits(ring->wptr << 2));
|
||||
+ }
|
||||
} else {
|
||||
DRM_DEBUG("Not using doorbell -- "
|
||||
"mmSDMA%i_GFX_RB_WPTR == 0x%08x "
|
||||
--
|
||||
2.46.0
|
||||
|
@ -1,141 +0,0 @@
|
||||
From ae1e766f623f7a2a889a0b09eb076dd9a60efbe9 Mon Sep 17 00:00:00 2001
|
||||
From: Filipe Manana <fdmanana@suse.com>
|
||||
Date: Sun, 11 Aug 2024 11:53:42 +0100
|
||||
Subject: btrfs: only run the extent map shrinker from kswapd tasks
|
||||
|
||||
Currently the extent map shrinker can be run by any task when attempting
|
||||
to allocate memory and there's enough memory pressure to trigger it.
|
||||
|
||||
To avoid too much latency we stop iterating over extent maps and removing
|
||||
them once the task needs to reschedule. This logic was introduced in commit
|
||||
b3ebb9b7e92a ("btrfs: stop extent map shrinker if reschedule is needed").
|
||||
|
||||
While that solved high latency problems for some use cases, it's still
|
||||
not enough because with a too high number of tasks entering the extent map
|
||||
shrinker code, either due to memory allocations or because they are a
|
||||
kswapd task, we end up having a very high level of contention on some
|
||||
spin locks, namely:
|
||||
|
||||
1) The fs_info->fs_roots_radix_lock spin lock, which we need to find
|
||||
roots to iterate over their inodes;
|
||||
|
||||
2) The spin lock of the xarray used to track open inodes for a root
|
||||
(struct btrfs_root::inodes) - on 6.10 kernels and below, it used to
|
||||
be a red black tree and the spin lock was root->inode_lock;
|
||||
|
||||
3) The fs_info->delayed_iput_lock spin lock since the shrinker adds
|
||||
delayed iputs (calls btrfs_add_delayed_iput()).
|
||||
|
||||
Instead of allowing the extent map shrinker to be run by any task, make
|
||||
it run only by kswapd tasks. This still solves the problem of running
|
||||
into OOM situations due to an unbounded extent map creation, which is
|
||||
simple to trigger by direct IO writes, as described in the changelog
|
||||
of commit 956a17d9d050 ("btrfs: add a shrinker for extent maps"), and
|
||||
by a similar case when doing buffered IO on files with a very large
|
||||
number of holes (keeping the file open and creating many holes, whose
|
||||
extent maps are only released when the file is closed).
|
||||
|
||||
Reported-by: kzd <kzd@56709.net>
|
||||
Link: https://bugzilla.kernel.org/show_bug.cgi?id=219121
|
||||
Reported-by: Octavia Togami <octavia.togami@gmail.com>
|
||||
Link: https://lore.kernel.org/linux-btrfs/CAHPNGSSt-a4ZZWrtJdVyYnJFscFjP9S7rMcvEMaNSpR556DdLA@mail.gmail.com/
|
||||
Fixes: 956a17d9d050 ("btrfs: add a shrinker for extent maps")
|
||||
CC: stable@vger.kernel.org # 6.10+
|
||||
Tested-by: kzd <kzd@56709.net>
|
||||
Tested-by: Octavia Togami <octavia.togami@gmail.com>
|
||||
Signed-off-by: Filipe Manana <fdmanana@suse.com>
|
||||
Reviewed-by: David Sterba <dsterba@suse.com>
|
||||
Signed-off-by: David Sterba <dsterba@suse.com>
|
||||
---
|
||||
fs/btrfs/extent_map.c | 22 ++++++----------------
|
||||
fs/btrfs/super.c | 10 ++++++++++
|
||||
2 files changed, 16 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c
|
||||
index 23b65dc73c0048..10ac5f657e3889 100644
|
||||
--- a/fs/btrfs/extent_map.c
|
||||
+++ b/fs/btrfs/extent_map.c
|
||||
@@ -1147,8 +1147,7 @@ static long btrfs_scan_inode(struct btrfs_inode *inode, struct btrfs_em_shrink_c
|
||||
return 0;
|
||||
|
||||
/*
|
||||
- * We want to be fast because we can be called from any path trying to
|
||||
- * allocate memory, so if the lock is busy we don't want to spend time
|
||||
+ * We want to be fast so if the lock is busy we don't want to spend time
|
||||
* waiting for it - either some task is about to do IO for the inode or
|
||||
* we may have another task shrinking extent maps, here in this code, so
|
||||
* skip this inode.
|
||||
@@ -1191,9 +1190,7 @@ next:
|
||||
/*
|
||||
* Stop if we need to reschedule or there's contention on the
|
||||
* lock. This is to avoid slowing other tasks trying to take the
|
||||
- * lock and because the shrinker might be called during a memory
|
||||
- * allocation path and we want to avoid taking a very long time
|
||||
- * and slowing down all sorts of tasks.
|
||||
+ * lock.
|
||||
*/
|
||||
if (need_resched() || rwlock_needbreak(&tree->lock))
|
||||
break;
|
||||
@@ -1222,12 +1219,7 @@ static long btrfs_scan_root(struct btrfs_root *root, struct btrfs_em_shrink_ctx
|
||||
if (ctx->scanned >= ctx->nr_to_scan)
|
||||
break;
|
||||
|
||||
- /*
|
||||
- * We may be called from memory allocation paths, so we don't
|
||||
- * want to take too much time and slowdown tasks.
|
||||
- */
|
||||
- if (need_resched())
|
||||
- break;
|
||||
+ cond_resched();
|
||||
|
||||
inode = btrfs_find_first_inode(root, min_ino);
|
||||
}
|
||||
@@ -1285,14 +1277,12 @@ long btrfs_free_extent_maps(struct btrfs_fs_info *fs_info, long nr_to_scan)
|
||||
ctx.last_ino);
|
||||
}
|
||||
|
||||
- /*
|
||||
- * We may be called from memory allocation paths, so we don't want to
|
||||
- * take too much time and slowdown tasks, so stop if we need reschedule.
|
||||
- */
|
||||
- while (ctx.scanned < ctx.nr_to_scan && !need_resched()) {
|
||||
+ while (ctx.scanned < ctx.nr_to_scan) {
|
||||
struct btrfs_root *root;
|
||||
unsigned long count;
|
||||
|
||||
+ cond_resched();
|
||||
+
|
||||
spin_lock(&fs_info->fs_roots_radix_lock);
|
||||
count = radix_tree_gang_lookup(&fs_info->fs_roots_radix,
|
||||
(void **)&root,
|
||||
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
|
||||
index 83478deada3bd2..11044e9e2cb110 100644
|
||||
--- a/fs/btrfs/super.c
|
||||
+++ b/fs/btrfs/super.c
|
||||
@@ -28,6 +28,7 @@
|
||||
#include <linux/btrfs.h>
|
||||
#include <linux/security.h>
|
||||
#include <linux/fs_parser.h>
|
||||
+#include <linux/swap.h>
|
||||
#include "messages.h"
|
||||
#include "delayed-inode.h"
|
||||
#include "ctree.h"
|
||||
@@ -2409,6 +2410,15 @@ static long btrfs_free_cached_objects(struct super_block *sb, struct shrink_cont
|
||||
const long nr_to_scan = min_t(unsigned long, LONG_MAX, sc->nr_to_scan);
|
||||
struct btrfs_fs_info *fs_info = btrfs_sb(sb);
|
||||
|
||||
+ /*
|
||||
+ * We may be called from any task trying to allocate memory and we don't
|
||||
+ * want to slow it down with scanning and dropping extent maps. It would
|
||||
+ * also cause heavy lock contention if many tasks concurrently enter
|
||||
+ * here. Therefore only allow kswapd tasks to scan and drop extent maps.
|
||||
+ */
|
||||
+ if (!current_is_kswapd())
|
||||
+ return 0;
|
||||
+
|
||||
return btrfs_free_extent_maps(fs_info, nr_to_scan);
|
||||
}
|
||||
|
||||
--
|
||||
cgit 1.2.3-korg
|
||||
|
@ -134,21 +134,8 @@ inputs:
|
||||
let version = inputs.lib.versions.majorMinor inputs.config.boot.kernelPackages.kernel.version;
|
||||
in ./hibernate-progress-${version}.patch;
|
||||
}];
|
||||
# TODO: remove in 6.11
|
||||
btrfs =
|
||||
[{
|
||||
name = "btrfs";
|
||||
patch =
|
||||
let version = inputs.lib.versions.majorMinor inputs.config.boot.kernelPackages.kernel.version;
|
||||
in if version == "6.10" then ./btrfs.patch else null;
|
||||
}];
|
||||
amdgpu =
|
||||
[{
|
||||
name = "amdgpu";
|
||||
patch = ./0001-drm-amdgpu-sdma5.2-limit-wptr-workaround-to-sdma-5.2.patch;
|
||||
}];
|
||||
};
|
||||
in builtins.concatLists (builtins.map (name: patches.${name}) (kernel.patches ++ [ "btrfs" ]));
|
||||
in builtins.concatLists (builtins.map (name: patches.${name}) kernel.patches);
|
||||
};
|
||||
}
|
||||
(
|
||||
|
128
modules/system/kernel/hibernate-progress-6.11.patch
Normal file
128
modules/system/kernel/hibernate-progress-6.11.patch
Normal file
@ -0,0 +1,128 @@
|
||||
diff --git a/kernel/power/swap.c b/kernel/power/swap.c
|
||||
index 5bc04bfe2db1..6e7b17b97de7 100644
|
||||
--- a/kernel/power/swap.c
|
||||
+++ b/kernel/power/swap.c
|
||||
@@ -563,7 +563,7 @@ static int save_image(struct swap_map_handle *handle,
|
||||
|
||||
hib_init_batch(&hb);
|
||||
|
||||
- pr_info("Saving image data pages (%u pages)...\n",
|
||||
+ pr_err("Saving image data pages (%u pages)...\n",
|
||||
nr_to_write);
|
||||
m = nr_to_write / 10;
|
||||
if (!m)
|
||||
@@ -578,7 +578,7 @@ static int save_image(struct swap_map_handle *handle,
|
||||
if (ret)
|
||||
break;
|
||||
if (!(nr_pages % m))
|
||||
- pr_info("Image saving progress: %3d%%\n",
|
||||
+ pr_err("Image saving progress: %3d%%\n",
|
||||
nr_pages / m * 10);
|
||||
nr_pages++;
|
||||
}
|
||||
@@ -588,7 +588,7 @@ static int save_image(struct swap_map_handle *handle,
|
||||
if (!ret)
|
||||
ret = err2;
|
||||
if (!ret)
|
||||
- pr_info("Image saving done\n");
|
||||
+ pr_err("Image saving done\n");
|
||||
swsusp_show_speed(start, stop, nr_to_write, "Wrote");
|
||||
return ret;
|
||||
}
|
||||
@@ -795,8 +795,8 @@ static int save_compressed_image(struct swap_map_handle *handle,
|
||||
*/
|
||||
handle->reqd_free_pages = reqd_free_pages();
|
||||
|
||||
- pr_info("Using %u thread(s) for %s compression\n", nr_threads, hib_comp_algo);
|
||||
- pr_info("Compressing and saving image data (%u pages)...\n",
|
||||
+ pr_err("Using %u thread(s) for %s compression\n", nr_threads, hib_comp_algo);
|
||||
+ pr_err("Compressing and saving image data (%u pages)...\n",
|
||||
nr_to_write);
|
||||
m = nr_to_write / 10;
|
||||
if (!m)
|
||||
@@ -817,7 +817,7 @@ static int save_compressed_image(struct swap_map_handle *handle,
|
||||
data_of(*snapshot), PAGE_SIZE);
|
||||
|
||||
if (!(nr_pages % m))
|
||||
- pr_info("Image saving progress: %3d%%\n",
|
||||
+ pr_err("Image saving progress: %3d%%\n",
|
||||
nr_pages / m * 10);
|
||||
nr_pages++;
|
||||
}
|
||||
@@ -888,9 +888,9 @@ static int save_compressed_image(struct swap_map_handle *handle,
|
||||
if (!ret)
|
||||
ret = err2;
|
||||
if (!ret)
|
||||
- pr_info("Image saving done\n");
|
||||
+ pr_err("Image saving done\n");
|
||||
swsusp_show_speed(start, stop, nr_to_write, "Wrote");
|
||||
- pr_info("Image size after compression: %d kbytes\n",
|
||||
+ pr_err("Image size after compression: %d kbytes\n",
|
||||
(atomic_read(&compressed_size) / 1024));
|
||||
|
||||
out_clean:
|
||||
@@ -1105,7 +1105,7 @@ static int load_image(struct swap_map_handle *handle,
|
||||
hib_init_batch(&hb);
|
||||
|
||||
clean_pages_on_read = true;
|
||||
- pr_info("Loading image data pages (%u pages)...\n", nr_to_read);
|
||||
+ pr_err("Loading image data pages (%u pages)...\n", nr_to_read);
|
||||
m = nr_to_read / 10;
|
||||
if (!m)
|
||||
m = 1;
|
||||
@@ -1123,7 +1123,7 @@ static int load_image(struct swap_map_handle *handle,
|
||||
if (ret)
|
||||
break;
|
||||
if (!(nr_pages % m))
|
||||
- pr_info("Image loading progress: %3d%%\n",
|
||||
+ pr_err("Image loading progress: %3d%%\n",
|
||||
nr_pages / m * 10);
|
||||
nr_pages++;
|
||||
}
|
||||
@@ -1133,7 +1133,7 @@ static int load_image(struct swap_map_handle *handle,
|
||||
if (!ret)
|
||||
ret = err2;
|
||||
if (!ret) {
|
||||
- pr_info("Image loading done\n");
|
||||
+ pr_err("Image loading done\n");
|
||||
ret = snapshot_write_finalize(snapshot);
|
||||
if (!ret && !snapshot_image_loaded(snapshot))
|
||||
ret = -ENODATA;
|
||||
@@ -1328,8 +1328,8 @@ static int load_compressed_image(struct swap_map_handle *handle,
|
||||
}
|
||||
want = ring_size = i;
|
||||
|
||||
- pr_info("Using %u thread(s) for %s decompression\n", nr_threads, hib_comp_algo);
|
||||
- pr_info("Loading and decompressing image data (%u pages)...\n",
|
||||
+ pr_err("Using %u thread(s) for %s decompression\n", nr_threads, hib_comp_algo);
|
||||
+ pr_err("Loading and decompressing image data (%u pages)...\n",
|
||||
nr_to_read);
|
||||
m = nr_to_read / 10;
|
||||
if (!m)
|
||||
@@ -1459,7 +1459,7 @@ static int load_compressed_image(struct swap_map_handle *handle,
|
||||
data[thr].unc + off, PAGE_SIZE);
|
||||
|
||||
if (!(nr_pages % m))
|
||||
- pr_info("Image loading progress: %3d%%\n",
|
||||
+ pr_err("Image loading progress: %3d%%\n",
|
||||
nr_pages / m * 10);
|
||||
nr_pages++;
|
||||
|
||||
@@ -1485,7 +1485,7 @@ static int load_compressed_image(struct swap_map_handle *handle,
|
||||
}
|
||||
stop = ktime_get();
|
||||
if (!ret) {
|
||||
- pr_info("Image loading done\n");
|
||||
+ pr_err("Image loading done\n");
|
||||
ret = snapshot_write_finalize(snapshot);
|
||||
if (!ret && !snapshot_image_loaded(snapshot))
|
||||
ret = -ENODATA;
|
||||
@@ -1593,7 +1593,7 @@ int swsusp_check(bool exclusive)
|
||||
}
|
||||
if (!error && swsusp_header->flags & SF_HW_SIG &&
|
||||
swsusp_header->hw_sig != swsusp_hardware_signature) {
|
||||
- pr_info("Suspend image hardware signature mismatch (%08x now %08x); aborting resume.\n",
|
||||
+ pr_err("Suspend image hardware signature mismatch (%08x now %08x); aborting resume.\n",
|
||||
swsusp_header->hw_sig, swsusp_hardware_signature);
|
||||
error = -EINVAL;
|
||||
}
|
@ -11,7 +11,6 @@ inputs: rec
|
||||
nodesoup = inputs.pkgs.callPackage ./nodesoup.nix { src = inputs.topInputs.nodesoup; };
|
||||
matplotplusplus = inputs.pkgs.callPackage ./matplotplusplus.nix
|
||||
{
|
||||
inherit glad nodesoup;
|
||||
src = inputs.topInputs.matplotplusplus;
|
||||
stdenv = inputs.pkgs.clang18Stdenv;
|
||||
};
|
||||
@ -99,7 +98,8 @@ inputs: rec
|
||||
chn-bsub = inputs.pkgs.callPackage ./chn-bsub { inherit biu; };
|
||||
winjob = inputs.pkgs.callPackage ./winjob { stdenv = inputs.pkgs.gcc14Stdenv; };
|
||||
sockpp = inputs.pkgs.callPackage ./sockpp.nix { src = inputs.topInputs.sockpp; };
|
||||
git-lfs-transfer = inputs.pkgs.callPackage ./git-lfs-transfer.nix { src = inputs.topInputs.git-lfs-transfer; };
|
||||
git-lfs-transfer = inputs.pkgs.callPackage ./git-lfs-transfer.nix
|
||||
{ src = inputs.topInputs.git-lfs-transfer; hash = inputs.topInputs.self.src.git-lfs-transfer; };
|
||||
py4vasp = inputs.pkgs.callPackage ./py4vasp.nix { src = inputs.topInputs.py4vasp; };
|
||||
pocketfft = inputs.pkgs.callPackage ./pocketfft.nix { src = inputs.topInputs.pocketfft; };
|
||||
spectroscopy = inputs.pkgs.callPackage ./spectroscopy.nix { src = inputs.topInputs.spectroscopy; };
|
||||
|
@ -1,6 +1,6 @@
|
||||
{ buildGoModule, src }: buildGoModule
|
||||
{ buildGoModule, src, hash }: buildGoModule
|
||||
{
|
||||
name = "git-lfs-transfer";
|
||||
inherit src;
|
||||
vendorHash = "sha256-DYupPz6VnFeFWG4helRv5ahbTDQk+6w6alxwNGU9B9Q=";
|
||||
vendorHash = hash;
|
||||
}
|
||||
|
@ -1,18 +1,9 @@
|
||||
{
|
||||
stdenv, src, cmake, pkg-config, substituteAll,
|
||||
gnuplot, libjpeg, libtiff, zlib, libpng, lapack, blas, fftw, opencv, nodesoup, cimg, glfw, libGL, python3, glad
|
||||
stdenv, src, cmake, pkg-config, substituteAll
|
||||
}: stdenv.mkDerivation
|
||||
{
|
||||
name = "matplotplusplus";
|
||||
inherit src;
|
||||
cmakeFlags =
|
||||
[
|
||||
"-DBUILD_SHARED_LIBS=ON" "-DMATPLOTPP_BUILD_SHARED_LIBS=ON" "-DMATPLOTPP_BUILD_EXAMPLES=OFF"
|
||||
"-DMATPLOTPP_WITH_SYSTEM_NODESOUP=ON" "-DMATPLOTPP_WITH_SYSTEM_CIMG=ON"
|
||||
"-DMATPLOTPP_BUILD_EXPERIMENTAL_OPENGL_BACKEND=ON" "-DGLAD_REPRODUCIBLE=ON"
|
||||
];
|
||||
buildInputs = [ gnuplot libjpeg libtiff zlib libpng lapack blas fftw opencv nodesoup cimg glfw libGL glad ];
|
||||
nativeBuildInputs = [ cmake pkg-config python3 ];
|
||||
propagatedBuildInputs = [ libGL glad glfw ];
|
||||
propagatedNativeBuildInputs = [ python3 ];
|
||||
cmakeFlags = [ "-DBUILD_SHARED_LIBS=ON" "-DMATPLOTPP_BUILD_EXAMPLES=OFF" ];
|
||||
nativeBuildInputs = [ cmake pkg-config ];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user