Received: by 10.192.165.148 with SMTP id m20csp448550imm; Fri, 4 May 2018 12:57:57 -0700 (PDT) X-Google-Smtp-Source: AB8JxZojHElPPrnPMl6+YQEa73HWz3WJxgM36Puvy9lwa9xyX8UzbIHjDu7YRq1ZtDjQMqO4djPb X-Received: by 10.98.192.80 with SMTP id x77mr28027838pff.67.1525463877799; Fri, 04 May 2018 12:57:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525463877; cv=none; d=google.com; s=arc-20160816; b=RhwkVTtMXlnIQRtVb7MKNjhbWUsA/apyrE6lqguydnS5NOP2PQkoKpg2eous2yRcvB 7Utc7pLNPTewIk2Bf5xQUVBAxxKdIc8FiQyJOWKemBHztGRdZU8Jr9SLHB/MrZ9+ZKFb snGXjGX6nqdea+aIszlcpAVp+uTcmw+xfaVvq+QjGoFGs1/lyr24F0K1G7lKSTGiKh6q ayt7SeMgQMl+dTV/7hM8CAxq7acweVznWU0L1kp/n1y7d70PhufyDwMijtqMyGntkAmq 5XU1Vaicw4sdd/LiRFfmt6zQKxbeXAQfryaJiwuva9S3hViemnfZXw7u9ZMeUbR1xoGI a9VQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=FFw3dU7V5Ll5UMfjOTYAhBQfuSGftv59PZUCYjC+QRw=; b=KI5JjPwnYxtzbXldq18jBpbyS5vPTY4VoQl8qByfdlxNqlfM1Q1YDxxrdayHTKUulQ AOSXaQJwanp0+1Govdvhi1du+EzyZyYVovhG7h/myLMvpABeismCslKgijjwMx9vHp/y TM1dXQqwq3HQQJsZCD259oWMobQKQId/kmm//kRPinPZhhG9sHgNeUxqiniSEjLISCQO l50RrEqNI/ciBvjgobxA+/MnM8bD0+e25K4de2dSHaefxfPjjRRK0lzfYY3NU7Hy2duV dNj3paz3kKdaDbRJY41XtMbOft5imdJDNKbZ9Rbl3YAAXw3BseIXgJf6EcHA3CTES4Y6 +uFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=bzgFfQAJ; 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 t8si16723141pfl.344.2018.05.04.12.57.43; Fri, 04 May 2018 12:57:57 -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=bzgFfQAJ; 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 S1751811AbeEDT5W (ORCPT + 99 others); Fri, 4 May 2018 15:57:22 -0400 Received: from mail-wm0-f54.google.com ([74.125.82.54]:53396 "EHLO mail-wm0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751527AbeEDT5V (ORCPT ); Fri, 4 May 2018 15:57:21 -0400 Received: by mail-wm0-f54.google.com with SMTP id a67so5650987wmf.3 for ; Fri, 04 May 2018 12:57:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=FFw3dU7V5Ll5UMfjOTYAhBQfuSGftv59PZUCYjC+QRw=; b=bzgFfQAJJDQLk0z0+tkbobRjgStG288Gdnt+oqlCBcVOiRNhCVwP0/tAEXcfJ6Y5kl 6vUb42FqqVkPGwZE69LA5oqjtjUr0zufhjWHczhACGM3+6kvXspw3wMBC1ZINWKyl/wB m3ozsEYKnSinnxd56++nALi7LLlggkyQiB0VViQUEHDUvCnToeZW8wBzn9pcgCDhcwdB HyVtseVTv8au5DDHlPSisWELktd3NzKnEFMGh11P+WQ5Gm1pG/DcwbmqHD+mAT6i/4BC qsr4z4fwDmz2vQf1PFtL5n2ltjC2o8K1YxLhgLLwyM33Btnah0/fqCwlhNhyN+1Kcldo j9Zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=FFw3dU7V5Ll5UMfjOTYAhBQfuSGftv59PZUCYjC+QRw=; b=sis7eWjp8VTwyf7SBTjJQcrwopEIJGuOWbFJ+Q7GNjQRJYGi1OmvJEQ3A9ew0ck6Nv eMkoRa2A4UeCfZbXK1W8ITdb0Adw3dSejT1Wc3NQWQlOC5u4CcfqW3n+BOirc2pvL3S5 to3vlWYxiDXoBf0M9dkNzHW+Gt1MEYSCSCQv358eHdkUh/Vl55tIp4HGxvQVoOQj7M+g tBVDbuYKD6L+fW1AdcWcgmrIfhBFSvWSZqxZ9zuG/SLBzequCaiH9y84ItYT8RXjb4JB Lgk7kGF8kakpRn9YTH7nVkj+RyeUZNvWsAhbemBL56usyt+ZG/jhrJWv5nmJKbdd6yUD ySwA== X-Gm-Message-State: ALQs6tCw1nbEUa/c1cSbisdgjukFHdDY2FHEsJLQ4261yneE95jM7vn3 /knN0i1nKK9k9S33dmKpdxB/6jsvgRZf39wMQpo= X-Received: by 2002:a50:860f:: with SMTP id o15-v6mr38095688edo.243.1525463839637; Fri, 04 May 2018 12:57:19 -0700 (PDT) MIME-Version: 1.0 Received: by 10.80.145.91 with HTTP; Fri, 4 May 2018 12:57:19 -0700 (PDT) In-Reply-To: <20180504184951.GU26088@linux.vnet.ibm.com> References: <20180504123050.2841f80d@gandalf.local.home> <20180504174330.GS26088@linux.vnet.ibm.com> <20180504184951.GU26088@linux.vnet.ibm.com> From: Joel Fernandes Date: Fri, 4 May 2018 12:57:19 -0700 Message-ID: Subject: Re: rcu-bh design To: Paul McKenney Cc: Joel Fernandes , Steven Rostedt , Mathieu Desnoyers , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 4, 2018 at 11:49 AM, Paul E. McKenney wrote: > On Fri, May 04, 2018 at 06:34:32PM +0000, Joel Fernandes wrote: >> On Fri, May 4, 2018 at 10:42 AM Paul E. McKenney >> >> wrote: >> [...] >> > > > > But preemptible RCU *does not* use context-switch as a quiescent >> state. >> > > > It doesn't? >> > > >> > > I thought that's what preemptible rcu is about. You can get preempted >> but >> > > you shouldn't block in a read-section. Is that not true? >> >> > Almost. All context switches in an RCU-preempt read-side critical section >> > must be subject to priority boosting. Preemption is one example, because >> > boosting the priority of the preempted task will make it runnable. >> > The priority-inheritance -rt "spinlock" is another example, because >> > boosting the priority of the task holding the lock will eventually make >> > runnable the task acquiring the lock within the RCU-preempt read-side >> > critical section. >> >> Yes I understand priority boosting is needed with preemptible RCU so that >> read-sections are making forward progress. I meant (and correct me if I'm >> wrong) that, as long as a task doesn't sleep in a preemptible RCU >> read-section (rcu-preempt flavor), then bad things wont happen and RCU will >> work correctly. > > The exception is -rt "spinlock" acquisition. If the "spinlock" is held, > the task acquiring it will block, which is legal within an RCU-preempt > read-side critical section. > > This exception is why I define bad things in terms of lack of > susceptibility to priority boosting instead of sleeping. Oh, that's a tricky situation. Thanks for letting me know. I guess my view was too idealistic. Makes sense now. >> > > I was asking why rcu-bh is needed in the kernel, like why can't we just >> use >> > > rcu-preempt. As per above link, the motivation of rcu-bh was to prevent >> > > denial of service during heavy softirq load. I was trying to understand >> > > that usecase. In my mind, such denial of service / out of memory is then >> > > even possible with preemptible rcu which is used in many places in the >> > > kernel, then why not just use rcu-bh for everything? I was just studying >> > > this RCU flavor (and all other RCU flavors) and so this question popped >> up. >> >> > Because RCU-bh is not preemptible. >> >> > And the non-DoS nature of RCU-bh is one challenge in my current quest to >> > fold all three flavors (RCU-bh, RCU-preempt, and RCU-sched) into one >> > flavor to rule them all. ;-) >> >> But what prevents DoS'ing of RCU-preempt? That means all RCU-preempt uses >> in the kernel are susceptible to DoS'ing as well? > > Right now, not much. So this is one of the problems I must solve. Oh, ok. >> Isn't the issue the heavy softirq processing itself which can also lead to >> other issues such as scheduling issues (other than the OOM) so probably >> that should be fixed instead of RCU? > > In theory, yes. In practice, the way that the kernel hangs leads them > to yell at me about RCU instead of yelling at whoever is behind the > root cause. So it behooves me to make RCU able to deal with whatever > shows up, at least where reasonably feasible. Otherwise, I am signed up > to fix random DoS-related bugs though more that 20 million lines of code, > which would be a nobel quest, but not one that I am currently prepared > to sign up for. ;-) Yes, I understand. :-) thanks, - Joel