From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.4 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1E33FC3B186 for ; Tue, 11 Feb 2020 10:24:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E9CF320714 for ; Tue, 11 Feb 2020 10:24:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="ieDwTSX3" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728354AbgBKKYK (ORCPT ); Tue, 11 Feb 2020 05:24:10 -0500 Received: from fllv0015.ext.ti.com ([198.47.19.141]:56092 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728236AbgBKKYK (ORCPT ); Tue, 11 Feb 2020 05:24:10 -0500 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 01BAO3JI080604; Tue, 11 Feb 2020 04:24:03 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1581416643; bh=IT0XtP14rOcxVvIjEkJLAVhnV8MbpGdBDYqA20Ogvvg=; h=To:CC:From:Subject:Date; b=ieDwTSX3jBi/zU1u4phaOZr/3Ii8HGFTXg5HGFMr7ljayvLceHG8Ur/umMkvypjRh QAQk97bS+itM9Sg0T+qBvIFm/dBtzumU10HinzZarwXkKrmUxTzv/JcfNi8oIXIkIW SvftF7u0/x73WxmsKAgW8ob+31xkdvsU5ZvYCsdk= Received: from DLEE114.ent.ti.com (dlee114.ent.ti.com [157.170.170.25]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTP id 01BAO2kT021354; Tue, 11 Feb 2020 04:24:03 -0600 Received: from DLEE103.ent.ti.com (157.170.170.33) by DLEE114.ent.ti.com (157.170.170.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3; Tue, 11 Feb 2020 04:24:02 -0600 Received: from fllv0040.itg.ti.com (10.64.41.20) by DLEE103.ent.ti.com (157.170.170.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3 via Frontend Transport; Tue, 11 Feb 2020 04:24:03 -0600 Received: from [10.250.100.73] (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id 01BAO08Y044972; Tue, 11 Feb 2020 04:24:01 -0600 To: "linux-kernel@vger.kernel.org" , Petr Mladek CC: , Linux ARM , netdev , Richard Cochran From: Grygorii Strashko Subject: Question about kthread_mod_delayed_work() allowed context Message-ID: Date: Tue, 11 Feb 2020 12:23:59 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi All, I'd like to ask question about allowed calling context for kthread_mod_delayed_work(). The comment to kthread_mod_delayed_work() says: * This function is safe to call from any context including IRQ handler. * See __kthread_cancel_work() and kthread_delayed_work_timer_fn() * for details. */ But it has del_timer_sync() inside which seems can't be called from hard_irq context: kthread_mod_delayed_work() |-__kthread_cancel_work() |- del_timer_sync() |- WARN_ON(in_irq() && !(timer->flags & TIMER_IRQSAFE)); My use case is related to PTP processing using PTP auxiliary worker: (commit d9535cb7b760 ("ptp: introduce ptp auxiliary worker")): - periodic work A is started and res-schedules itself for every dtX - on IRQ - the work A need to be scheduled immediately Any advice on how to proceed? Can kthread_queue_work() be used even if there is delayed work is scheduled already (in general, don't care if work A will be executed one more time after timer expiration)? -- Best regards, grygorii