Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1511155imm; Wed, 10 Oct 2018 16:14:59 -0700 (PDT) X-Google-Smtp-Source: ACcGV611wcjXAzoH5/YVub6feLvZ2KqlRgcvZbYKcUC80LC4j/7bqMuKu1jh7wUSfiZEYGNKbStg X-Received: by 2002:a62:c4c5:: with SMTP id h66-v6mr36634820pfk.39.1539213299777; Wed, 10 Oct 2018 16:14:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539213299; cv=none; d=google.com; s=arc-20160816; b=cQUn50tlgqFlTlOpqFTDWR+4PtGKMs0V2Q0/6RFJzcnKP1AkAyg9xNY1//4kqZRXUh yYzkISl2Qr33E0c8Z+wG8HZro7Ue3EY5H7Phez1O6Bj2+QHVsmVz3IX5SJOO96FKEG+c VGF42b9+p3EDEua861uo/a5930XdMP4DyyJeLa3ERtggE09ytTQwp7qqmxgWjGDTNXo4 z3hi8AIhMz/fMHlc7fbloCBEUREsejM3+V7e/NOe69eKhraMK+E0duY2UQrB0QF/SoDU N4g6NIqLKIRnOApsGjaN2k++jO4XONVZ1k43k+41aZtar4qIWLzSerittKB9uHJibFnc ineg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=yXsZ+B3cR0nBJpYdDYsVQFif2IzdU0uMYZgibPSh608=; b=LsdLAQWSVyOXFZNRfvxI0RoJIes1WTmjHlXswFlUei5jXZltpPgGBWz+yUfWVNVBKc YojLEJjP261K7MzPs+pROYPNpF+vyM0FRm9P24cJl/Pz4Yom40BFvFfCxGpynfPd6/ta s/jDIXsWoZa4zS7NhV2AeCAm0nwwkAO/nRV6Dex4qLz+fEFAi/yBl1BuzTjKUyKEU1+4 a5/KR5H1T29Zv5YZxaw6MFMVS9oiT9j3GYoZRovbep6mhTZYhZaNm7ZFicILtSFtbIJb AS2FmJunK8fvCFLyTO7q+6ly98vNakLuGXjN0W8xhjluld04F5JS5I2iNYNJZK8KGNT9 PGjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Yo3X619o; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o16-v6si26100577pfi.279.2018.10.10.16.14.44; Wed, 10 Oct 2018 16:14:59 -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=@kernel.org header.s=default header.b=Yo3X619o; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727000AbeJKGhM (ORCPT + 99 others); Thu, 11 Oct 2018 02:37:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:35360 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726977AbeJKGhM (ORCPT ); Thu, 11 Oct 2018 02:37:12 -0400 Received: from lerouge.suse.de (LFbn-NCY-1-241-207.w83-194.abo.wanadoo.fr [83.194.85.207]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EDD042151C; Wed, 10 Oct 2018 23:12:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539213170; bh=QqXfPRI82GWTDjXZ/0NDcLN3fUbuBeUQMm2D+zJBesk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Yo3X619oVWtp8WTQ/vxDX04QvZHtZI4HlE91J09wLbE6Xv1EAqbKRvvJC2ocOm/Qk 855EIzA8VZkMezu1LFIjo1aLxmYcgNSEEZHG+Y+UqPP33K1hcgFRFfQ2oqIhyIZbpV oU3lJR8OKZXDJkKhVQj+XHRkuFsqfgh1whGuFu+w= From: Frederic Weisbecker To: LKML Cc: Frederic Weisbecker , Sebastian Andrzej Siewior , Peter Zijlstra , "David S . Miller" , Linus Torvalds , Thomas Gleixner , "Paul E . McKenney" , Ingo Molnar , Frederic Weisbecker , Mauro Carvalho Chehab Subject: [RFC PATCH 06/30] softirq: Introduce disabled softirq vectors bits Date: Thu, 11 Oct 2018 01:11:53 +0200 Message-Id: <1539213137-13953-7-git-send-email-frederic@kernel.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1539213137-13953-1-git-send-email-frederic@kernel.org> References: <1539213137-13953-1-git-send-email-frederic@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Disabling the softirqs is currently an all-or-nothing operation: either all softirqs are enabled or none of them. However we plan to introduce a per vector granularity of this ability to improve latency response and make each softirq vector interruptible by the others. The first step carried here is to provide the necessary APIs to control the per-vector enable bits. Signed-off-by: Frederic Weisbecker Cc: Ingo Molnar Cc: Sebastian Andrzej Siewior Cc: Thomas Gleixner Cc: Peter Zijlstra Cc: Linus Torvalds Cc: David S. Miller Cc: Mauro Carvalho Chehab Cc: Paul E. McKenney --- arch/s390/include/asm/hardirq.h | 7 +++++- include/linux/interrupt.h | 54 +++++++++++++++++++++++++++++++++++++---- 2 files changed, 55 insertions(+), 6 deletions(-) diff --git a/arch/s390/include/asm/hardirq.h b/arch/s390/include/asm/hardirq.h index 84ad789..5a6c5c7 100644 --- a/arch/s390/include/asm/hardirq.h +++ b/arch/s390/include/asm/hardirq.h @@ -13,7 +13,12 @@ #include -#define local_softirq_pending() (S390_lowcore.softirq_data) +#define local_softirq_data() (S390_lowcore.softirq_data) +#define local_softirq_pending() (local_softirq_data() & SOFTIRQ_PENDING_MASK) +#define local_softirq_disabled() (local_softirq_data() & ~SOFTIRQ_PENDING_MASK) +#define softirq_enabled_nand(x) (S390_lowcore.softirq_data &= ~((x) << SOFTIRQ_ENABLED_SHIFT)) +#define softirq_pending_or(x) (S390_lowcore.softirq_data |= ((x) << SOFTIRQ_ENABLED_SHIFT)) +#define softirq_pending_set(x) (S390_lowcore.softirq_data = ((x) << SOFTIRQ_ENABLED_SHIFT)) #define softirq_pending_nand(x) (S390_lowcore.softirq_data &= ~(x)) #define softirq_pending_or(x) (S390_lowcore.softirq_data |= (x)) diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index a577a54..4882196 100644 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h @@ -468,19 +468,63 @@ enum #define SOFTIRQ_STOP_IDLE_MASK (~(1 << RCU_SOFTIRQ)) #define SOFTIRQ_ALL_MASK (BIT(NR_SOFTIRQS) - 1) -#ifndef local_softirq_pending +#define SOFTIRQ_ENABLED_SHIFT 16 +#define SOFTIRQ_PENDING_MASK (BIT(SOFTIRQ_ENABLED_SHIFT) - 1) + + +#ifndef local_softirq_data #ifndef local_softirq_data_ref #define local_softirq_data_ref irq_stat.__softirq_data #endif -#define local_softirq_pending() (__this_cpu_read(local_softirq_data_ref)) -#define softirq_pending_nand(x) (__this_cpu_and(local_softirq_data_ref, ~(x))) -#define softirq_pending_or(x) (__this_cpu_or(local_softirq_data_ref, (x))) +static inline unsigned int local_softirq_data(void) +{ + return __this_cpu_read(local_softirq_data_ref); +} +static inline unsigned int local_softirq_enabled(void) +{ + return local_softirq_data() >> SOFTIRQ_ENABLED_SHIFT; +} + +static inline unsigned int local_softirq_pending(void) +{ + return local_softirq_data() & SOFTIRQ_PENDING_MASK; +} + +static inline void softirq_enabled_nand(unsigned int enabled) +{ + enabled <<= SOFTIRQ_ENABLED_SHIFT; + __this_cpu_and(local_softirq_data_ref, ~enabled); +} + +static inline void softirq_enabled_or(unsigned int enabled) +{ + enabled <<= SOFTIRQ_ENABLED_SHIFT; + __this_cpu_or(local_softirq_data_ref, enabled); +} + +static inline void softirq_enabled_set(unsigned int enabled) +{ + unsigned int data; + + data = enabled << SOFTIRQ_ENABLED_SHIFT; + data |= local_softirq_pending(); + __this_cpu_write(local_softirq_data_ref, data); +} + +static inline void softirq_pending_nand(unsigned int pending) +{ + __this_cpu_and(local_softirq_data_ref, ~pending); +} + +static inline void softirq_pending_or(unsigned int pending) +{ + __this_cpu_or(local_softirq_data_ref, pending); +} #endif /* local_softirq_pending */ - /* map softirq index to softirq name. update 'softirq_to_name' in * kernel/softirq.c when adding a new softirq. */ -- 2.7.4