Received: by 2002:a05:7412:ba23:b0:fa:4c10:6cad with SMTP id jp35csp1215562rdb; Fri, 19 Jan 2024 11:39:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IGuNLzLs8JDL4m96IsBViKjk2YZYXFOozX64AsPXm0YtTSdgiu+vCfJf2VsbZFvL3DFPZhZ X-Received: by 2002:a17:902:e846:b0:1d5:5de4:a944 with SMTP id t6-20020a170902e84600b001d55de4a944mr369684plg.35.1705693157325; Fri, 19 Jan 2024 11:39:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705693157; cv=pass; d=google.com; s=arc-20160816; b=0dugLJnve648tnF6tMMNiVCyvV3+mu2WCZkPP6nsC6iMPbOoLpUWtW1fiyzV6DgXQN MSXhnUoyeTokhJqnYGubCESOhB7AGeBZpbSUCs/Oy0P6ymGbNyj5nMMASnnp5kVtkqrw QIDBmmRJmnK43nVQMbMYAjqxsYlWNhjrAIARd/rJnl2mZAUoear+i3RFZY3n5GZAjScb TTKhsqZK70sVmLlRGiK1tiVjEi04FSFmBjLNxDMaPiSQbMyP2/5pPc9THEvTddea6hgb n+SvG7BT7NridX0Wmlahm/odaKtSxrtwo+GOIzM5qAZR1NBlzbqYXutyP5/arxdYWxOw 9+sw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :message-id:date:references:in-reply-to:subject:cc:to:dkim-signature :dkim-signature:from; bh=CS/Cz7E66dmpGlXTZIlNFvN7PZ3LXC8YHR0LTyz+yfc=; fh=HpZG+MuA96prTpIzLYSIkFlBZQBwuok24EQa/i38VwY=; b=zBZiNek/Mw+EliPpVK/G0iXiMRd9DQ2w69fKLzAbylRm5fCxZpYmMaLcxNlfkEdbDW jEWA/Ws0YkwynqgXkZI1s+VTndnO41cljPRYLwSXM8c0IRsmp6k+lNi3eOfb8wfP9WY/ lNzi+fr4NYSSgcasYv67NjXMit6WmP8gGMU+ypEIaWJW4wxnDj5gN3N/es3mK11mS44a gOwhT54dqKZ33oX0re7v+m1Bl94B25yCh3x3R7kZ4QSwEjzyiLTGEET1L75nvxhv809B IbB401l19+UvZXFzR4/nVgLL+zNPob22r353Bptfd5ZWYy+bGfUkcBET04m7pcSZ9HnB ePDw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=S9myda9Q; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-31522-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-31522-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id u2-20020a17090341c200b001d5ce87f8e2si3940297ple.124.2024.01.19.11.39.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jan 2024 11:39:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-31522-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=S9myda9Q; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-31522-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-31522-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id EE3E6287285 for ; Fri, 19 Jan 2024 19:39:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 62ED758100; Fri, 19 Jan 2024 19:38:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="S9myda9Q"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="6XSVaLBp" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 01EDB57881 for ; Fri, 19 Jan 2024 19:38:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705693098; cv=none; b=G1tpsMC+coNyaYmnZWSvhwK0muvtmPHcvtvf6WUKtu4t8h5vdSCNW+6qCiRFQY3phKpLwsclTXNqfYHsTrh6TyAk2OKIujG78JDqCEaPpy2gFuFHrxLehnstS6B27z0Bol0gYGcYsRj3/WWXgk5xtiLz4L1ioKeWE0Ixia8T1FI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705693098; c=relaxed/simple; bh=jPPZFFZi33mDDSUrFYgbZMLWbgZcEuqtjLsvdrEY/mI=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=Iq3UCy9jqQKgX6Sf1GyHN/x1S+b53a/ydmsFCj9fdg5UMqs9P+uo6mp3F7yq1ZDcpWXeeHK5U4mgG4I8ULil0IydwESXzM9Tz/xIQms5B7I2w1S7AYz+XX9WdxiYmqJrwIbSSiTYh7qyAku6esakPt2TVq2OSFeZaWZWOBk4v9Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=S9myda9Q; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=6XSVaLBp; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1705693094; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=CS/Cz7E66dmpGlXTZIlNFvN7PZ3LXC8YHR0LTyz+yfc=; b=S9myda9Q4QQKDHAXOgv2l30R0dU7thICuNyHuVLF2/q6Lhrhct6JmttrbPou5M1/fPTc2Z 0m4el2NCOuf/4Sodvk21XcQfVnqMPuMHgO6HoZuaViQoHlz456i1t0iPZ2LaRUXuT6flkO HVi7N8lDGYkKFACvIQoyLExMdx+HuyHw05azzONmZSPR1EpZyKkcDt5flfnZvRvmzYZ1co 9bIcWE45qlc183XnZyBifDeKfdAxMkRmJpuoispb9YfqegZTnXBFvvC17YT4kfrRadyIXa vn8KgekHwwAFVSU19LXFbfwMHdmRgKyg23FcSEsNsuo4ti6CEy50BgkZGac9RQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1705693094; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=CS/Cz7E66dmpGlXTZIlNFvN7PZ3LXC8YHR0LTyz+yfc=; b=6XSVaLBporlkLVvcjBqv2dXk+MkOYB9Ka7tFZaRoKGt9VE1MncdixkCZVn4fnjaebs0btv cet4xUArA67o0WBA== To: John Stultz , Pranav Prasad Cc: sboyd@kernel.org, linux-kernel@vger.kernel.org, Kelly Rossmoyer Subject: Re: [PATCH] alarmtimer: Expose information about next alarm to userspace via sysfs In-Reply-To: References: <20240118181459.1663313-1-pranavpp@google.com> Date: Fri, 19 Jan 2024 20:38:13 +0100 Message-ID: <87y1cldsgq.ffs@tglx> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain On Thu, Jan 18 2024 at 14:11, John Stultz wrote: > I'm always a bit cautious when exposing stuff to userland, > particularly if it's potentially racy as you mentioned in your > description. One thought I had was might adding a similar check > earlier in the suspend path on the kernel side provide similar benefit > (without requiring userland changes)? > > Basically, if I understand the problem: > echo mem > /sys/power/state > > alarmtimer_suspend() > if (next_alarm < TWO_SECONDS) > return -EBUSY; > > > So if instead we did: > echo mem > /sys/power/state > enter_state() > if (alarmtimer_immenent()) > retrun -EBUSY > > So the kernel would come back much faster if the suspend was going to abort. > > I suspect you all have considered this already but wanted to > understand what issues that approach has. It has the same race issues as the user space readout has as far as I understand and it's much simpler. Thanks, tglx