Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp125088imm; Mon, 14 May 2018 22:22:27 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrwZlS31PA/v65BbC2PjLR58YCP04fAuxXxfuhuvsfkl9VTfcayvjZJ+0Xxe7rveyLWQR1g X-Received: by 2002:a17:902:8494:: with SMTP id c20-v6mr12987141plo.66.1526361746953; Mon, 14 May 2018 22:22:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526361746; cv=none; d=google.com; s=arc-20160816; b=g3qDNxo0KZGiu36kFbsNJlKr0X/39oNgaLuSEbk0arnp7/uIMXtHhXHh/wFwBXoLk3 oIeH1znxY/WhArNpvzJ7YdH6o1QsKG1ZFEP8+6YiA596Al8vJNizyDnYw1AWhr6Uq7fS nEyL/foWaYcmDZOL/46YA4a4qBUb+T6c1K5cF29n0+F96eKsC56faau0O2bD4haa9+ZC f5mgqCnIFoKr7xHGobipTRRMi0kLCxKK/1W2GmVyGaRKvOmLXbs4e3iKq+fIMhCC3Umj ahYSJUH47Q3a1lh2cZVG4/n+aaQTZtx5oggPGu3BEq3ZYLEmTMcBYvsuuv8YmY04WpNR aaJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=WabYdesth2DBL1RwB+tcfTnvEnVxo90+emxvOFxJlx4=; b=IRkuULqDJcTif44lLRSdoMA4FRcyLyzyBn13LgPkOBB4l8kuf0UYZSCCQKOyIqGTAT /K1aKPlAGqJL6+xMrmo1Oe2Egf8kmUla8TvMwF2or0d9siCVo+DUHKYtCNmnUuA80vRS 08wSs7TwjPh6fvDEHUwNbWi/lXCevG5DDD39MSXYCVAlLxyi/8bZPrvHcHSw+5zoyi/2 wu4Gm+R3MWLKrDBaUhJBPCz8KfwK4EqXm6oWsBrwe+UONSTn9pb99UtUWVXMk245Noct 8LZOtxnrIuBAyIpILwDmx3IW864IB1zEJ9WuflYSA9TlHYwiBiSLY8mB2tO9ibJBDpfb JOaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=AzzQz8Zg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b2-v6si9109240pgn.276.2018.05.14.22.22.12; Mon, 14 May 2018 22:22:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=AzzQz8Zg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752222AbeEOFUt (ORCPT + 99 others); Tue, 15 May 2018 01:20:49 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:40949 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752084AbeEOFUr (ORCPT ); Tue, 15 May 2018 01:20:47 -0400 Received: by mail-pf0-f196.google.com with SMTP id f189-v6so7123142pfa.7 for ; Mon, 14 May 2018 22:20:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=WabYdesth2DBL1RwB+tcfTnvEnVxo90+emxvOFxJlx4=; b=AzzQz8ZgIB4kUXj/uiPs4Hgmnfrm9Nu/76Uds9mwCG4ZIBd78RvnerUcpePIEasDSz nEhv811TuI9xjyPJAh30Ix0znYBDFhNSZQ4vMT+RYKxZXp+OusSfz8sTAvNDRk0lp/UE 8dhRTrj6M2K1r+R9hGXWZL6gtK0Iy/p3F3RRem3XY+8DhoAmwxbRbQrEdi5meULAMCMK 9qnf2hhhZLj5PYKpYOMx42EEnwMtDAU/or7pe2WMOqpJ7cPs5YWNNC4wDWtRV4m0iSoJ t5w+WxR7rLeAuJbwX7oVV7hPytk7SeKtRw8701GHuygg9EESRegUaX6R3LcbacquNCVQ GKGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=WabYdesth2DBL1RwB+tcfTnvEnVxo90+emxvOFxJlx4=; b=V6F97PSiO8UeNgW6MkcYFD0/5nwLLxF2GFHkjmEAIBsgGBL3mE2VxDZkF3s1+ACTd9 HqYsL8TOy/sn+6Yv08iM2SVi+8DH4ylDADLmyHTXAWe5dG+k+SOnLPHkZE/9LIX9Fxe3 BtX5tWCobOXu5NyMok2ko7GEUfSVUyfZiVfZ3yzjld5qtDVYmp5UQn6BG/v4P4u5AxVC R+9tVYfFHn6jYuNZkFBhjYlzUhsDyKZwHVAmC/+ls1MqrvMg78/MqL5M2vxiY4kLnqch pIAbAfml1ytfs/jH91QNV4Ok5zhJVZ9pngfY4A548bYYJZ3MJrsI5j/s2MIbzIxp9YdR gLuA== X-Gm-Message-State: ALKqPwevZLjVmPR0zepwbYf5f04VSz5/9LaDVALERQ+tbbruKZK0fbOy T7GztIVaB8X369soJTujaiQ= X-Received: by 2002:a63:784a:: with SMTP id t71-v6mr4529818pgc.382.1526361647251; Mon, 14 May 2018 22:20:47 -0700 (PDT) Received: from localhost ([175.223.37.81]) by smtp.gmail.com with ESMTPSA id r76-v6sm20812191pfl.1.2018.05.14.22.20.45 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 14 May 2018 22:20:46 -0700 (PDT) Date: Tue, 15 May 2018 14:20:42 +0900 From: Sergey Senozhatsky To: Steven Rostedt Cc: Sergey Senozhatsky , Dmitry Vyukov , Tetsuo Handa , Petr Mladek , Sergey Senozhatsky , syzkaller , Fengguang Wu , LKML Subject: Re: printk feature for syzbot? Message-ID: <20180515052042.GB480@jagdpanzerIV> References: <201805102350.JJH73950.tVJHQLFSOMOOFF@I-love.SAKURA.ne.jp> <20180511014515.GA895@jagdpanzerIV> <201805110238.w4B2cIGH079602@www262.sakura.ne.jp> <20180511062151.GA18160@jagdpanzerIV> <20180511095004.GA6575@jagdpanzerIV> <20180511093716.18329322@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180511093716.18329322@gandalf.local.home> User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, On (05/11/18 09:37), Steven Rostedt wrote: > > On (05/11/18 11:17), Dmitry Vyukov wrote: > > > > > > From what I see, it seems that interrupts can be nested: > > > > Hm, I thought that in general IRQ handlers run with local IRQs > > disabled on CPU. So, generally, IRQs don't nest. Was I wrong? > > NMIs can nest, that's true; but I thought that at least IRQs > > don't. > > We normally don't run nested interrupts, although as the comment in > preempt.h says: > > * The hardirq count could in theory be the same as the number of > * interrupts in the system, but we run all interrupt handlers with > * interrupts disabled, so we cannot have nesting interrupts. Though > * there are a few palaeontologic drivers which reenable interrupts in > * the handler, so we need more than one bit here. > > And no, NMI handlers do not nest. Yes, we deal with nested NMIs, but in > those cases, we just set a bit as a latch, and return, and when the > first NMI is complete, it checks that bit and if it is set, it executes > another NMI handler. Good to know! I thought that NMI can nest in some weird cases, like a breakpoint from NMI. This must be super tricky, given that nested NMI will corrupt the stack of the previous NMI, etc. Anyway. > > Well, hm. __irq_enter() does preempt_count_add(HARDIRQ_OFFSET) and > > __irq_exit() does preempt_count_sub(HARDIRQ_OFFSET). So, technically, > > you can store > > > > preempt_count() & HARDIRQ_MASK > > preempt_count() & SOFTIRQ_MASK > > preempt_count() & NMI_MASK > > [..] > I handle nesting of different contexts in the ftrace ring buffer using > the preempt count. See trace_recursive_lock/unlock() in > kernel/trace/ring_buffer.c. Thanks. So you are also checking the preempt_count(). -ss