From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751419AbeDXRAU (ORCPT ); Tue, 24 Apr 2018 13:00:20 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:42676 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751047AbeDXRAQ (ORCPT ); Tue, 24 Apr 2018 13:00:16 -0400 Date: Tue, 24 Apr 2018 13:00:11 -0400 (EDT) From: Mikulas Patocka X-X-Sender: mpatocka@file01.intranet.prod.int.rdu2.redhat.com To: Michal Hocko cc: Matthew Wilcox , David Miller , Andrew Morton , linux-mm@kvack.org, eric.dumazet@gmail.com, edumazet@google.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, mst@redhat.com, jasowang@redhat.com, virtualization@lists.linux-foundation.org, dm-devel@redhat.com, Vlastimil Babka Subject: Re: [PATCH v3] kvmalloc: always use vmalloc if CONFIG_DEBUG_SG In-Reply-To: <20180424162906.GM17484@dhcp22.suse.cz> Message-ID: References: <20180420130852.GC16083@dhcp22.suse.cz> <20180420210200.GH10788@bombadil.infradead.org> <20180421144757.GC14610@bombadil.infradead.org> <20180423151545.GU17484@dhcp22.suse.cz> <20180424125121.GA17484@dhcp22.suse.cz> <20180424162906.GM17484@dhcp22.suse.cz> User-Agent: Alpine 2.02 (LRH 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 24 Apr 2018, Michal Hocko wrote: > On Tue 24-04-18 11:50:30, Mikulas Patocka wrote: > > > > > > On Tue, 24 Apr 2018, Michal Hocko wrote: > > > > > On Mon 23-04-18 20:06:16, Mikulas Patocka wrote: > > > [...] > > > > @@ -404,6 +405,12 @@ void *kvmalloc_node(size_t size, gfp_t f > > > > */ > > > > WARN_ON_ONCE((flags & GFP_KERNEL) != GFP_KERNEL); > > > > > > > > +#ifdef CONFIG_DEBUG_SG > > > > + /* Catch bugs when the caller uses DMA API on the result of kvmalloc. */ > > > > + if (!(prandom_u32_max(2) & 1)) > > > > + goto do_vmalloc; > > > > +#endif > > > > > > I really do not think there is anything DEBUG_SG specific here. Why you > > > simply do not follow should_failslab path or even reuse the function? > > > > CONFIG_DEBUG_SG is enabled by default in RHEL and Fedora debug kernel (if > > you don't like CONFIG_DEBUG_SG, pick any other option that is enabled > > there). > > Are you telling me that you are shaping a debugging functionality basing > on what RHEL has enabled? And you call me evil. This is just rediculous. > > > Fail-injection framework is if off by default and it must be explicitly > > enabled and configured by the user - and most users won't enable it. > > It can be enabled easily. And if you care enough for your debugging > kernel then just make it enabled unconditionally. So, should we add a new option CONFIG_KVMALLOC_FALLBACK_DEFAULT? I'm not quite sure if 3 lines of debugging code need an extra option, but if you don't want to reuse any existing debug option, it may be possible. Adding it to the RHEL debug kernel would be trivial. Mikulas From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mikulas Patocka Subject: Re: [PATCH v3] kvmalloc: always use vmalloc if CONFIG_DEBUG_SG Date: Tue, 24 Apr 2018 13:00:11 -0400 (EDT) Message-ID: References: <20180420130852.GC16083@dhcp22.suse.cz> <20180420210200.GH10788@bombadil.infradead.org> <20180421144757.GC14610@bombadil.infradead.org> <20180423151545.GU17484@dhcp22.suse.cz> <20180424125121.GA17484@dhcp22.suse.cz> <20180424162906.GM17484@dhcp22.suse.cz> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: dm-devel@redhat.com, eric.dumazet@gmail.com, mst@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Matthew Wilcox , virtualization@lists.linux-foundation.org, linux-mm@kvack.org, edumazet@google.com, Andrew Morton , David Miller , Vlastimil Babka To: Michal Hocko Return-path: In-Reply-To: <20180424162906.GM17484@dhcp22.suse.cz> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: virtualization-bounces@lists.linux-foundation.org Errors-To: virtualization-bounces@lists.linux-foundation.org List-Id: netdev.vger.kernel.org On Tue, 24 Apr 2018, Michal Hocko wrote: > On Tue 24-04-18 11:50:30, Mikulas Patocka wrote: > > > > > > On Tue, 24 Apr 2018, Michal Hocko wrote: > > > > > On Mon 23-04-18 20:06:16, Mikulas Patocka wrote: > > > [...] > > > > @@ -404,6 +405,12 @@ void *kvmalloc_node(size_t size, gfp_t f > > > > */ > > > > WARN_ON_ONCE((flags & GFP_KERNEL) != GFP_KERNEL); > > > > > > > > +#ifdef CONFIG_DEBUG_SG > > > > + /* Catch bugs when the caller uses DMA API on the result of kvmalloc. */ > > > > + if (!(prandom_u32_max(2) & 1)) > > > > + goto do_vmalloc; > > > > +#endif > > > > > > I really do not think there is anything DEBUG_SG specific here. Why you > > > simply do not follow should_failslab path or even reuse the function? > > > > CONFIG_DEBUG_SG is enabled by default in RHEL and Fedora debug kernel (if > > you don't like CONFIG_DEBUG_SG, pick any other option that is enabled > > there). > > Are you telling me that you are shaping a debugging functionality basing > on what RHEL has enabled? And you call me evil. This is just rediculous. > > > Fail-injection framework is if off by default and it must be explicitly > > enabled and configured by the user - and most users won't enable it. > > It can be enabled easily. And if you care enough for your debugging > kernel then just make it enabled unconditionally. So, should we add a new option CONFIG_KVMALLOC_FALLBACK_DEFAULT? I'm not quite sure if 3 lines of debugging code need an extra option, but if you don't want to reuse any existing debug option, it may be possible. Adding it to the RHEL debug kernel would be trivial. Mikulas