From patchwork Tue Jan 10 18:16:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 713368 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3tygG9060hz9t6g for ; Wed, 11 Jan 2017 05:16:49 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="ZIurSci2"; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1763208AbdAJSQo (ORCPT ); Tue, 10 Jan 2017 13:16:44 -0500 Received: from mail-it0-f65.google.com ([209.85.214.65]:36126 "EHLO mail-it0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755547AbdAJSQa (ORCPT ); Tue, 10 Jan 2017 13:16:30 -0500 Received: by mail-it0-f65.google.com with SMTP id o138so191914ito.3 for ; Tue, 10 Jan 2017 10:16:30 -0800 (PST) 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=dohtm957QwvpsS0youTCCTnLqU+GQuEQtmFNhlaqS/E=; b=ZIurSci26tQWYNuxfXVf3MUc0A3XmTk3eFW0mBZacvhz+8ZOGIPUUO84W5g2RKclyb vgd+EBnPPszunSIACm9p6Cf86TISvC+wfNOsPCCdHx9mB2LaoTlEhUR4FpiGvj30LJ3d iBa5Ne5elCXNVifl81FDtzFnK8+QCLlwVNJ+r48hH3tZqKvZhwmNkuPWiRXhpaD1aBVT ttDhjvdqZvrZBYfgv4dDXWhojQ302LzxnuRi/c1G1fIVmBHO738sVyl/o9iWjLqaH4bs wO7A4ia9jHTGNKELgNxyIR2h3mF9boO082U7qFOpWk6RlSGRQ4MA5DqUeNPl8BRaNhGW gQSA== 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=dohtm957QwvpsS0youTCCTnLqU+GQuEQtmFNhlaqS/E=; b=j7lyWdHhq//CaNjqkIzhFE7P/IWT5+sxdAiS9+FujNYeqwFrIqpM0Ae3eOiPqIzDDu luM2TG87AB5Du4qqysmuTCFD4Lt0Mr4DaFuUvCoDyW2CRn0eHYsrCHe3vXHbyiPgrw9W M0iaB8FYsL1mqOfv8Z7OuPiS48JLQEWJMY0Fkzyo8ZWc0gBMpMPqX1ziNPz/JGmcLKjH QEdDsovcTl6DKFLREGy1QYlvHgjJ7OBNM5KD0F9H96QTFmqDuPSiSyTi0H0yZB4xoFZu brly0pcTrNGo5xp+obPCggBAWSXJkbKG8TTIjklQa30wPGW6pCEJpEX6XMOFkx6pC6Zy y4MQ== X-Gm-Message-State: AIkVDXLRHUd/gigHhd2/uxpq9iRX0DMZGOyuMiR9PbjkmgLZh/o7mViTF207i4ytjF8oQB2SOVyhFnICpO6vCQ== X-Received: by 10.36.71.207 with SMTP id t198mr1301532itb.98.1484072190064; Tue, 10 Jan 2017 10:16:30 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.183.78 with HTTP; Tue, 10 Jan 2017 10:16:29 -0800 (PST) In-Reply-To: <1484055562-6414-1-git-send-email-david.lebrun@uclouvain.be> References: <1484055562-6414-1-git-send-email-david.lebrun@uclouvain.be> From: ericnetdev dumazet Date: Tue, 10 Jan 2017 10:16:29 -0800 Message-ID: Subject: Re: [PATCH net] ipv6: sr: fix BUG in HMAC init when preemption is enabled To: David Lebrun Cc: netdev@vger.kernel.org Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 2017-01-10 5:39 GMT-08:00 David Lebrun : > When CONFIG_PREEMPT=y, CONFIG_IPV6=m and CONFIG_SEG6_HMAC=y, > seg6_hmac_init() is called during the initialization of the ipv6 module. > This causes a subsequent call to smp_processor_id() with preemption > enabled, resulting in the following trace. I disagree with your fix. Keeping GFP_KERNEL for all these per cpu allocations is needed. What about the simpler : Rationale : we only need to get the size of the allocation, we do not care of migration here, all cpus having the same allocation. Another issue with this is code is that in case of an allocation error, no cleanup is performed to free prior allocations. diff --git a/net/ipv6/seg6_hmac.c b/net/ipv6/seg6_hmac.c index ef1c8a46e7aceee45b2044d4b4338dc3aed88807..b31d682816503129e12d3eae5b70a8cbce8525a7 100644 --- a/net/ipv6/seg6_hmac.c +++ b/net/ipv6/seg6_hmac.c @@ -400,7 +400,7 @@ static int seg6_hmac_init_algo(void) *p_tfm = tfm; } - p_tfm = this_cpu_ptr(algo->tfms); + p_tfm = __this_cpu_ptr(algo->tfms); tfm = *p_tfm; shsize = sizeof(*shash) + crypto_shash_descsize(tfm);