Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2554091pxb; Thu, 11 Feb 2021 15:59:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJzoC105tZsmxU/QHvsdq81V9b3X83WRpjHp4O5w1oJ6QHQmIyOc1QG3aCT5AQk4TZmv1MYk X-Received: by 2002:a05:6402:11c7:: with SMTP id j7mr634567edw.290.1613087955257; Thu, 11 Feb 2021 15:59:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613087955; cv=none; d=google.com; s=arc-20160816; b=KGzroQ0Qgh7CLUdG3utUsUfdQqpGkyw3TpqDRud5xpS5pgyQfoxe3MyMqQdRc+v1oo C5+dXK2rS/C1Swwp0gWAWhHvUa9KlRnhqiER90GYWyZQMGm8/pQ+/glfEmZD942TK7Hx U3NW8QnmGBRUURyJXhnxICaX1aeZyn+VqElJg25qwuM+UNxENy6V9Iv+41WJnGvqeRIQ RoMvnWxDpdXB9q02PGPEn/w0MDoHPOzoEpqxRrxcdXG2fvdQf7nyoBTBIBJB10Mdsj9D 1F1kyv/cDmEZU5csaCQ19mimYjVARIiHKXTLTjrqjyu8r6eJjDpewMqyNWZyB8plLkDX PZ4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date; bh=D/o74Et07dx2fRvLN4MOegQs6lQTNodl75OVI/fd4sA=; b=slbCPsDN9y9ZjWuvw3ZW26tHh6xsrUVJZlKr1WM+LiApaypxqx+2/JTS7+iT9QZUr5 KtWjTnC4dwMViCMMjd7cjfXPK9b9qCXHIpLNCq6EE3YLELZ0ten+joQ0KiWSxYNsXb7/ o3g96momTN3VnFLFJ1dXr6Sb47HZIYIjNtz/kEL2V6OEN4bDAzX0OnO538qdqR1zB+2D Gy71IsuNehzaqfikWmOCgqv01EJWoZmeiEbDmRgzH5YLVQV4tGSzMVOr+QYej6uIYRwh wbPH6GLrVd/a9gsjfG6oDeE86i1fCjt46f/tdtG92HJ7LedWjpHlu5yTIeQhbfCfo7oh hDLQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id eb13si5905111edb.385.2021.02.11.15.58.51; Thu, 11 Feb 2021 15:59:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229623AbhBKX6C (ORCPT + 99 others); Thu, 11 Feb 2021 18:58:02 -0500 Received: from kvm5.telegraphics.com.au ([98.124.60.144]:52878 "EHLO kvm5.telegraphics.com.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229647AbhBKX6A (ORCPT ); Thu, 11 Feb 2021 18:58:00 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by kvm5.telegraphics.com.au (Postfix) with ESMTP id 2425B2991B; Thu, 11 Feb 2021 18:57:16 -0500 (EST) Date: Fri, 12 Feb 2021 10:57:17 +1100 (AEDT) From: Finn Thain To: "Song Bao Hua (Barry Song)" cc: tanxiaofei , "jejb@linux.ibm.com" , "martin.petersen@oracle.com" , "linux-scsi@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linuxarm@openeuler.org" , "linux-m68k@vger.kernel.org" Subject: RE: Re: [PATCH for-next 00/32] spin lock usage optimization for SCSI drivers In-Reply-To: <417fa728c3ff4418ac87e0d409b5a084@hisilicon.com> Message-ID: References: <417fa728c3ff4418ac87e0d409b5a084@hisilicon.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 11 Feb 2021, Song Bao Hua (Barry Song) wrote: > > Actually in m68k, I also saw its IRQ entry disabled interrupts by > ' move #0x2700,%sr /* disable intrs */' > > arch/m68k/include/asm/entry.h: > > .macro SAVE_ALL_SYS > move #0x2700,%sr /* disable intrs */ > btst #5,%sp@(2) /* from user? */ > bnes 6f /* no, skip */ > movel %sp,sw_usp /* save user sp */ > ... > > .macro SAVE_ALL_INT > SAVE_ALL_SYS > moveq #-1,%d0 /* not system call entry */ > movel %d0,%sp@(PT_OFF_ORIG_D0) > .endm > > arch/m68k/kernel/entry.S: > > /* This is the main interrupt handler for autovector interrupts */ > > ENTRY(auto_inthandler) > SAVE_ALL_INT > GET_CURRENT(%d0) > | put exception # in d0 > bfextu %sp@(PT_OFF_FORMATVEC){#4,#10},%d0 > subw #VEC_SPUR,%d0 > > movel %sp,%sp@- > movel %d0,%sp@- | put vector # on stack > auto_irqhandler_fixup = . + 2 > jsr do_IRQ | process the IRQ > addql #8,%sp | pop parameters off stack > jra ret_from_exception > > So my question is that " move #0x2700,%sr" is actually disabling > all interrupts? And is m68k actually running irq handlers > with interrupts disabled? > When sonic_interrupt() executes, the IPL is 2 or 3 (since either IRQ may be involved). That is, SR & 0x700 is 0x200 or 0x300. The level 3 interrupt may interrupt execution of the level 2 handler so an irq lock is used to avoid re-entrance. This patch, diff --git a/drivers/net/ethernet/natsemi/sonic.c b/drivers/net/ethernet/natsemi/sonic.c index d17d1b4f2585..041354647bad 100644 --- a/drivers/net/ethernet/natsemi/sonic.c +++ b/drivers/net/ethernet/natsemi/sonic.c @@ -355,6 +355,8 @@ static irqreturn_t sonic_interrupt(int irq, void *dev_id) */ spin_lock_irqsave(&lp->lock, flags); + printk_once(KERN_INFO "%s: %08lx\n", __func__, flags); + status = SONIC_READ(SONIC_ISR) & SONIC_IMR_DEFAULT; if (!status) { spin_unlock_irqrestore(&lp->lock, flags); produces this output, [ 3.800000] sonic_interrupt: 00002300 I ran that code in QEMU, but experience shows that Apple hardware works exactly the same. Please do confirm this for yourself, if you still think the code and comments in sonic_interrupt are wrong. > Best Regards > Barry >