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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D5687C5478C for ; Tue, 27 Feb 2024 11:36:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=OGSFxvdayKhlnJQYkVYAgMiO4kTvAHIbwGwy1I09mJs=; b=s3fLH+UO2pMhKi Ct3Ym24LR9z+7ha6l+kJyOZi6CqbWroXb8opOBQuLoTTVsH4NLX+EIuQrUpwyx7NLO2uZgcSpI+C0 RXIJlT8CnufNb6ve0XSu/B/eawiPY+dlDDi/9pjOnENe8Bc3HlVeDN3mwjdyILhHPG/xFlsOqE/GW NvmECFUMwiVXtekzB/BKvJW/6kkdut3ODTws5Gy/tMcHb1V1KLaKoO6NLz+4k8d8ZdqRd7yrkMs+4 wOW62KcrIz54Lxr3CSQfxG4MzP+/rgAdQ+Pjyw3SjmbfyeTOq4QZuf972liqo476bcH0wUJAok4e1 X76fjKHBUjCYpy+0/Mlw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1revl3-00000004xeB-0Cw3; Tue, 27 Feb 2024 11:36:25 +0000 Received: from mail-lj1-x236.google.com ([2a00:1450:4864:20::236]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1revkz-00000004xdf-40sm for linux-arm-kernel@lists.infradead.org; Tue, 27 Feb 2024 11:36:23 +0000 Received: by mail-lj1-x236.google.com with SMTP id 38308e7fff4ca-2d21a68dd3bso55105091fa.1 for ; Tue, 27 Feb 2024 03:36:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709033779; x=1709638579; darn=lists.infradead.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=F2dfSFowPG6OJx24ce8j/IMP5r1q4MC2ylHJ11PjwhI=; b=ldUKFnol7+vZSx0+MG/n9ZQO4MbTF2p/oC3xuV32ZLttRftbJoATCf8cALo0/kgFsW elQhVjx95FZJhccgYnHSPdF8kcX+ZAA5NfpvISlldESMm9ESWvEb04XmOZIOC/izMuJ8 CwE6CXpghlbu6ZZtI8a2nflXL+0jDlw7k2oTGm7GgQJurIUe04oAVsX/Ts+BzKya5cvq q5jq5VapjTkmFQg2JfIW6O/Em88fGoUf4q3KdtLBfGh4/kO8FXYtfst0EKeB4/JewMnb 0L9DT1+sJnr2X8fHVzEZqPtw+YOh+3MAyPbaSDq3EBiyF657v7J6AHc++Cy/hbQuh4Js sSwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709033779; x=1709638579; 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=F2dfSFowPG6OJx24ce8j/IMP5r1q4MC2ylHJ11PjwhI=; b=BHOE8AC8KW8HoyutlNFwZj6Mrkpxf6IZtzw6jq7mlKgXpInotV+pDO/7Q+w76Zk718 zQTbWJ4gUHuvf/8xGWBpwtgMrYWoJflI26ZNlejtp4LlAzdkqpnRIarEZWwZULo15V2Z pJnjPaQOedHWjDibKAKW4RyaqYneajQJd7CsZHKhDDJ2qXdJDaWpkvCxLBI/zmAMo/KU R2fJhIMa5rQ51lVc+fifPIajIxXQ3Vg7FDMcfW02p5rtgzKexR8Eqhc2HIYhefiIAJQe 2vfwEzDex9kqIzq9N8SS2rZ8Kj8M3QzQVrDkWbMaaxsW3knCPaIO6CQaMzIZfPVFAXub Cnbw== X-Forwarded-Encrypted: i=1; AJvYcCWGR9XozaUlqPWrTxnhQ/QKE343ZI+lenGkmlHHmLsMxWcGzOzvNr93AkFE0Chk77bH2uvpvh0AWZIce6Dw9Zu3NdL+Vkv8k+/cWw5mHCXqhAcD5BU= X-Gm-Message-State: AOJu0YxiLwxrpFLqcavhg11BrR89JW269dLBbylMhlHHuoI4D0Ffs53l N8A9yVPdusagzYdqN9icDAvISifVUMb3U7CvmYlaMb3nPy+6bzhS2e1SPjud2I8= X-Google-Smtp-Source: AGHT+IH8chJmr0SLHKn92dkr0v9kTep5V03cldZVttSL8voTT0cGyFHul6UT3WcKRjRRn8bsw4wXUw== X-Received: by 2002:a2e:6a06:0:b0:2d1:1ef3:3c84 with SMTP id f6-20020a2e6a06000000b002d11ef33c84mr5482316ljc.28.1709033779062; Tue, 27 Feb 2024 03:36:19 -0800 (PST) Received: from localhost ([102.222.70.76]) by smtp.gmail.com with ESMTPSA id j3-20020a5d4523000000b0033cfa00e497sm11071860wra.64.2024.02.27.03.36.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 03:36:18 -0800 (PST) Date: Tue, 27 Feb 2024 14:36:14 +0300 From: Dan Carpenter To: "Jain, Ronak" Cc: "Buddhabhatti, Jay" , "haribabu.gattem@xilinx.com" , "Simek, Michal" , "linux-arm-kernel@lists.infradead.org" Subject: Re: [bug report] soc: xilinx: Fix for call trace due to the usage of smp_processor_id() Message-ID: <1c8fb4b3-c5a7-453c-b032-ac2a495faff0@moroto.mountain> References: <52a41911-7c7d-4164-aeb7-aba5eddfeea9@moroto.mountain> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240227_033622_040691_F85CAA02 X-CRM114-Status: GOOD ( 28.60 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Feb 27, 2024 at 10:10:45AM +0000, Jain, Ronak wrote: > Hi Dan, > > > -----Original Message----- > > From: Buddhabhatti, Jay > > Sent: Tuesday, February 27, 2024 3:25 PM > > To: Dan Carpenter ; > > haribabu.gattem@xilinx.com; Jain, Ronak > > Cc: Simek, Michal ; linux-arm- > > kernel@lists.infradead.org > > Subject: RE: [bug report] soc: xilinx: Fix for call trace due to the usage of > > smp_processor_id() > > > > +@Jain, Ronak > > > > > -----Original Message----- > > > From: Dan Carpenter > > > Sent: Thursday, February 1, 2024 5:50 PM > > > To: haribabu.gattem@xilinx.com > > > Cc: Buddhabhatti, Jay ; Simek, Michal > > > ; linux-arm-kernel@lists.infradead.org > > > Subject: [bug report] soc: xilinx: Fix for call trace due to the usage of > > > smp_processor_id() > > > > > > Hello HariBabu Gattem, > > > > > > The patch daed80ed0758: "soc: xilinx: Fix for call trace due to the usage of > > > smp_processor_id()" from Oct 26, 2023 (linux-next), leads to the following > > > Smatch static checker warning: > > > > > > kernel/irq/manage.c:2614 __request_percpu_irq() > > > warn: sleeping in atomic context > > > > > > drivers/soc/xilinx/xlnx_event_manager.c > > > 610 cpu = get_cpu(); > > > ^^^^^^^^^^^^^^^ > > > The patch adds get_cpu() which disables preemption. > > > > > > 611 per_cpu(cpu_number1, cpu) = cpu; > > > 612 ret = request_percpu_irq(virq_sgi, xlnx_event_handler, > > > "xlnx_event_mgmt", > > > ^^^^^^^^^^^^^^^^^^ > > > request_percpu_irq() does a sleeping allocation so it's a sleeping in atomic > > bug. > > > > > > 613 &cpu_number1); > > > 614 put_cpu(); > > > > > I am working on this issue, and I tried to reproduce the issue but I > couldn't. First, I tried enabling the below config flags for kernel > preemption and then ran the smatch command but didn't get the warning > you were mentioning. > > The configs I enabled, > CONFIG_DEBUG_ATOMIC_SLEEP=y This config would detect the issue at runtime. > CONFIG_PREEMPT_RT=y > CONFIG_PREEMPT=y > CONFIG_PREEMPT_COUNT=y > CONFIG_PREEMPTION=y > CONFIG_PREEMPT_RCU=y > CONFIG_DEBUG_PREEMPT=y > > The smatch command I ran, > ~/smatch/smatch_scripts/kchecker --spammy drivers/soc/xilinx/xlnx_event_manager.c > ~/smatch/smatch_scripts/kchecker --spammy kernel/irq/manage.c > make ARCH=arm64 CHECK="~/smatch/smatch -p=kernel" C=2 drivers/soc/xilinx/xlnx_event_manager.o > > Could you please help me with the config you used for this issue and > would be good if you could share the complete steps(the smatch > commands) to reproduce the issue. I'm sorry, to generate this warning you need to rebuild the cross function database a few times. Which is simple enough, but each time you rebuild the database takes something like 6 hours. smatch_scripts/build_kernel_data.sh Each time you rebuild it, it adds one more branch to the call trees. In this case building it twice would work I guess. Then it would be: ~/smatch/smatch_scripts/kchecker --spammy kernel/irq/manage.c That prints the warning quoted above and then I do: ~/smatch/smatch_data/db/smdb.py preempt __request_percpu_irq xlnx_event_init_sgi() <- disables preempt -> request_percpu_irq() -> __request_percpu_irq() And review the call tree to figure out who to report the warnings too. But it's probably more interesting to enable CONFIG_DEBUG_ATOMIC_SLEEP and do runtime testing. regards, dan carpenter _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel