From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8D3D5176FB4 for ; Wed, 18 Dec 2024 08:38:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734511123; cv=none; b=Qyc9keoXaLcF0Skxep7tp3eBDoQBHDHjF2i0UnQ41X9kaqQn3XI8MPpSrQ+uBXD0EC1JzoekMOyheun6ES6CFXp/56AEkMaE3HpbaWHKsj+9UW/htdX4td65WEpqOFW+e244bAVfb39jkZI4V7sgIWWINGX6v7VD7w1Dwa/3JvM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734511123; c=relaxed/simple; bh=lb++ULU1zjE304M7qhX++kz/MOQu3wU7e5YPxeu2jms=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=g0+U1Cg76As36FdWiCgr6MbMAPmzemjSjn2Q9dUP6+xxUWAQtgE6LuieIJbGZhzFg5hiz62sSBXEMjWZw126ZHLViPDULDos93/dKTaK9w1eBcgMVrgUAutolXdOk7ENRmnq6RSR/wMmS3Vct8OJIkhifhGrtls04Keg9wz2xv4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=E48j7aHT; arc=none smtp.client-ip=209.85.221.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="E48j7aHT" Received: by mail-wr1-f49.google.com with SMTP id ffacd0b85a97d-385e3621518so3167102f8f.1 for ; Wed, 18 Dec 2024 00:38:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1734511120; x=1735115920; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=wBpSCttl5XApEhToqmcNJtkyprOjG86smKXLL3EJFZQ=; b=E48j7aHThwim8LV3dAAiEHx70YfVACNcGhxVXoLkLclQ15SvTgQ7GcPF2dZEzNGsJC S1XD6+eCuXZiG/+k6pJAUgcZo+kgvUIo/HsAf3/q0kKIqe59tgtms54SIoiX69d+3HCC /dBNAy5Lo9qn55Uc7ZDCXuphyaysUDuJQwbNnvcGqIAWyTsqycpq9yunkoLUz03z8v9o 1qj/shM8NmzJuDHdIw4DxbTdV5p1BX8rzh2Z6GEXMwTMaPt6+Kdm/Z/qpCVeUzeEN1hT qtVL0G/5AnXL9mRO+UIwciT3vRX7AqHUsrs3Y7MUA0ZfXAQnCvQ+vmZtCIL/vTaWeH4K flrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734511120; x=1735115920; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=wBpSCttl5XApEhToqmcNJtkyprOjG86smKXLL3EJFZQ=; b=ILUYqCR9Yn+a3iO5cpUiJde4wPt9Jn8Q3J9AnhBmNRlefjGLS0PpkmHD2w8/VfMEsL nuFc/cdj0UCwKKHt+WpKFOpjoeU+wengiGTRpn9FRg+T9pSdCrDno/Fb0DWIN3frmYMm /RMS0mViWF16eSkb20fV6gWG4KEejKgf7Fb7TfIAIIm9Hz/vf6MlQV3US7AVONNsBoYl b1AYLa0wUDpYr7hLIM/A84tpICrl076cn9chzPrLiCpOI+R+5ygtIQZRo8Wg9jsrO6Ym GjqAJDYSchgg2PYbkAe/v0pUDRXLhg5WVsf3OO1dwYaIR8UWpPNKyFZMm5AYnGOzs+8s T3rw== X-Forwarded-Encrypted: i=1; AJvYcCWkYaIt+PzsMctFiLpf6otxEY69PnJGsCEV5eIvRC/okk5vgRenUj+HagjeSRdW0Hbd44bO10/vizNjyvE=@vger.kernel.org X-Gm-Message-State: AOJu0YyWQFSgtuGfWEsGwkjAYJJ41166yZ2k/T/H0G2ShjctDYkO626l 8o6PM8YGeMNAeRUiffNCGoe6oTCS6Z3g0SDEQkUaD2uDs7+6c1B/y2/+wjfF0Bc= X-Gm-Gg: ASbGncvaQam+CHD9/5dxkal2OI+DlMJr1GCc3ZRJObs148Bh3QdFtDvJpxPWmggPERs q7LJP0ozyt0wQGQ1ViiVlGiEKX+PZSNptf9fKsKOrdarOzdW6It4pvWk/zkhA+i1Xma0bp56efC NtItj7WVyRcQyJVMzYiF5KKGIMPB5/JYGcxLVicEnMEz43DZdFCD8lHeEBUoWUzvHB1XE0yTZSe ifbX8osCyS9m+Ej77Im4XV7aH3FCeTyKANOIGva83RifCz6AEe9yPUPjg== X-Google-Smtp-Source: AGHT+IGZv957tf/6E1pmHKo8Ey++8iK3eKYAGbXan6MBdowdNu2QZBd/QHI2gsPVS8G3/KjoNN3pDA== X-Received: by 2002:a05:6000:1fa7:b0:385:f6c7:90c6 with SMTP id ffacd0b85a97d-388e4d657acmr1551661f8f.20.1734511119950; Wed, 18 Dec 2024 00:38:39 -0800 (PST) Received: from pathway.suse.cz ([176.114.240.50]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-388c801617bsm13304844f8f.39.2024.12.18.00.38.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2024 00:38:39 -0800 (PST) Date: Wed, 18 Dec 2024 09:38:36 +0100 From: Petr Mladek To: Easwar Hariharan Cc: Andrew Morton , Alexander Gordeev , Christophe Leroy , Gerald Schaefer , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , Sven Schnelle , Josh Poimboeuf , Jiri Kosina , Miroslav Benes , Joe Lawrence , linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, live-patching@vger.kernel.org Subject: Re: [PATCH v4 2/2] livepatch: Convert timeouts to secs_to_jiffies() Message-ID: References: <20241217231000.228677-1-eahariha@linux.microsoft.com> <20241217231000.228677-3-eahariha@linux.microsoft.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20241217231000.228677-3-eahariha@linux.microsoft.com> On Tue 2024-12-17 23:09:59, Easwar Hariharan wrote: > Commit b35108a51cf7 ("jiffies: Define secs_to_jiffies()") introduced > secs_to_jiffies(). As the value here is a multiple of 1000, use > secs_to_jiffies() instead of msecs_to_jiffies to avoid the multiplication. > > This is converted using scripts/coccinelle/misc/secs_to_jiffies.cocci with > the following Coccinelle rules: > > @@ constant C; @@ > > - msecs_to_jiffies(C * 1000) > + secs_to_jiffies(C) > > @@ constant C; @@ > > - msecs_to_jiffies(C * MSEC_PER_SEC) > + secs_to_jiffies(C) > > While here, replace the schedule_delayed_work() call with a 0 timeout > with an immediate schedule_work() call. > > --- a/samples/livepatch/livepatch-callbacks-busymod.c > +++ b/samples/livepatch/livepatch-callbacks-busymod.c > @@ -44,8 +44,7 @@ static void busymod_work_func(struct work_struct *work) > static int livepatch_callbacks_mod_init(void) > { > pr_info("%s\n", __func__); > - schedule_delayed_work(&work, > - msecs_to_jiffies(1000 * 0)); > + schedule_work(&work); Is it safe to use schedule_work() for struct delayed_work? It might work in theory but I do not feel comfortable with it. Also I would expect a compiler warning. If you really want to use schedule_work() then please also define the structure with DECLARE_WORK() and use cancel_work_sync() in livepatch_callbacks_mod_exit(). Best Regards, Petr